Multiplies a matrix by a scalar. This is accomplished by multiplying each element in the matrix by the scalar. For example:
Matrix Scaling of a 3 x 3 matrix
The function checks to make sure that the input and output matrices are of the same size.
In the fixed-point Q15 and Q31 functions, scale
is represented by a fractional multiplication scaleFract
and an arithmetic shift shift
. The shift allows the gain of the scaling operation to exceed 1.0. The overall scale factor applied to the fixed-point data is
scale = scaleFract * 2^shift.
- Parameters
-
[in] | pSrc | points to input matrix |
[in] | scale | scale factor to be applied |
[out] | pDst | points to output matrix structure |
- Returns
- execution status
- Parameters
-
[in] | pSrc | points to input matrix |
[in] | scaleFract | fractional portion of the scale factor |
[in] | shift | number of bits to shift the result by |
[out] | pDst | points to output matrix structure |
- Returns
- execution status
- Scaling and Overflow Behavior
- The input data
*pSrc
and scaleFract
are in 1.15 format. These are multiplied to yield a 2.30 intermediate result and this is shifted with saturation to 1.15 format.
- Parameters
-
[in] | pSrc | points to input matrix |
[in] | scaleFract | fractional portion of the scale factor |
[in] | shift | number of bits to shift the result by |
[out] | pDst | points to output matrix structure |
- Returns
- execution status
- Scaling and Overflow Behavior
- The input data
*pSrc
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.