HPM SDK
HPMicro Software Development Kit
DSP Statistics Functions

Functions

static float32_t hpm_dsp_max_f32 (const float32_t *src, uint32_t size, uint32_t *index)
 Maximum value of the floating-potint vector. More...
 
static float32_t hpm_dsp_max_val_f32 (const float32_t *src, uint32_t size)
 
static q15_t hpm_dsp_max_q15 (const q15_t *src, uint32_t size, uint32_t *index)
 Maximum value of the q15 vector. More...
 
static q31_t hpm_dsp_max_q31 (const q31_t *src, uint32_t size, uint32_t *index)
 Maximum value of the q31 vector. More...
 
static q7_t hpm_dsp_max_q7 (const q7_t *src, uint32_t size, uint32_t *index)
 Maximum value of the q7 vector. More...
 
static uint8_t hpm_dsp_max_u8 (const uint8_t *src, uint32_t size, uint32_t *index)
 Max value of the u8 vector. More...
 
static float32_t hpm_dsp_min_f32 (const float32_t *src, uint32_t size, uint32_t *index)
 Minimum value of the floating-potint vector. More...
 
static q15_t hpm_dsp_min_q15 (const q15_t *src, uint32_t size, uint32_t *index)
 Minimum value of the q15 vector. More...
 
static q31_t hpm_dsp_min_q31 (const q31_t *src, uint32_t size, uint32_t *index)
 Minimum value of the q31 vector. More...
 
static q7_t hpm_dsp_min_q7 (const q7_t *src, uint32_t size, uint32_t *index)
 Minimum value of the q7 vector. More...
 
static uint8_t hpm_dsp_min_u8 (const uint8_t *src, uint32_t size, uint32_t *index)
 Minimum value of the u8 vector. More...
 
static float32_t hpm_dsp_mean_f32 (const float32_t *src, uint32_t size)
 Mean value of the floating-potint vector. More...
 
static q15_t hpm_dsp_mean_q15 (const q15_t *src, uint32_t size)
 Mean value of the q15 vector. More...
 
static q31_t hpm_dsp_mean_q31 (const q31_t *src, uint32_t size)
 Mean value of the q31 vector. More...
 
static q7_t hpm_dsp_mean_q7 (const q7_t *src, uint32_t size)
 Mean value of the q7 vector. More...
 
static uint8_t hpm_dsp_mean_u8 (const uint8_t *src, uint32_t size)
 Mean value of the u8 vector. More...
 
static float32_t hpm_dsp_pwr_f32 (const float32_t *src, uint32_t size)
 Sum of the squares of the floating-potint vector. More...
 
static q63_t hpm_dsp_pwr_q15 (const q15_t *src, uint32_t size)
 Sum of the squares of the q15 vector. More...
 
static q63_t hpm_dsp_pwr_q31 (const q31_t *src, uint32_t size)
 Sum of the squares of the q31 vector. More...
 
static q31_t hpm_dsp_pwr_q7 (const q7_t *src, uint32_t size)
 Sum of the squares of the q7 vector. More...
 
static float32_t hpm_dsp_rms_f32 (const float32_t *src, uint32_t size)
 RMS of the floating-potint vector. More...
 
static q15_t hpm_dsp_rms_q15 (const q15_t *src, uint32_t size)
 RMS of the q15 vector. More...
 
static q31_t hpm_dsp_rms_q31 (const q31_t *src, uint32_t size)
 RMS of the q31 vector. More...
 
static float32_t hpm_dsp_std_f32 (const float32_t *src, uint32_t size)
 Standard deviation of the floating-potint vector. More...
 
static q15_t hpm_dsp_std_q15 (const q15_t *src, uint32_t size)
 Standard deviation of the q15 vector. More...
 
static q31_t hpm_dsp_std_q31 (const q31_t *src, uint32_t size)
 Standard deviation of the q31 vector. More...
 
static q15_t hpm_dsp_std_u8 (const uint8_t *src, uint32_t size)
 Standard deviation of the u8 vector. More...
 
static float32_t hpm_dsp_var_f32 (const float32_t *src, uint32_t size)
 Variance of the floating-potint vector. More...
 
static q31_t hpm_dsp_var_q15 (const q15_t *src, uint32_t size)
 Variance of the q15 vector. More...
 
static q63_t hpm_dsp_var_q31 (const q31_t *src, uint32_t size)
 Variance of the q31 vector. More...
 
static float32_t hpm_dsp_entropy_f32 (const float32_t *src, uint32_t size)
 Entropy of the floating-potint vector. More...
 
static float32_t hpm_dsp_relative_entropy_f32 (const float32_t *src1, const float32_t *src2, uint32_t size)
 Relative Entropy of the floating-potint vector. More...
 
static float32_t hpm_dsp_lse_f32 (const float32_t *src, uint32_t size)
 Log-Sum-Exp of the floating-potint vector. More...
 
static float32_t hpm_dsp_lse_dprod_f32 (const float32_t *src1, const float32_t *src2, uint32_t size, float32_t *buffer)
 Dot product with Log-Sum-Exp of the floating-potint vector. More...
 
static uint32_t hpm_dsp_gaussian_naive_bayes_est_f32 (const riscv_dsp_gaussian_naivebayes_f32_t *instance, const float32_t *src, float32_t *buf)
 Naive Gaussian Bayesian Estimator. More...
 
static float32_t hpm_dsp_absmax_f32 (const float32_t *src, uint32_t size, uint32_t *index)
 Maximum absolute value of the floating-potint vector. More...
 
static q15_t hpm_dsp_absmax_q15 (const q15_t *src, uint32_t size, uint32_t *index)
 Maximum absolute value of the q15 vector. More...
 
static q31_t hpm_dsp_absmax_q31 (const q31_t *src, uint32_t size, uint32_t *index)
 Maximum absolute value of the q31 vector. More...
 
static q7_t hpm_dsp_absmax_q7 (const q7_t *src, uint32_t size, uint32_t *index)
 Maximum absolute value of the q7 vector. More...
 
static float32_t hpm_dsp_absmin_f32 (const float32_t *src, uint32_t size, uint32_t *index)
 Minimum absolute value of the floating-potint vector. More...
 
static q31_t hpm_dsp_absmin_q31 (const q31_t *src, uint32_t size, uint32_t *index)
 Minimum absolute value of the q31 vector. More...
 
static q15_t hpm_dsp_absmin_q15 (const q15_t *src, uint32_t size, uint32_t *index)
 Minimum absolute value of the q15 vector. More...
 
static q7_t hpm_dsp_absmin_q7 (const q7_t *src, uint32_t size, uint32_t *index)
 Minimum absolute value of the q7 vector. More...
 

Detailed Description

Function Documentation

◆ hpm_dsp_absmax_f32()

static float32_t hpm_dsp_absmax_f32 ( const float32_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum absolute value of the floating-potint vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Maximum value

◆ hpm_dsp_absmax_q15()

static q15_t hpm_dsp_absmax_q15 ( const q15_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum absolute value of the q15 vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Maximum value

◆ hpm_dsp_absmax_q31()

static q31_t hpm_dsp_absmax_q31 ( const q31_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum absolute value of the q31 vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Maximum value

◆ hpm_dsp_absmax_q7()

static q7_t hpm_dsp_absmax_q7 ( const q7_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum absolute value of the q7 vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Maximum value

◆ hpm_dsp_absmin_f32()

static float32_t hpm_dsp_absmin_f32 ( const float32_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum absolute value of the floating-potint vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Minimum value

◆ hpm_dsp_absmin_q15()

static q15_t hpm_dsp_absmin_q15 ( const q15_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum absolute value of the q15 vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Minimum value

◆ hpm_dsp_absmin_q31()

static q31_t hpm_dsp_absmin_q31 ( const q31_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum absolute value of the q31 vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Minimum value

◆ hpm_dsp_absmin_q7()

static q7_t hpm_dsp_absmin_q7 ( const q7_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum absolute value of the q7 vector.

Parameters
[in]srcpointer of the input vector
[in]sizenumber of elements in a vector
[out]indexindex of the maximum value
Returns
Minimum value

◆ hpm_dsp_entropy_f32()

static float32_t hpm_dsp_entropy_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Entropy of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Entropy value.

E = -sum (P .* log2 (P))

◆ hpm_dsp_gaussian_naive_bayes_est_f32()

static uint32_t hpm_dsp_gaussian_naive_bayes_est_f32 ( const riscv_dsp_gaussian_naivebayes_f32_t *  instance,
const float32_t *  src,
float32_t *  buf 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Naive Gaussian Bayesian Estimator.

Parameters
[in]*instancepoints to a naive bayes instance
[in]*srcpoints to the elements of the input vector.
[in]*bufpoints to a buffer of length numofclass /numberOfClasses
Returns
The predicted class

◆ hpm_dsp_lse_dprod_f32()

static float32_t hpm_dsp_lse_dprod_f32 ( const float32_t *  src1,
const float32_t *  src2,
uint32_t  size,
float32_t *  buffer 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Dot product with Log-Sum-Exp of the floating-potint vector.

Parameters
[in]*src1points to the first input vector.
[in]*src2points to the second input vector.
[in]sizesize of the vectors.
[in]*bufferpoints to temporary buffer.
Returns
the Log-Sum-Exp of dot product value.

◆ hpm_dsp_lse_f32()

static float32_t hpm_dsp_lse_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Log-Sum-Exp of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
lse value.

◆ hpm_dsp_max_f32()

static float32_t hpm_dsp_max_f32 ( const float32_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum value of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the maximum value.
Returns
maximum value.

◆ hpm_dsp_max_q15()

static q15_t hpm_dsp_max_q15 ( const q15_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum value of the q15 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the maximum value.
Returns
maximum value.

◆ hpm_dsp_max_q31()

static q31_t hpm_dsp_max_q31 ( const q31_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum value of the q31 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the maximum value.
Returns
maximum value.

◆ hpm_dsp_max_q7()

static q7_t hpm_dsp_max_q7 ( const q7_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Maximum value of the q7 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the maximum value.
Returns
maximum value.

◆ hpm_dsp_max_u8()

static uint8_t hpm_dsp_max_u8 ( const uint8_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Max value of the u8 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the maximum value.
Returns
max value.

◆ hpm_dsp_max_val_f32()

static float32_t hpm_dsp_max_val_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

◆ hpm_dsp_mean_f32()

static float32_t hpm_dsp_mean_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Mean value of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
mean value.

◆ hpm_dsp_mean_q15()

static q15_t hpm_dsp_mean_q15 ( const q15_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Mean value of the q15 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
mean value.

Function notes:

The 1.15 format input is accumulated in a 32-bit accumulator in 17.15 format and then truncated to yield a result of 1.15 format.

◆ hpm_dsp_mean_q31()

static q31_t hpm_dsp_mean_q31 ( const q31_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Mean value of the q31 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
mean value.

Function notes:

The 1.31 format input is accumulated in a 64-bit accumulator in 33.31 format and then truncated to yield a result of 1.31 format.

◆ hpm_dsp_mean_q7()

static q7_t hpm_dsp_mean_q7 ( const q7_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Mean value of the q7 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
mean value.

Function notes:

The 1.7 format input is accumulated in a 32-bit accumulator in 25.7 format and then truncated to yield a result of 1.7 format.

◆ hpm_dsp_mean_u8()

static uint8_t hpm_dsp_mean_u8 ( const uint8_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Mean value of the u8 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
mean value.

The 8-bit format input is accumulated in a 32-bit accumulator and then truncated to yield a result of 8-bit format.

◆ hpm_dsp_min_f32()

static float32_t hpm_dsp_min_f32 ( const float32_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum value of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the minimum value.
Returns
minimum value.

◆ hpm_dsp_min_q15()

static q15_t hpm_dsp_min_q15 ( const q15_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum value of the q15 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the minimum value.
Returns
minimum value.

◆ hpm_dsp_min_q31()

static q31_t hpm_dsp_min_q31 ( const q31_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum value of the q31 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the minimum value.
Returns
minimum value.

◆ hpm_dsp_min_q7()

static q7_t hpm_dsp_min_q7 ( const q7_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum value of the q7 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the minimum value.
Returns
minimum value.

◆ hpm_dsp_min_u8()

static uint8_t hpm_dsp_min_u8 ( const uint8_t *  src,
uint32_t  size,
uint32_t *  index 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Minimum value of the u8 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
[out]*indexindex of the minimum value.
Returns
minimum value.

◆ hpm_dsp_pwr_f32()

static float32_t hpm_dsp_pwr_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Sum of the squares of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Sum of the squares value.

◆ hpm_dsp_pwr_q15()

static q63_t hpm_dsp_pwr_q15 ( const q15_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Sum of the squares of the q15 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Sum of the squares value.

Function notes:

The 1.15 format input is multiplied yields a 2.30 format, and then added without saturation to a 64-bit accumulator in 34.30 format. Finally, the return result is in 34.30 format.

◆ hpm_dsp_pwr_q31()

static q63_t hpm_dsp_pwr_q31 ( const q31_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Sum of the squares of the q31 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Sum of the squares value.

Function notes:

The 1.31 format input is multiplied yields a 2.62 format and this result is truncated to 2.48 format by discarding the lower 14 bits. The 2.48 result is then added without saturation to a 64-bit accumulator in 16.48 format. Finally, the return result is in 16.48 format.

◆ hpm_dsp_pwr_q7()

static q31_t hpm_dsp_pwr_q7 ( const q7_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Sum of the squares of the q7 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Sum of the squares value.

Function notes:

The 1.7 format input is multiplied yields a 2.14 format, and then added without saturation to a 32-bit accumulator in 18.14 format. Finally, the return result is in 18.14 format.

◆ hpm_dsp_relative_entropy_f32()

static float32_t hpm_dsp_relative_entropy_f32 ( const float32_t *  src1,
const float32_t *  src2,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Relative Entropy of the floating-potint vector.

Parameters
[in]*src1points to the first input vector.
[in]*src2points to the second input vector.
[in]sizesize of the vectors.
Returns
Relative Entropy value.

Relative Entropy also called KullbackLeibler divergence: D(A || B) = A * ln(A / B);

◆ hpm_dsp_rms_f32()

static float32_t hpm_dsp_rms_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

RMS of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
RMS value.

◆ hpm_dsp_rms_q15()

static q15_t hpm_dsp_rms_q15 ( const q15_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

RMS of the q15 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
RMS value.

Function notes:

The 1.15 format input is multiplied yields a 2.30 format, and then added without saturation to a 64-bit accumulator in 34.30 format. Finally, the added output is truncated to 34.15 format by discarding the lower 15 bits, and then saturated to yield a result in 1.15 format.

◆ hpm_dsp_rms_q31()

static q31_t hpm_dsp_rms_q31 ( const q31_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

RMS of the q31 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
RMS value.

Function notes:

The 1.31 format input is multiplied yields a 2.62 format. In order to avoid overflows, the input signal must be scaled down by log2(size) bits, Finally, the 2.62 accumulator is right shifted by 31 bits to yield a 1.31 format value.

◆ hpm_dsp_std_f32()

static float32_t hpm_dsp_std_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Standard deviation of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Standard deviation value.

◆ hpm_dsp_std_q15()

static q15_t hpm_dsp_std_q15 ( const q15_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Standard deviation of the q15 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Standard deviation value.

Function notes:

The 1.15 format input is multiplied yields a 2.30 format, and then added without saturation to a 64-bit accumulator in 34.30 format. Finally, the added output is truncated to 34.15 format by discarding the lower 15 bits, and then saturated to yield a result in 1.15 format.

◆ hpm_dsp_std_q31()

static q31_t hpm_dsp_std_q31 ( const q31_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Standard deviation of the q31 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Standard deviation value.

Function notes:

The 1.31 format input is multiplied yields a 2.62 format. In order to avoid overflows, the input signal must be scaled down by log2(size) bits, Finally, the 2.62 accumulator is right shifted by 31 bits to yield a 1.31 format value.

◆ hpm_dsp_std_u8()

static q15_t hpm_dsp_std_u8 ( const uint8_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Standard deviation of the u8 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Standard deviation value.

Function notes: The 8-bit format input is multiplied yields a 16-bit format, and then added saturation to a 32-bit accumulator in 16.16 format. Finally, the added output is truncated to 34.15 format by discarding the lower 1 bits, and then saturated to yield a result in 1.15 format.

◆ hpm_dsp_var_f32()

static float32_t hpm_dsp_var_f32 ( const float32_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Variance of the floating-potint vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Variance value.

◆ hpm_dsp_var_q15()

static q31_t hpm_dsp_var_q15 ( const q15_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Variance of the q15 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Variance value.

Function notes:

The 1.15 format input is multiplied yields a 2.30 format, and then added without saturation to a 64-bit accumulator in 34.30 format. Finally, the added output is truncated to 34.15 format by discarding the lower 15 bits, and then saturated to yield a result in 1.15 format.

◆ hpm_dsp_var_q31()

static q63_t hpm_dsp_var_q31 ( const q31_t *  src,
uint32_t  size 
)
inlinestatic

#include <middleware/hpm_math/hpm_math.h>

Variance of the q31 vector.

Parameters
[in]*srcpoints to the input vector.
[in]sizesize of the vectors.
Returns
Variance value.

Function notes:

The 1.31 format input is multiplied yields a 2.62 format. In order to avoid overflows, the input signal must be scaled down by log2(size) bits, Finally, the 2.62 accumulator is right shifted by 31 bits to yield a 1.31 format value.