Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "arm_math.h"
00026
00064 arm_status arm_mat_scale_f32(
00065 const arm_matrix_instance_f32 * pSrc,
00066 float32_t scale,
00067 arm_matrix_instance_f32 * pDst)
00068 {
00069 float32_t *pIn = pSrc->pData;
00070 float32_t *pOut = pDst->pData;
00071 float32_t in1, in2, in3, in4;
00072 float32_t in5, in6, in7, in8;
00073 float32_t out1, out2, out3, out4;
00074 float32_t out5, out6, out7, out8;
00075 uint32_t numSamples;
00076 uint32_t blkCnt;
00077 arm_status status;
00078
00079 #ifdef ARM_MATH_MATRIX_CHECK
00080
00081 if((pSrc->numRows != pDst->numRows) || (pSrc->numCols != pDst->numCols))
00082 {
00083
00084 status = ARM_MATH_SIZE_MISMATCH;
00085 }
00086 else
00087 #endif
00088 {
00089
00090 numSamples = (uint32_t) pSrc->numRows * pSrc->numCols;
00091
00092
00093 blkCnt = numSamples >> 3u;
00094
00095
00096
00097 while(blkCnt > 0u)
00098 {
00099
00100
00101 in1 = pIn[0];
00102 in2 = pIn[1];
00103 in3 = pIn[2];
00104 in4 = pIn[3];
00105
00106 out1 = in1 * scale;
00107 out2 = in2 * scale;
00108 out3 = in3 * scale;
00109 out4 = in4 * scale;
00110
00111 in5 = pIn[4];
00112 in6 = pIn[5];
00113 in7 = pIn[6];
00114 in8 = pIn[7];
00115
00116 pOut[0] = out1;
00117 pOut[1] = out2;
00118 pOut[2] = out3;
00119 pOut[3] = out4;
00120
00121 out5 = in5 * scale;
00122 out6 = in6 * scale;
00123 out7 = in7 * scale;
00124 out8 = in8 * scale;
00125
00126 pOut[4] = out5;
00127 pOut[5] = out6;
00128 pOut[6] = out7;
00129 pOut[7] = out8;
00130
00131 pIn += 8u;
00132 pOut += 8u;
00133
00134
00135 blkCnt--;
00136 }
00137
00138
00139
00140 blkCnt = numSamples % 0x8u;
00141
00142 while(blkCnt > 0u)
00143 {
00144
00145
00146 *pOut++ = (*pIn++) * scale;
00147
00148
00149 blkCnt--;
00150 }
00151
00152
00153 status = ARM_MATH_SUCCESS;
00154 }
00155
00156
00157 return (status);
00158 }
00159