Functions

# Vector Scale
[Basic Math Functions]

## Functions
void | arm_scale_f32 (float32_t *pSrc, float32_t scale, float32_t *pDst, uint32_t blockSize)
void | arm_scale_q31 (q31_t *pSrc, q31_t scaleFract, int8_t shift, q31_t *pDst, uint32_t blockSize)
void | arm_scale_q15 (q15_t *pSrc, q15_t scaleFract, int8_t shift, q15_t *pDst, uint32_t blockSize)
void | arm_scale_q7 (q7_t *pSrc, q7_t scaleFract, int8_t shift, q7_t *pDst, uint32_t blockSize)

## Detailed Description

Multiply a vector by a scalar value. For floating-point data, the algorithm used is:

         pDst[n] = pSrc[n] * scale,   0 <= n < blockSize.

In the fixed-point Q7, 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 algorithm used with fixed-point data is:

         pDst[n] = (pSrc[n] * scaleFract) << shift,   0 <= n < blockSize.

The overall scale factor applied to the fixed-point data is

         scale = scaleFract * 2^shift.

## Function Documentation

void arm_scale_f32 | ( | float32_t * | pSrc,
|  | float32_t | scale,
|  | float32_t * | pDst,
|  | uint32_t | blockSize
| ) |  |

Multiplies a floating-point vector by a scalar.

Parameters:

  [in] | *pSrc | points to the input vector
  [in] | scale | scale factor to be applied
  [out] | *pDst | points to the output vector
  [in] | blockSize | number of samples in the vector

Returns:
  none.

Examples:
  arm_graphic_equalizer_example_q31.c, and arm_signal_converge_example_f32.c.

Definition at line 78 of file arm_scale_f32.c.

void arm_scale_q31 | ( | q31_t * | pSrc,
|  | q31_t | scaleFract,
|  | int8_t | shift,
|  | q31_t * | pDst,
|  | uint32_t | blockSize
| ) |  |

Multiplies a Q31 vector by a scalar.

Parameters:

  [in] | *pSrc | points to the input vector
  [in] | scaleFract | fractional portion of the scale value
  [in] | shift | number of bits to shift the result by
  [out] | *pDst | points to the output vector
  [in] | blockSize | number of samples in the vector

Returns:
  none.

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 and this is shifted with saturation to 1.31 format.

Examples:
  arm_graphic_equalizer_example_q31.c.

Definition at line 59 of file arm_scale_q31.c.

void arm_scale_q15 | ( | q15_t * | pSrc,
|  | q15_t | scaleFract,
|  | int8_t | shift,
|  | q15_t * | pDst,
|  | uint32_t | blockSize
| ) |  |

Multiplies a Q15 vector by a scalar.

Parameters:

  [in] | *pSrc | points to the input vector
  [in] | scaleFract | fractional portion of the scale value
  [in] | shift | number of bits to shift the result by
  [out] | *pDst | points to the output vector
  [in] | blockSize | number of samples in the vector

Returns:
  none.

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.

Definition at line 60 of file arm_scale_q15.c.

void arm_scale_q7 | ( | q7_t * | pSrc,
|  | q7_t | scaleFract,
|  | int8_t | shift,
|  | q7_t * | pDst,
|  | uint32_t | blockSize
| ) |  |

Multiplies a Q7 vector by a scalar.

Parameters:

  [in] | *pSrc | points to the input vector
  [in] | scaleFract | fractional portion of the scale value
  [in] | shift | number of bits to shift the result by
  [out] | *pDst | points to the output vector
  [in] | blockSize | number of samples in the vector

Returns:
  none.

Scaling and Overflow Behavior:

  The input data `*pSrc` and `scaleFract` are in 1.7 format. These are multiplied to yield a 2.14 intermediate result and this is shifted with saturation to 1.7 format.

Definition at line 59 of file arm_scale_q7.c.

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines