CMSIS-DSP  
CMSIS DSP Software Library
 
Loading...
Searching...
No Matches
vec.hpp File Reference
#include <memory>
#include <cstring>
#include <algorithm>
#include "common.hpp"
#include "arch.hpp"
#include <type_traits>
#include "number.hpp"
#include "forward.hpp"
#include "fusion.hpp"
#include "unroll.hpp"
#include "algorithms.hpp"
#include "vector_impl.hpp"
#include "vector_view.hpp"
#include "Helium/matrix_multiply.hpp"
#include "DSP/matrix_multiply.hpp"
#include "Scalar/matrix_multiply.hpp"

Namespaces

namespace  arm_cmsis_dsp
 

Macros

#define FAST_MATH_FUNCTIONS_H_
 

Typedefs

typedef int8_t q7_t
 8-bit fractional data type in 1.7 format.
 
typedef int16_t q15_t
 16-bit fractional data type in 1.15 format.
 
typedef int32_t q31_t
 32-bit fractional data type in 1.31 format.
 
typedef int64_t q63_t
 64-bit fractional data type in 1.63 format.
 
typedef float float32_t
 32-bit floating-point type definition.
 
typedef double float64_t
 64-bit floating-point type definition.
 
typedef int64x2_t q63x2_t
 vector types
 
typedef int32x4_t q31x4_t
 32-bit fractional 128-bit vector data type in 1.31 format.
 
typedef int16x8_t q15x8_t
 16-bit fractional 128-bit vector data type with 16-bit alignment in 1.15 format.
 
typedef int8x16_t q7x16_t
 8-bit fractional 128-bit vector data type with 8-bit alignment in 1.7 format.
 
typedef int32x4x2_t q31x4x2_t
 32-bit fractional 128-bit vector pair data type in 1.31 format.
 
typedef int32x4x4_t q31x4x4_t
 32-bit fractional 128-bit vector quadruplet data type in 1.31 format.
 
typedef int16x8x2_t q15x8x2_t
 16-bit fractional 128-bit vector pair data type in 1.15 format.
 
typedef int16x8x4_t q15x8x4_t
 16-bit fractional 128-bit vector quadruplet data type in 1.15 format.
 
typedef int8x16x2_t q7x16x2_t
 8-bit fractional 128-bit vector pair data type in 1.7 format.
 
typedef int8x16x4_t q7x16x4_t
 8-bit fractional 128-bit vector quadruplet data type in 1.7 format.
 
typedef int32_t q23_t
 32-bit fractional data type in 9.23 format.
 
typedef int32x4_t q23x4_t
 32-bit fractional 128-bit vector data type in 9.23 format.
 
typedef int64x2_t status64x2_t
 64-bit status 128-bit vector data type.
 
typedef int32x4_t status32x4_t
 32-bit status 128-bit vector data type.
 
typedef int16x8_t status16x8_t
 16-bit status 128-bit vector data type.
 
typedef int8x16_t status8x16_t
 8-bit status 128-bit vector data type.
 
typedef float32x4_t f32x4_t
 32-bit floating-point 128-bit vector type
 
typedef float32x4x2_t f32x4x2_t
 32-bit floating-point 128-bit vector pair data type
 
typedef float32x4x4_t f32x4x4_t
 32-bit floating-point 128-bit vector quadruplet data type
 

Enumerations

enum  arm_status {
  ARM_MATH_SUCCESS = 0 ,
  ARM_MATH_ARGUMENT_ERROR = -1 ,
  ARM_MATH_LENGTH_ERROR = -2 ,
  ARM_MATH_SIZE_MISMATCH = -3 ,
  ARM_MATH_NANINF = -4 ,
  ARM_MATH_SINGULAR = -5 ,
  ARM_MATH_TEST_FAILURE = -6 ,
  ARM_MATH_DECOMPOSITION_FAILURE = -7 ,
  ARM_MATH_SUCCESS = 0 ,
  ARM_MATH_ARGUMENT_ERROR = -1 ,
  ARM_MATH_LENGTH_ERROR = -2 ,
  ARM_MATH_SIZE_MISMATCH = -3 ,
  ARM_MATH_NANINF = -4 ,
  ARM_MATH_SINGULAR = -5 ,
  ARM_MATH_TEST_FAILURE = -6 ,
  ARM_MATH_DECOMPOSITION_FAILURE = -7
}
 Error status returned by some functions in the library. More...
 
enum  arm_math_datatype {
  ARM_MATH_F16 = 16 ,
  ARM_MATH_F32 = 32 ,
  ARM_MATH_F64 = 64 ,
  ARM_MATH_Q7 = 7 ,
  ARM_MATH_Q15 = 15 ,
  ARM_MATH_Q31 = 31 ,
  ARM_MATH_F16 = 16 ,
  ARM_MATH_F32 = 32 ,
  ARM_MATH_F64 = 64 ,
  ARM_MATH_Q7 = 7 ,
  ARM_MATH_Q15 = 15 ,
  ARM_MATH_Q31 = 31
}
 Datatype identifier. More...
 
enum  arm_math_target_arch {
  ARM_MATH_SCALAR_ARCH = 1 ,
  ARM_MATH_DSP_EXTENSIONS_ARCH = 2 ,
  ARM_MATH_HELIUM_ARCH = 3 ,
  ARM_MATH_NEON_ARCH = 4 ,
  ARM_MATH_SCALAR_ARCH = 1 ,
  ARM_MATH_DSP_EXTENSIONS_ARCH = 2 ,
  ARM_MATH_HELIUM_ARCH = 3 ,
  ARM_MATH_NEON_ARCH = 4
}
 Architecture target identifier. More...
 

Functions

template<typename LHS, typename RHS, typename std::enable_if<(!is_scalar< LHS >()||!is_scalar< RHS >()) &&compatible_element< LHS, RHS >() &&same_static_length< LHS, RHS >(), bool >::type = true>
auto operator+ (const LHS &a, const RHS &b)
 Addition operator for expressions.
 
template<typename LHS, typename std::enable_if<!is_scalar< LHS >(), bool >::type = true>
auto operator+ (const LHS &a)
 
  • operator for expressions

 
template<typename LHS, typename std::enable_if<!is_scalar< LHS >(), bool >::type = true>
auto expr (const LHS &a)
 Identity operator for expression.
 
template<typename LHS, typename std::enable_if<!is_scalar< LHS >(), bool >::type = true>
auto copy (const LHS &a)
 Identity operator for expression.
 
template<typename LHS, typename RHS, typename std::enable_if<(!is_scalar< LHS >()||!is_scalar< RHS >()) &&compatible_element< LHS, RHS >() &&same_static_length< LHS, RHS >(), bool >::type = true>
auto operator- (const LHS &a, const RHS &b)
 Subtraction operator for expressions.
 
template<typename LHS, typename std::enable_if<!is_scalar< LHS >(), bool >::type = true>
auto operator- (const LHS &a)
 
  • operator for expressions

 
template<typename LHS, typename std::enable_if<!is_scalar< LHS >(), bool >::type = true>
auto conjugate (const LHS &a)
 
  • operator for expressions

 
template<typename LHS, typename RHS, typename std::enable_if<(!is_scalar< LHS >()||!is_scalar< RHS >()) &&compatible_element< LHS, RHS >() &&same_static_length< LHS, RHS >(), bool >::type = true>
auto operator* (const LHS &a, const RHS &b)
 Element wise multiplication operator for expressions.
 
template<typename RES, typename M, typename V>
void dot_transposed_unrolled (RES &res, const TransposeView< M > &m, const V &v)
 Four-column fallback for a transposed matrix times vector product.
 
q31_t read_q15x2 (q15_t const *pQ15)
 Read 2 Q15 from Q15 pointer.
 
void write_q15x2_ia (q15_t **pQ15, q31_t value)
 Write 2 Q15 to Q15 pointer and increment pointer afterwards.
 
void write_q15x2 (q15_t *pQ15, q31_t value)
 Write 2 Q15 to Q15 pointer.
 
q31_t read_q7x4 (q7_t const *pQ7)
 Read 4 Q7 from Q7 pointer.
 
void write_q7x4_ia (q7_t **pQ7, q31_t value)
 Write 4 Q7 to Q7 pointer and increment pointer afterwards.
 
q31_t clip_q63_to_q31 (q63_t x)
 Clips Q63 to Q31 values.
 
q15_t clip_q31_to_q15 (q31_t x)
 Clips Q31 to Q15 values.
 
q63_t mult32x64 (q63_t x, q31_t y)
 Multiplies Q63 by Q31 and returns a result in 2.62 format.
 
uint32_t arm_recip_q31 (q31_t in, q31_t *dst, const q31_t *pRecipTable)
 Function to Calculates 1/in (reciprocal) value of Q31 Data type. It should not be used with negative values.
 
uint32_t arm_recip_q15 (q15_t in, q15_t *dst, const q15_t *pRecipTable)
 Function to Calculates 1/in (reciprocal) value of Q15 Data type. It should not be used with negative values.
 
__STATIC_INLINE void arm_norm_64_to_32u (uint64_t in, int32_t *normalized, int32_t *norm)
 64-bit to 32-bit unsigned normalization
 
__STATIC_INLINE int32_t arm_div_int64_to_int32 (int64_t num, int32_t den)
 
void arm_mult_q7 (const q7_t *pSrcA, const q7_t *pSrcB, q7_t *pDst, uint32_t blockSize)
 Q7 vector multiplication.
 
void arm_mult_q15 (const q15_t *pSrcA, const q15_t *pSrcB, q15_t *pDst, uint32_t blockSize)
 Q15 vector multiplication.
 
void arm_mult_q31 (const q31_t *pSrcA, const q31_t *pSrcB, q31_t *pDst, uint32_t blockSize)
 Q31 vector multiplication.
 
void arm_mult_f32 (const float32_t *pSrcA, const float32_t *pSrcB, float32_t *pDst, uint32_t blockSize)
 Floating-point vector multiplication.
 
void arm_mult_f64 (const float64_t *pSrcA, const float64_t *pSrcB, float64_t *pDst, uint32_t blockSize)
 Floating-point vector multiplication.
 
void arm_add_f32 (const float32_t *pSrcA, const float32_t *pSrcB, float32_t *pDst, uint32_t blockSize)
 Floating-point vector addition.
 
void arm_add_f64 (const float64_t *pSrcA, const float64_t *pSrcB, float64_t *pDst, uint32_t blockSize)
 Floating-point vector addition.
 
void arm_add_q7 (const q7_t *pSrcA, const q7_t *pSrcB, q7_t *pDst, uint32_t blockSize)
 Q7 vector addition.
 
void arm_add_q15 (const q15_t *pSrcA, const q15_t *pSrcB, q15_t *pDst, uint32_t blockSize)
 Q15 vector addition.
 
void arm_add_q31 (const q31_t *pSrcA, const q31_t *pSrcB, q31_t *pDst, uint32_t blockSize)
 Q31 vector addition.
 
void arm_sub_f32 (const float32_t *pSrcA, const float32_t *pSrcB, float32_t *pDst, uint32_t blockSize)
 Floating-point vector subtraction.
 
void arm_sub_f64 (const float64_t *pSrcA, const float64_t *pSrcB, float64_t *pDst, uint32_t blockSize)
 Floating-point vector subtraction.
 
void arm_sub_q7 (const q7_t *pSrcA, const q7_t *pSrcB, q7_t *pDst, uint32_t blockSize)
 Q7 vector subtraction.
 
void arm_sub_q15 (const q15_t *pSrcA, const q15_t *pSrcB, q15_t *pDst, uint32_t blockSize)
 Q15 vector subtraction.
 
void arm_sub_q31 (const q31_t *pSrcA, const q31_t *pSrcB, q31_t *pDst, uint32_t blockSize)
 Q31 vector subtraction.
 
void arm_scale_f32 (const float32_t *pSrc, float32_t scale, float32_t *pDst, uint32_t blockSize)
 Multiplies a floating-point vector by a scalar.
 
void arm_scale_f64 (const float64_t *pSrc, float64_t scale, float64_t *pDst, uint32_t blockSize)
 Multiplies a floating-point vector by a scalar.
 
void arm_scale_q7 (const q7_t *pSrc, q7_t scaleFract, int8_t shift, q7_t *pDst, uint32_t blockSize)
 Multiplies a Q7 vector by a scalar.
 
void arm_scale_q15 (const q15_t *pSrc, q15_t scaleFract, int8_t shift, q15_t *pDst, uint32_t blockSize)
 Multiplies a Q15 vector by a scalar.
 
void arm_scale_q31 (const q31_t *pSrc, q31_t scaleFract, int8_t shift, q31_t *pDst, uint32_t blockSize)
 Multiplies a Q31 vector by a scalar.
 
void arm_abs_q7 (const q7_t *pSrc, q7_t *pDst, uint32_t blockSize)
 Q7 vector absolute value.
 
void arm_abs_f32 (const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
 Floating-point vector absolute value.
 
void arm_abs_f64 (const float64_t *pSrc, float64_t *pDst, uint32_t blockSize)
 Floating-point vector absolute value.
 
void arm_abs_q15 (const q15_t *pSrc, q15_t *pDst, uint32_t blockSize)
 Q15 vector absolute value.
 
void arm_abs_q31 (const q31_t *pSrc, q31_t *pDst, uint32_t blockSize)
 Q31 vector absolute value.
 
void arm_dot_prod_f32 (const float32_t *pSrcA, const float32_t *pSrcB, uint32_t blockSize, float32_t *result)
 Dot product of floating-point vectors.
 
void arm_dot_prod_f64 (const float64_t *pSrcA, const float64_t *pSrcB, uint32_t blockSize, float64_t *result)
 Dot product of floating-point vectors.
 
void arm_dot_prod_q7 (const q7_t *pSrcA, const q7_t *pSrcB, uint32_t blockSize, q31_t *result)
 Dot product of Q7 vectors.
 
void arm_dot_prod_q15 (const q15_t *pSrcA, const q15_t *pSrcB, uint32_t blockSize, q63_t *result)
 Dot product of Q15 vectors.
 
void arm_dot_prod_q31 (const q31_t *pSrcA, const q31_t *pSrcB, uint32_t blockSize, q63_t *result)
 Dot product of Q31 vectors.
 
void arm_shift_q7 (const q7_t *pSrc, int8_t shiftBits, q7_t *pDst, uint32_t blockSize)
 Shifts the elements of a Q7 vector a specified number of bits.
 
void arm_shift_q15 (const q15_t *pSrc, int8_t shiftBits, q15_t *pDst, uint32_t blockSize)
 Shifts the elements of a Q15 vector a specified number of bits.
 
void arm_shift_q31 (const q31_t *pSrc, int8_t shiftBits, q31_t *pDst, uint32_t blockSize)
 Shifts the elements of a Q31 vector a specified number of bits.
 
void arm_offset_f64 (const float64_t *pSrc, float64_t offset, float64_t *pDst, uint32_t blockSize)
 Adds a constant offset to a floating-point vector.
 
void arm_offset_f32 (const float32_t *pSrc, float32_t offset, float32_t *pDst, uint32_t blockSize)
 Adds a constant offset to a floating-point vector.
 
void arm_offset_q7 (const q7_t *pSrc, q7_t offset, q7_t *pDst, uint32_t blockSize)
 Adds a constant offset to a Q7 vector.
 
void arm_offset_q15 (const q15_t *pSrc, q15_t offset, q15_t *pDst, uint32_t blockSize)
 Adds a constant offset to a Q15 vector.
 
void arm_offset_q31 (const q31_t *pSrc, q31_t offset, q31_t *pDst, uint32_t blockSize)
 Adds a constant offset to a Q31 vector.
 
void arm_negate_f32 (const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
 Negates the elements of a floating-point vector.
 
void arm_negate_f64 (const float64_t *pSrc, float64_t *pDst, uint32_t blockSize)
 Negates the elements of a floating-point vector.
 
void arm_negate_q7 (const q7_t *pSrc, q7_t *pDst, uint32_t blockSize)
 Negates the elements of a Q7 vector.
 
void arm_negate_q15 (const q15_t *pSrc, q15_t *pDst, uint32_t blockSize)
 Negates the elements of a Q15 vector.
 
void arm_negate_q31 (const q31_t *pSrc, q31_t *pDst, uint32_t blockSize)
 Negates the elements of a Q31 vector.
 
void arm_and_u16 (const uint16_t *pSrcA, const uint16_t *pSrcB, uint16_t *pDst, uint32_t blockSize)
 Compute the logical bitwise AND of two fixed-point vectors.
 
void arm_and_u32 (const uint32_t *pSrcA, const uint32_t *pSrcB, uint32_t *pDst, uint32_t blockSize)
 Compute the logical bitwise AND of two fixed-point vectors.
 
void arm_and_u8 (const uint8_t *pSrcA, const uint8_t *pSrcB, uint8_t *pDst, uint32_t blockSize)
 Compute the logical bitwise AND of two fixed-point vectors.
 
void arm_or_u16 (const uint16_t *pSrcA, const uint16_t *pSrcB, uint16_t *pDst, uint32_t blockSize)
 Compute the logical bitwise OR of two fixed-point vectors.
 
void arm_or_u32 (const uint32_t *pSrcA, const uint32_t *pSrcB, uint32_t *pDst, uint32_t blockSize)
 Compute the logical bitwise OR of two fixed-point vectors.
 
void arm_or_u8 (const uint8_t *pSrcA, const uint8_t *pSrcB, uint8_t *pDst, uint32_t blockSize)
 Compute the logical bitwise OR of two fixed-point vectors.
 
void arm_not_u16 (const uint16_t *pSrc, uint16_t *pDst, uint32_t blockSize)
 Compute the logical bitwise NOT of a fixed-point vector.
 
void arm_not_u32 (const uint32_t *pSrc, uint32_t *pDst, uint32_t blockSize)
 Compute the logical bitwise NOT of a fixed-point vector.
 
void arm_not_u8 (const uint8_t *pSrc, uint8_t *pDst, uint32_t blockSize)
 Compute the logical bitwise NOT of a fixed-point vector.
 
void arm_xor_u16 (const uint16_t *pSrcA, const uint16_t *pSrcB, uint16_t *pDst, uint32_t blockSize)
 Compute the logical bitwise XOR of two fixed-point vectors.
 
void arm_xor_u32 (const uint32_t *pSrcA, const uint32_t *pSrcB, uint32_t *pDst, uint32_t blockSize)
 Compute the logical bitwise XOR of two fixed-point vectors.
 
void arm_xor_u8 (const uint8_t *pSrcA, const uint8_t *pSrcB, uint8_t *pDst, uint32_t blockSize)
 Compute the logical bitwise XOR of two fixed-point vectors.
 
void arm_clip_f32 (const float32_t *pSrc, float32_t *pDst, float32_t low, float32_t high, uint32_t numSamples)
 Elementwise floating-point clipping.
 
void arm_clip_q31 (const q31_t *pSrc, q31_t *pDst, q31_t low, q31_t high, uint32_t numSamples)
 Elementwise fixed-point clipping.
 
void arm_clip_q15 (const q15_t *pSrc, q15_t *pDst, q15_t low, q15_t high, uint32_t numSamples)
 Elementwise fixed-point clipping.
 
void arm_clip_q7 (const q7_t *pSrc, q7_t *pDst, q7_t low, q7_t high, uint32_t numSamples)
 Elementwise fixed-point clipping.
 
float32_t arm_sin_f32 (float32_t x)
 Fast approximation to the trigonometric sine function for floating-point data.
 
q31_t arm_sin_q31 (q31_t x)
 Fast approximation to the trigonometric sine function for Q31 data.
 
q15_t arm_sin_q15 (q15_t x)
 Fast approximation to the trigonometric sine function for Q15 data.
 
float32_t arm_cos_f32 (float32_t x)
 Fast approximation to the trigonometric cosine function for floating-point data.
 
q31_t arm_cos_q31 (q31_t x)
 Fast approximation to the trigonometric cosine function for Q31 data.
 
q15_t arm_cos_q15 (q15_t x)
 Fast approximation to the trigonometric cosine function for Q15 data.
 
void arm_vlog_f32 (const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
 Floating-point vector of log values.
 
void arm_vlog_f64 (const float64_t *pSrc, float64_t *pDst, uint32_t blockSize)
 Floating-point vector of log values.
 
void arm_vlog_q31 (const q31_t *pSrc, q31_t *pDst, uint32_t blockSize)
 q31 vector of log values.
 
void arm_vlog_q15 (const q15_t *pSrc, q15_t *pDst, uint32_t blockSize)
 q15 vector of log values.
 
void arm_vexp_f32 (const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
 Floating-point vector of exp values.
 
void arm_vexp_f64 (const float64_t *pSrc, float64_t *pDst, uint32_t blockSize)
 Floating-point vector of exp values.
 
arm_status arm_sqrt_f32 (const float32_t in, float32_t *pOut)
 Floating-point square root function.
 
arm_status arm_sqrt_q31 (q31_t in, q31_t *pOut)
 Q31 square root function.
 
arm_status arm_sqrt_q15 (q15_t in, q15_t *pOut)
 Q15 square root function.
 
arm_status arm_divide_q15 (q15_t numerator, q15_t denominator, q15_t *quotient, int16_t *shift)
 Fixed point division.
 
arm_status arm_divide_q31 (q31_t numerator, q31_t denominator, q31_t *quotient, int16_t *shift)
 Fixed point division.
 
arm_status arm_atan2_f32 (float32_t y, float32_t x, float32_t *result)
 Arc tangent in radian of y/x using sign of x and y to determine right quadrant.
 
arm_status arm_atan2_q31 (q31_t y, q31_t x, q31_t *result)
 Arc tangent in radian of y/x using sign of x and y to determine right quadrant.
 
arm_status arm_atan2_q15 (q15_t y, q15_t x, q15_t *result)
 Arc tangent in radian of y/x using sign of x and y to determine right quadrant.
 
template<typename MA, typename MB>
__STATIC_INLINE void _arm_mat_trans (const MA &src, MB &dst, const Scalar *=nullptr)
 Transposition for scalar architecture.
 
template<typename M, typename V, typename RES>
void _dot_m_v (RES &res, const TransposeView< M > &m, const V &v, const Scalar *=nullptr)
 Matrix times vector for scalar architecture.
 
template<typename MA, typename MB, typename RES, typename TMP, typename std::enable_if< number_traits< typename traits< MA >::Scalar >::is_fixed, bool >::type = true>
__STATIC_INLINE void _dot_m_m (const MA &pSrcA, const MB &pSrcB, RES &&pDst, const TMP &BT, const Scalar *=nullptr)
 Matrix times matrix for scalar architecture and fixed point.
 
template<typename MA, typename MB, typename RES, typename std::enable_if< is_float< MA >(), bool >::type = true>
__STATIC_INLINE void _dot_m_m (const MA &pSrcA, const MB &pSrcB, RES &&pDst, const Scalar *=nullptr)
 Matrix times matrix for scalar architecture and float.
 

Macro Definition Documentation

◆ FAST_MATH_FUNCTIONS_H_

#define FAST_MATH_FUNCTIONS_H_

// endgroup bufferSizeTypes

Function Documentation

◆ dot_transposed_unrolled()

template<typename RES, typename M, typename V>
void dot_transposed_unrolled ( RES & res,
const TransposeView< M > & m,
const V & v )
inline

Four-column fallback for a transposed matrix times vector product.

Template Parameters
RESResult vector type.
MOriginal matrix type.
VInput vector type.
Parameters
[out]resResult vector, with one element per original matrix column.
[in]mTransposed view of the original matrix.
[in]vInput vector, with one element per original matrix row.