LIBML  Version 3.2.4
LIBML DSP Software Library
Functions
Matrix Scale
Collaboration diagram for Matrix Scale:

Functions

void tpt_mat_scale_f32 (f32_t *aOutMat, const f32_t *aInMat, uint16_t aRows, uint16_t aCols, f32_t aScale)
 Floating-point matrix scaling. More...
 
void tpt_mat_scale_f64 (f64_t *aOutMat, const f64_t *aInMat, uint16_t aRows, uint16_t aCols, f64_t aScale)
 Floating-point matrix scaling. More...
 
void tpt_mat_scale_q15 (q15_t *aOutMat, const q15_t *aInMat, uint16_t aRows, uint16_t aCols, q15_t aScaleFract, int8_t aShift)
 Q15 matrix scaling. More...
 
void tpt_mat_scale_q31 (q31_t *aOutMat, const q31_t *aInMat, uint16_t aRows, uint16_t aCols, q31_t aScaleFract, int8_t aShift)
 Q31 matrix scaling. More...
 

Detailed Description

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

In the fixed-point Q15 and Q31 functions, scale is represented by a fractional multiplication aScaleFract and an arithmetic shift aShift. 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 = aScaleFract * 2^aShift.
  

Function Documentation

◆ tpt_mat_scale_f32()

void tpt_mat_scale_f32 ( f32_t aOutMat,
const f32_t aInMat,
uint16_t  aRows,
uint16_t  aCols,
f32_t  aScale 
)

Floating-point matrix scaling.

Parameters
[out]aOutMatpoints to output matrix
[in]aInMatpoints to input matrix
[in]aRowsrows of matrix
[in]aColscols of matrix
[in]aScalescale factor to be applied
Returns
none

◆ tpt_mat_scale_f64()

void tpt_mat_scale_f64 ( f64_t aOutMat,
const f64_t aInMat,
uint16_t  aRows,
uint16_t  aCols,
f64_t  aScale 
)

Floating-point matrix scaling.

Parameters
[out]aOutMatpoints to output matrix
[in]aInMatpoints to input matrix
[in]aRowsrows of matrix
[in]aColscols of matrix
[in]aScalescale factor to be applied
Returns
none

◆ tpt_mat_scale_q15()

void tpt_mat_scale_q15 ( q15_t aOutMat,
const q15_t aInMat,
uint16_t  aRows,
uint16_t  aCols,
q15_t  aScaleFract,
int8_t  aShift 
)

Q15 matrix scaling.

Parameters
[out]aOutMatpoints to output matrix
[in]aInMatpoints to input matrix
[in]aRowsrows of matrix
[in]aColscols of matrix
[in]aScaleFractfractional portion of the scale factor
[in]aShiftnumber of bits to shift the result by
Returns
none
Scaling and Overflow Behavior
The input data *aInMat and aScaleFract 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.

◆ tpt_mat_scale_q31()

void tpt_mat_scale_q31 ( q31_t aOutMat,
const q31_t aInMat,
uint16_t  aRows,
uint16_t  aCols,
q31_t  aScaleFract,
int8_t  aShift 
)

Q31 matrix scaling.

Parameters
[out]aOutMatpoints to output matrix
[in]aInMatpoints to input matrix
[in]aRowsrows of matrix
[in]aColscols of matrix
[in]aScaleFractscale factor to be applied
[in]aShiftscale factor to be applied
Returns
none
Scaling and Overflow Behavior
The input data *aInMat and aScaleFract are in 1.31 format. These are multiplied to yield a 2.62 intermediate result which is shifted with saturation to 1.31 format.