Functions
Vector Mathematics
Linear Algebra
Collaboration diagram for Vector Mathematics:

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)

Detailed Description

Vector math routines.


Function Documentation

void vector_add ( u32  n,
const double *  a,
const double *  b,
double *  c 
)

Add two vectors. Compute $ \vec{c} := \vec{a} + \vec{b} $, where $\vec{a}$, $\vec{b}$ and $\vec{c}$ are vectors of length $n$.

Parameters:
nLength of a, b and c
aFirst input vector
bSecond input vector
cOutput 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 $ \vec{c} := \vec{a} + \gamma\vec{b} $, where $\vec{a}$, $\vec{b}$ and $\vec{c}$ are vectors of length $n$ and $\gamma$ is a scalar.

Parameters:
nLength of a, b and c
aFirst input vector (unscaled)
bSecond input vector (will be scaled)
gammaCoefficient for b
cOutput 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 $ \vec{c} := \vec{a} * \times \vec{b} $, where $\vec{a}$, $\vec{b}$ and * $\vec{c}$ are 3-vectors.

Parameters:
nLength of a, b and c
aFirst input vector
bSecond input vector
cOutput 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 $ \vec{a} \cdot \vec{b} $, where $\vec{a}$ and $\vec{b}$ are vectors of length $n$.

Parameters:
nLength of a and b
aFirst vector
bSecond vector
Returns:
The dot product.

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 $\vec{a}$ of length $n$.

Parameters:
nLength of a
aInput vector
Returns:
The mean of $\vec{a}$

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 $l_{2}$ norm of a vector $\vec{a}$ of length $n$.

Parameters:
nLength of a
aInput vector
Returns:
The 2-norm of a

Definition at line 883 of file linear_algebra.c.

void vector_normalize ( u32  n,
double *  a 
)

Normalize a vector in place. Rescale $\vec{a}$ of length $n$ so that its $ l_{2} $ norm is equal to 1.

Parameters:
nLength of a
aVector 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 $ \vec{c} := \vec{a} - \vec{b} $, where $\vec{a}$, $\vec{b}$ and $\vec{c}$ are vectors of length $n$.

Parameters:
nLength of a, b and c
aFirst input vector
bSecond input vector
cOutput vector

Definition at line 963 of file linear_algebra.c.



enu
Author(s): Mike Purvis
autogenerated on Sun Oct 5 2014 23:44:54