Prototypes for some rather simple vector and matrix operations. More...
Go to the source code of this file.
Functions | |
double | lwpr_math_norm2 (const double *x, int n) |
Computes the square norm of a vector of doubles. | |
double | lwpr_math_dot_product (const double *a, const double *b, int n) |
Computes the dot product between two vectors of doubles. | |
void | lwpr_math_scalar_vector (double *y, double a, const double *x, int n) |
Multiplies a vector by a scalar and stores the result in another vector. | |
void | lwpr_math_add_scalar_vector (double *y, double a, const double *x, int n) |
Multiplies a vector by a scalar and adds the result to another vector. | |
void | lwpr_math_scale_add_scalar_vector (double b, double *y, double a, const double *x, int n) |
Multiplies a vector by a scalar and adds the result to another vector, which is scaled before the addition. | |
int | lwpr_math_cholesky (int N, int Ns, double *R, const double *A) |
Computes the Cholesky decomposition of a matrix. |
Prototypes for some rather simple vector and matrix operations.
void lwpr_math_add_scalar_vector | ( | double * | y, | |
double | a, | |||
const double * | x, | |||
int | n | |||
) |
Multiplies a vector by a scalar and adds the result to another vector.
[in,out] | y | Output vector, must point to an array of n doubles |
[in] | a | Scalar multiplier |
[in] | x | Input vector, must point to an array of n doubles |
[in] | n | Length of the vectors |
Computes
Referenced by LWPR_ReceptiveFieldObject::slope().
int lwpr_math_cholesky | ( | int | N, | |
int | Ns, | |||
double * | R, | |||
const double * | A | |||
) |
Computes the Cholesky decomposition of a matrix.
[in] | N | Number of columns and rows of the matrix |
[in] | Ns | Stride parameter, i.e. offset between the first element of adjacent columns |
[in,out] | R | Upper triangular Cholesky factor. Also serves as input matrix if A==NULL |
[in] | A | Matrix to decompose. May be NULL, in which case the decomposition of R is done in place. |
Given a positive definite matrix A, this function computes an upper triangular matrix R such that
Since the decomposition is done in place, you can also call
lwpr_math_cholesky(n,n,R,NULL);
if you can afford to overwrite the original contents of the matrix.
double lwpr_math_dot_product | ( | const double * | a, | |
const double * | b, | |||
int | n | |||
) |
Computes the dot product between two vectors of doubles.
[in] | a | First input vector, must point to an array of n doubles |
[in] | b | Second input vector, must point to an array of n doubles |
[in] | n | Length of the vectors |
Referenced by LWPR_ReceptiveFieldObject::slope().
double lwpr_math_norm2 | ( | const double * | x, | |
int | n | |||
) |
Computes the square norm of a vector of doubles.
[in] | x | Input vector, must point to an array of n doubles |
[in] | n | Length of the vector |
void lwpr_math_scalar_vector | ( | double * | y, | |
double | a, | |||
const double * | x, | |||
int | n | |||
) |
Multiplies a vector by a scalar and stores the result in another vector.
[out] | y | Output vector, must point to an array of n doubles |
[in] | a | Scalar multiplier |
[in] | x | Input vector, must point to an array of n doubles |
[in] | n | Length of the vectors |
Computes
Referenced by LWPR_ReceptiveFieldObject::slope().
void lwpr_math_scale_add_scalar_vector | ( | double | b, | |
double * | y, | |||
double | a, | |||
const double * | x, | |||
int | n | |||
) |
Multiplies a vector by a scalar and adds the result to another vector, which is scaled before the addition.
[in] | b | Scalar multiplier for y before the addition |
[in,out] | y | Output vector, must point to an array of n doubles |
[in] | a | Scalar multiplier for x |
[in] | x | Input vector, must point to an array of n doubles |
[in] | n | Length of the vectors |
Computes