Skip to main content
2 of 3
added 21 characters in body

The CMSIS-DSP matrix functions take integers or floats as data input, however your arrays are uint_16 so you may have data loss or wrong results due to the implicit conversions. if you used arm_mat_mult_fast_q15.

what I would do is cast my input arrays to int32 (Q31) and then do the multiplication. (No need to convert to matrices)

//nRows1,nColumns1, nRows2, nColumns2 are the dimensions of matrices(arrays) 1 and 2
int32 res[nRows1*nColumns2]; // if nColumns1=nRows2 
int32 *pRes = res;
arm_matrix_instance_q31 S1 = {nRows1, nColumns1, pData1}; //pData1 is pointer to array1
arm_matrix_instance_q31 S2 = {nRows2, nColumns2, pData2}; //pData2 is pointer to array2
arm_matrix_instance_q31 SRes = {nRows1, nColumns2, pRes}; //pRes is pointer the result array

arm_mat_mult_fast_q31 ( &S1, &s2, &SRes); // your results will be in 1D array res

Note: if you need to cast your results back to uint16_t make sure the values are less than < 65536 (2^16) otherwise you will have data loss (wrong results) again.