I want to use Arm CMSIS-DSP library functions to perform matrix-vector multiplications on integers. It seems that the library, instead of integers, mainly supports operations on fixed-point numbers in Q7, Q15, and Q31 formats, which are in fact Q1.7, Q1.15, Q1.31 formats according to IBM's definition of fixed-point numbers. This means their values are between -1 and +1.

The matrix/vector inputs as well as the output of the functions arm_mat_vec_mult_q7/15/31 are in all Q7/15/31 formats. My main question here is about how to interpret the output of CMSIS-DSP functions that have input/outputs in Q7/Q15/Q31 format. Multiplying a vector by a matrix where both have entries within [-1,+1] does not necessarily result in a vector with entries in [-1,+1]. But the output of arm_mat_vec_mult_q7 is in Q7. Are the results saturated between -1 and +1? If so, should we reduce the range of inputs to prevent the saturation? Arm CMSIS's documentation is unfortunately very patchy. I couldn't find any information regarding this.


1 Answer 1


Are the results saturated between -1 and +1?

Yes. Take Q15 for example, you may notice that before output it has a saturation prevention function __SSAT

*px++ = (q15_t)(__SSAT((sum >> 15), 16));

and sum >> 15 means that the output is still a Q15 number.

If so, should we reduce the range of inputs to prevent the saturation?

Yes. Similar with the fixed point filtering functions, you should check the output to make sure it is within the range of $[-1, 1)$. Otherwise you will get the wrong results and you have to scale down the range of input. At the cost of loss of precision, in exchange for preventing overflow.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.