Documentation
Tools for embedded systems
|
Floating-point vector(1D-Array) operations. More...
Data Structures | |
struct | qVFloat_Moment_t |
Metrics returned by qVFloat_Moment() More... | |
struct | qVFloat_MinMax_t |
Metrics returned by qVFloat_MinMax() More... | |
Enumerations | |
enum | qVFloat_Operation_t { VFLOAT_ADD , VFLOAT_MUL , VFLOAT_DIV } |
Supported operators on vectors. More... | |
Functions | |
float | qVFloat_Operate (float *const dst, qVFloat_Operation_t o, const float a, const float *const x, const float b, const float *const y, const size_t n) |
Computes one of the following 1D-vector operation : | |
float | qVFloat_ApplyFx (float *dst, float(*fx1)(float), float(*fx2)(float, float), float *const x, float *const y, const float a, const float b, const size_t n) |
Apply one the supplied function ( fx1 or fx2 ) to the input vector(s). | |
int | qVFloat_Moment (qVFloat_Moment_t *const m, const float *const x, const size_t n) |
Computes the moment of a distribution for a given set of data including : Mean, Variance, Average deviation, standard deviation, skewness and kurtosis. | |
float * | qVFloat_Set (float *const x, const float c, const size_t n) |
Set the value given on c to all the elements of the vector pointed by x. | |
float * | qVFloat_Copy (float *const dst, const float *const src, const size_t n) |
Copies all the values on vector pointed by src to the vector pointed by dst. | |
float | qVFloat_PolyVal (const float *const p, const float x, size_t n) |
Takes the input vector p as a polynomial p and evaluates it for x. The argument p is a vector of length n+1 whose elements are the coefficients (in descending powers) of an nth-degree polynomial. | |
float * | qVFloat_LinSpace (float *const dst, const float x1, const float x2, const size_t n) |
Generate linearly spaced vector of points. The spacing between the points is (x2-x1)/(n-1) | |
float | qVFloat_Distance (const float *const x, const float *const y, const size_t n) |
Returns the Euclidean distance between vectors x and y. | |
float * | qVFloat_Reverse (float *const dst, float *const src, const size_t init, const size_t end) |
Reverse the given vector pointed by src. Operation takes place on the portion of the vector that starts at position init to position end. | |
float * | qVFloat_Rotate (float *const dst, float *const src, const int k, const size_t n) |
Rotates the elements of vector pointed by src the number of places and in the direction indicated by k. | |
int | qVFloat_MinMax (qVFloat_MinMax_t *const o, const float *const x, const size_t n) |
Find the smallest and largest elements of vector pointed by x. | |
float * | qVFloat_Sort (float *const dst, float *const src, const bool dir, size_t n) |
Returns a sorted version of unsorted vector pointed by src with the elements arranged in ascending or descending order according the value or dir. | |
Floating-point vector(1D-Array) operations.
enum qVFloat_Operation_t |
float qVFloat_ApplyFx | ( | float * | dst, |
float(* | fx1 )(float), | ||
float(* | fx2 )(float, float), | ||
float *const | x, | ||
float *const | y, | ||
const float | a, | ||
const float | b, | ||
const size_t | n ) |
Apply one the supplied function ( fx1 or fx2 ) to the input vector(s).
dst = a*fx1( x )
if fx2 is NULL
dst = a*fx2( x, y )
if fx1 is NULL
dst = a*fx2( x, b )
if fx1 and y are NULL
[out] | dst | The pointer to the destination vector where the result will be stored. To ignore pass NULL as argument. |
[in] | fx1 | Function that will be applied to each element of x. This function should take one parameter following this signature: float fx1( float p );
NULL as argument. |
[in] | fx2 | Function that will be applied to each element of x. This function should take 2 parameters following this signature: float fx1( float p1, float p2 );
NULL as argument. |
[in] | x | A vector as an 1D float array |
[in] | y | A vector as an 1D float array. To ignore pass NULL as argument. |
[in] | a | A value to scale the result of fx1 and fx2. |
[in] | b | An scalar value used as second argument on fx2 if y is ignored. |
[in] | n | The number of elements of vectors x and y |
float * qVFloat_Copy | ( | float *const | dst, |
const float *const | src, | ||
const size_t | n ) |
Copies all the values on vector pointed by src to the vector pointed by dst.
[in] | dst | Pointer to the destination vector |
[in] | src | Pointer to the source vector |
[in] | n | Number of elements of the vector |
float qVFloat_Distance | ( | const float *const | x, |
const float *const | y, | ||
const size_t | n ) |
Returns the Euclidean distance between vectors x and y.
[in] | x | Pointer to the input vector. |
[in] | y | Pointer to the input vector |
[in] | n | Number of elements of the vector |
float * qVFloat_LinSpace | ( | float *const | dst, |
const float | x1, | ||
const float | x2, | ||
const size_t | n ) |
Generate linearly spaced vector of
points. The spacing between the points is (x2-x1)/(n-1)
[out] | dst | The pointer to the destination vector where the result will be stored. |
[in] | x1 | Point interval |
[in] | x2 | Point interval |
[in] | n | Number of points |
int qVFloat_MinMax | ( | qVFloat_MinMax_t *const | o, |
const float *const | x, | ||
const size_t | n ) |
Find the smallest and largest elements of vector pointed by x.
[out] | o | The pointer where the outcome of this function will be stored |
[in] | x | The input vector to. |
[in] | n | Number of places to rotate |
int qVFloat_Moment | ( | qVFloat_Moment_t *const | m, |
const float *const | x, | ||
const size_t | n ) |
Computes the moment of a distribution for a given set of data including : Mean, Variance, Average deviation, standard deviation, skewness and kurtosis.
[out] | m | A structure of type qVFloat_Moment_t where the metrics will be stored. |
[in] | x | A vector of data as an 1D float array |
[in] | n | The number of elements of vectors x and y |
float qVFloat_Operate | ( | float *const | dst, |
qVFloat_Operation_t | o, | ||
const float | a, | ||
const float *const | x, | ||
const float | b, | ||
const float *const | y, | ||
const size_t | n ) |
Computes one of the following 1D-vector operation :
dst = a*x [o] b*y
if both x and y are supplied.dst = a*x [o] b
if the y argument is NULL
.Here, [o]
corresponds to the operator that will be applied
[out] | dst | The pointer to the destination array where the result will be stored. To ignore pass NULL as argument. |
[in] | o | The desired operator, should be one of the following:
|
[in] | a | Value to scale the vector x. |
[in] | x | A vector as an 1D float array |
[in] | b | Value to scale the vector y. |
[in] | y | A vector as an 1D float array. To ignore pass NULL as argument. |
[in] | n | The number of elements of vector x and y |
float qVFloat_PolyVal | ( | const float *const | p, |
const float | x, | ||
size_t | n ) |
Takes the input vector p as a polynomial p and evaluates it for x. The argument p is a vector of length n+1 whose elements are the coefficients (in descending powers) of an nth-degree polynomial.
[in] | p | The polynomial coefficients, specified as a vector. |
[in] | x | Value to evaluate the polynomial |
[in] | n | Number of coefficients on polynomial p |
float * qVFloat_Reverse | ( | float *const | dst, |
float *const | src, | ||
const size_t | init, | ||
const size_t | end ) |
Reverse the given vector pointed by src. Operation takes place on the portion of the vector that starts at position init to position end.
[out] | dst | The pointer to the destination vector where the result will be stored. To ignore pass NULL as argument. |
[in,out] | src | The input vector to reverse. |
[in] | init | Position of the first element. |
[in] | end | Position of the last element. |
float * qVFloat_Rotate | ( | float *const | dst, |
float *const | src, | ||
const int | k, | ||
const size_t | n ) |
Rotates the elements of vector pointed by src the number of places and in the direction indicated by k.
[out] | dst | The pointer to the destination vector where the result will be stored. To ignore pass NULL as argument. |
[in,out] | src | The input vector to rotate. |
[in] | k | Position of the first element. |
[in] | n | Number of elements of the vector |
float * qVFloat_Set | ( | float *const | x, |
const float | c, | ||
const size_t | n ) |
Set the value given on c to all the elements of the vector pointed by x.
[in] | x | A pointer to the input vector |
[in] | c | The value to set |
[in] | n | Number of elements of the vector |
float * qVFloat_Sort | ( | float *const | dst, |
float *const | src, | ||
const bool | dir, | ||
size_t | n ) |
Returns a sorted version of unsorted vector pointed by src with the elements arranged in ascending or descending order according the value or dir.
[out] | dst | The pointer to the destination vector where the result will be stored. To ignore pass NULL as argument. |
[in,out] | src | The input vector to rotate. |
[in] | dir | Pass false to sort in ascending order, otherwise pass true. |
[in] | n | Number of elements of the vector |