Functions | |
void | vector_add (u32 n, const double *a, const double *b, double *c) |
void | vector_add_sc (u32 n, const double *a, const double *b, double gamma, double *c) |
void | vector_cross (const double a[3], const double b[3], double c[3]) |
double | vector_dot (u32 n, const double *a, const double *b) |
double | vector_mean (u32 n, const double *a) |
double | vector_norm (u32 n, const double *a) |
void | vector_normalize (u32 n, double *a) |
void | vector_subtract (u32 n, const double *a, const double *b, double *c) |
Vector math routines.
void vector_add | ( | u32 | n, |
const double * | a, | ||
const double * | b, | ||
double * | c | ||
) |
Add two vectors. Compute , where , and are vectors of length .
n | Length of a, b and c |
a | First input vector |
b | Second input vector |
c | Output vector |
Definition at line 949 of file linear_algebra.c.
void vector_add_sc | ( | u32 | n, |
const double * | a, | ||
const double * | b, | ||
double | gamma, | ||
double * | c | ||
) |
Add a vector with a scaled vector. Compute , where , and are vectors of length and is a scalar.
n | Length of a, b and c |
a | First input vector (unscaled) |
b | Second input vector (will be scaled) |
gamma | Coefficient for b |
c | Output vector |
Definition at line 932 of file linear_algebra.c.
void vector_cross | ( | const double | a[3], |
const double | b[3], | ||
double | c[3] | ||
) |
Cross product of two vectors. Compute , where , and * are 3-vectors.
n | Length of a, b and c |
a | First input vector |
b | Second input vector |
c | Output vector |
Definition at line 977 of file linear_algebra.c.
double vector_dot | ( | u32 | n, |
const double * | a, | ||
const double * | b | ||
) |
Dot product between two vectors. Compute the inner (scalar) (dot) product , where and are vectors of length .
n | Length of a and b |
a | First vector |
b | Second vector |
Definition at line 865 of file linear_algebra.c.
double vector_mean | ( | u32 | n, |
const double * | a | ||
) |
Find the mean of a vector. Compute the mean of a vector of length .
n | Length of a |
a | Input vector |
Definition at line 899 of file linear_algebra.c.
double vector_norm | ( | u32 | n, |
const double * | a | ||
) |
Find the 2-norm of a vector. Compute the norm of a vector of length .
n | Length of a |
a | Input vector |
Definition at line 883 of file linear_algebra.c.
void vector_normalize | ( | u32 | n, |
double * | a | ||
) |
Normalize a vector in place. Rescale of length so that its norm is equal to 1.
n | Length of a |
a | Vector to normalize |
Definition at line 914 of file linear_algebra.c.
void vector_subtract | ( | u32 | n, |
const double * | a, | ||
const double * | b, | ||
double * | c | ||
) |
Subtract one vector from another. Compute , where , and are vectors of length .
n | Length of a, b and c |
a | First input vector |
b | Second input vector |
c | Output vector |
Definition at line 963 of file linear_algebra.c.