1.5.3.9 mchp_mat_scale_q31()

mchp_status mchp_mat_scale_q31 (const mchp_matrix_instance_q31 * pSrc, q31_t scaleFract, int32_t shift, mchp_matrix_instance_q31 * pDst)

Q31 matrix scaling.

Parameters:
in pSrc

points to the input matrix

in scaleFract

fractional portion of the scale factor (Q31)

in shift

number of bits to shift the result by

out pDst

points to the output matrix structure

Returns:

The function returns either MCHP_MATH_SIZE_MISMATCH or MCHP_MATH_SUCCESS based on the outcome of size checking.

Scaling and Overflow Behavior:

The input data and scaleFract are in 1.31 format. These are multiplied to yield a 2.62 intermediate result which is shifted with saturation to 1.31 format. pDst[n] = (pSrc[n] * scaleFract) << (shift + 1) >> 32