matrix module  1.00.00
www.protokollkonverter.de
vector operations

Functions

VECTOR vectorNew (const size_t dimension)
 create a new column vector More...
 
void vectorDelete (VECTOR *v)
 free memory allocated by vectorNew More...
 
bool vectorGetDimension (VECTOR v, size_t *dimension)
 get dimension of vector More...
 
bool vectorEquals (VECTOR v, VECTOR w)
 compare two vectors More...
 
bool vectorSetElement (VECTOR v, const size_t row, MATRIX_VALUE value)
 set one element in vector More...
 
bool vectorGetElement (VECTOR v, const size_t row, MATRIX_VALUE *value)
 get one element in vector More...
 
bool vectorSet (VECTOR v, const MATRIX_VALUE values[], const size_t valuesCount)
 set all values of vector More...
 
bool vectorGet (VECTOR v, MATRIX_VALUE values[], size_t *valuesCount)
 get all values of vector More...
 
VECTOR vectorAddition (VECTOR v, VECTOR w)
 add two vectors More...
 
VECTOR vectorSubstraction (VECTOR v, VECTOR w)
 subtract a vector More...
 
VECTOR vectorMultiplicationScalar (VECTOR v, MATRIX_VALUE scalar)
 multiply a vector with scalar More...
 
bool vectorDotProduct (VECTOR v, VECTOR w, MATRIX_VALUE *product)
 dot product of two vectors More...
 
VECTOR vectorCrossProduct (VECTOR v, VECTOR w)
 cross product of two vectors More...
 
bool vectorScalarTripleProduct (VECTOR v, VECTOR w, VECTOR x, MATRIX_VALUE *product)
 scalar triple product of three vectors More...
 
MATRIX vectorOuterProduct (VECTOR v, VECTOR w)
 outer product of two vectors More...
 
bool vectorLength (VECTOR v, MATRIX_VALUE *length)
 calculate length of vector More...
 
VECTOR vectorClone (VECTOR v)
 clone a vector More...
 

Variables

static const size_t index_a [VECTOR_STANDARD_DIMENSION] = {1, 2, 0}
 
static const size_t index_b [VECTOR_STANDARD_DIMENSION] = {2, 0, 1}
 

Detailed Description

Function Documentation

VECTOR vectorNew ( const size_t  dimension)

create a new column vector

Function allocates memory for a new vector of given dimension. All elements are set to 0.

See also
vectorDelete
Parameters
[in]dimensionrows of vector to create
Returns
new vector
NULL on memory allocation error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void vectorDelete ( VECTOR v)

free memory allocated by vectorNew

Function frees memory of vector created by vectorNew. The vector pointer v will be set to NULL.

Parameters
[in,out]vpointer to vector do delete
Examples:
testMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool vectorGetDimension ( VECTOR  v,
size_t *  dimension 
)

get dimension of vector

Function sets dimension of vector in parameter dimension.

Parameters
[out]dimensionaddress of variable dimension to insert count of rows of vector
Returns
true on success
false on parameter error (v is NULL)
Examples:
testMatrix.cpp.

Here is the call graph for this function:

bool vectorEquals ( VECTOR  v,
VECTOR  w 
)

compare two vectors

Function compares dimensions and values of two vectors.

Parameters
[in]vvector 1 to compare
[in]wvector 2 to compare
Returns
true if vectors are equal
false vectors are different or parameter error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

bool vectorSetElement ( VECTOR  v,
const size_t  row,
MATRIX_VALUE  value 
)

set one element in vector

Function sets the value of one element in vector. Rows are count from 0..(dimension of vector - 1).

Parameters
[in]vvector to set value in
[in]rowrow of element
[in]valuevalue to set to element
Returns
true on success
false on parameter error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool vectorGetElement ( VECTOR  v,
const size_t  row,
MATRIX_VALUE value 
)

get one element in vector

Function gets the value of one element in vector. Rows are count from 0..(dimension of vector - 1).

Parameters
[in]vvector to get value from
[in]rowrow of element
[out]valuepointer to value to set value to element in
Returns
true on success
false on parameter error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool vectorSet ( VECTOR  v,
const MATRIX_VALUE  values[],
const size_t  valuesCount 
)

set all values of vector

Function sets all values of vectors.

Note
valuesCount must be equal to rows of rows.
Parameters
[in]vvector to set values in
[in]valuesvalues to set to element
[in]valuesCountcount of values in array
Returns
true on success
false on parameter error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

bool vectorGet ( VECTOR  v,
MATRIX_VALUE  values[],
size_t *  valuesCount 
)

get all values of vector

Function gets all values of vectors.

Note
valuesCount must be greater or equal to rows of rows.
Parameters
[in]vvector to get values from
[out]valuespointer to values to set values in
[in,out]valuesCountcount of values in array
contains afterwards count of copied values
Returns
true on success
false on parameter error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

VECTOR vectorAddition ( VECTOR  v,
VECTOR  w 
)

add two vectors

Function adds two vectors.

Note
The vectors must be from the same dimension \(\vec y = \vec v + \vec w\).
Parameters
[in]vvector 1 to add
[in]wvector 2 to add
Returns
new vector with added values
NULL on parameter or memory allocation error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

VECTOR vectorSubstraction ( VECTOR  v,
VECTOR  w 
)

subtract a vector

Function subtract a vector from another vector \(\vec y = \vec v - \vec w\).

Note
The vectors must be from the same dimension.
Parameters
[in]vvector to subtract from
[in]wvector to subtract
Returns
new vector with subtracted values
NULL on parameter or memory allocation error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

VECTOR vectorMultiplicationScalar ( VECTOR  v,
MATRIX_VALUE  scalar 
)

multiply a vector with scalar

Function multiplies a vector with scalar value \(\vec y = \vec v * scalar\).

Parameters
[in]vvector to multiply
[in]scalarvalue to multiply vector with
Returns
new vector with multiplied values
NULL on parameter or memory allocation error

Here is the call graph for this function:

bool vectorDotProduct ( VECTOR  v,
VECTOR  w,
MATRIX_VALUE product 
)

dot product of two vectors

Function multiplies two vectors to get dot product as scalar \(product = \vec v \cdot \vec w\).

Note
The vectors must be from the same dimension.
Parameters
[in]vvector to multiply
[in]wvector to multiply
[out]productresult value of dot multiplication
Returns
true on success
false on parameter error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

VECTOR vectorCrossProduct ( VECTOR  v,
VECTOR  w 
)

cross product of two vectors

Function multiplies two vectors to get cross product vector \(\vec y = \vec v \times \vec w \).

Note
Both vectors must be from the dimension VECTOR_STANDARD_DIMENSION.
Parameters
[in]vvector to multiply
[in]wvector to multiply
Returns
new vector with multiplied values
NULL on parameter or memory allocation error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool vectorScalarTripleProduct ( VECTOR  v,
VECTOR  w,
VECTOR  x,
MATRIX_VALUE product 
)

scalar triple product of three vectors

Function multiplies three vectors to get the scalar triple product \(product = (\vec v \times \vec w) \cdot \vec x \).

Note
Both vectors must be from the dimension VECTOR_STANDARD_DIMENSION.
The vectors must be from the same dimension.
Parameters
[in]vvector to multiply
[in]wvector to multiply
[in]xvector to multiply
[out]productresult value of multiplication
Returns
true on success
false on parameter error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

MATRIX vectorOuterProduct ( VECTOR  v,
VECTOR  w 
)

outer product of two vectors

Function multiplies two vectors to get outer product matrix \(A = \vec v \otimes \vec w \).

Parameters
[in]vvector to multiply
[in]wvector to multiply
Returns
new matrix with multiplied values
NULL on parameter or memory allocation error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

bool vectorLength ( VECTOR  v,
MATRIX_VALUE length 
)

calculate length of vector

Function calculates length of vector by \(\sqrt{a_{0}^{2} + a_{1}^{2} + ... + a_{(rows-1)}^{2}}\)

Parameters
[in]vvector to multiply
[in]wvector to multiply
Returns
new matrix with multiplied values
NULL on parameter or memory allocation error
Examples:
testMatrix.cpp.

Here is the call graph for this function:

VECTOR vectorClone ( VECTOR  v)

clone a vector

Function clones a vector.

Note
The vectors must be from the same dimension.

Function creates a new vector with the same dimension and values like given vector.

Parameters
[in]vvector to clone
Returns
new vector like v
NULL on parameter or memory allocation error

Here is the call graph for this function:

Variable Documentation

const size_t index_a[VECTOR_STANDARD_DIMENSION] = {1, 2, 0}
static
const size_t index_b[VECTOR_STANDARD_DIMENSION] = {2, 0, 1}
static