Mathematic Functions (Please notice the detailed description!)
[Operations for Arrays (Please notice the detailed description!)]


Functions

Array< T > & Array::transpose ()
 Returns the transposition of the current array.
template<class T >
Array< T > innerProduct (const Array< T > &v, const Array< T > &w)
 Returns the inner product of the two arrays "v" and "w".
template<class T >
Array< T > outerProduct (const Array< T > &v, const Array< T > &w)
 Returns the outer product of the two arrays "v" and "w".
template<class T >
scalarProduct (const Array< T > &v, const Array< T > &w)
 Returns the scalar product of the two arrays "v" and "w".
template<class T >
sqrDistance (const Array< T > &v, const Array< T > &w)
 Returns the square distance between the two arrays "v" and "w".
template<class T >
euclidianDistance (const Array< T > &v, const Array< T > &w)
 Returns the euclidian distance between the two arrays "v" and "w".
template<class T >
sum (const Array< T > &v)
 Returns the sum of all values in array "v".
template<class T >
sumOfAbs (const Array< T > &v)
 Returns the sum of all absolute values in array "v".
template<class T >
sumOfSqr (const Array< T > &v)
 Returns the sum of all square values in array "v".
template<class T >
product (const Array< T > &v)
 Returns the product of all values in array "v".

Detailed Description

The methods listed here are not complete. Most of the defined operators in file ArrayOp.h are removed from the reference, because the special way of defining these operators causes doxygen to create a corrupted reference. A list of these operators can be found in the detailed description of ArrayOp.h.

Function Documentation

template<class T >
T euclidianDistance ( const Array< T > &  v,
const Array< T > &  w 
) [inline]

Returns the euclidian distance between the two arrays "v" and "w".

The euclidian distance $d$ is evaluated as

$ d = \sqrt{\sum_{i=0}^{N-1} {(v_i - w_i)}^2} $

where $N$ is the total number of elements in each array and the single elements are taken in the order as they are stored in the element vector Array::e.
Notice, that the two arrays must have the same number of elements.

Parameters:
v the first array.
w the second array.
Returns:
the euclidian distance $d$
Exceptions:
check_exception the type of the exception will be "size mismatch" and indicates that the two arrays v and w have different sizes
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 859 of file ArrayOp.h.

References sqrDistance().

template<class T >
Array< T > innerProduct ( const Array< T > &  v,
const Array< T > &  w 
) [inline]

Returns the inner product of the two arrays "v" and "w".

The inner product, also known as the scalar product of two vectors $x$ and $y$ with dimension $n$ is a scalar value $\alpha$ given as

$ \alpha = x^T \cdot y = \sum_{i=1}^n x_i \cdot y_i $

You can also use this method for vectors as one-dimensional arrays, but this method is a generalization of the scalar product and is especially written for N-dimensional arrays with $N \geq 2$.
Therefore the method will always return an array of scalar values. If you want to calculate the "original" scalar product for two vectors, it is more handy to use the method scalarProduct, because this method will return a single scalar value.
If you use arrays that represent two matrices $A$ with dimensions $m_1 \times \dots \times m_k$ and $B$ with dimensions $n_1 \times \dots \times n_l$ with $l, k \geq 2$ and $m_k = n_1$ then the result is a matrix $C$ with dimensions $m_1 \times \dots \times m_{k-1} \times n_2 \times \dots \times n_l$. Each scalar value of $C$ is calculated by multiplying each "row" of matrix $A$ with each column of matrix $B$, where "row" means always the first dimension of a matrix and "column" the last dimension. The multiplication results are then added together.

Parameters:
v the first array.
w the second array.
Returns:
an array containing the inner product of v and w
Exceptions:
check_exception the type of the exception will be "size mismatch" and means that you've called the method with two one-dimensional arrays, but these vectors have different sizes
Author:
M. Kreutz
Date:
1995
Changes
2002-03-21, ra: Method crashed, when two one-dimensional arrays were used. Now the method "scalarProduct" is called in this case and the result is casted into an array.
Status
stable

Definition at line 575 of file ArrayOp.h.

References ArrayBase::dim(), Array< T >::elem(), ArrayBase::ndim(), ArrayBase::nelem(), ArrayBase::resize(), and scalarProduct().

template<class T >
Array< T > outerProduct ( const Array< T > &  v,
const Array< T > &  w 
) [inline]

Returns the outer product of the two arrays "v" and "w".

The outer product, also known as the dyadic product of a vector $x$ with dimension $m$ and a vector $y$ with dimension $n$ is a matrix $A$ given as

$ A = x \cdot y^T $

where $A$ is a $m \times n$ matrix with $a_{ij} = x_i \cdot y_j$ for $i = 1, \dots, m$ and $j = 1, \dots, n$.
This method is a generalization, it works not only for vectors as one-dimensional arrays, but also for N-dimensional arrays with $N \geq 2$.
Given two matrices $A$ with dimensions $m_1 \times \dots \times m_k$ and $B$ with dimensions $n_1 \times \dots \times n_l$ the result is an matrix $C$ with dimensions $m_1 \times \dots \times m_k \times n_1 \times \dots \times n_l$, where $c_{i_1 \dots i_k i_{k+1} \dots i_{k+l}} = a_{i_1 \dots i_k} \cdot b_{i_{k+1} \dots i_{k+l}}$ for $i_1 = 1, \dots, m_1\mbox{;\ } \dots \mbox{;\ }i_k = 1, \dots, m_k\mbox{;\ }i_{k+1} = 1, \dots, n_1\mbox{;\ } \dots \mbox{;\ }i_{k+l} = 1, \dots, n_l$

Parameters:
v the first array.
w the second array.
Returns:
an array containing the outer product of v and w
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 677 of file ArrayOp.h.

References ArrayBase::dim(), Array< T >::elem(), ArrayBase::ndim(), ArrayBase::nelem(), and ArrayBase::resize().

template<class T >
T product ( const Array< T > &  v  )  [inline]

Returns the product of all values in array "v".

The product is evaluated as

$ t = \prod_{i=0}^{N-1} v_i $

where $N$ is the total number of values in the array and the single values are taken in the order as they are stored in the element vector Array::e.

Parameters:
v the array of which the product will be calculated
Returns:
the product $t$
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 1004 of file ArrayOp.h.

References Array< T >::elem(), and ArrayBase::nelem().

template<class T >
T scalarProduct ( const Array< T > &  v,
const Array< T > &  w 
) [inline]

Returns the scalar product of the two arrays "v" and "w".

The scalar product, also known as the inner product of two vectors $x$ and $y$ with dimension $n$ is a scalar value $\alpha$ given as

$ \alpha = x^T \cdot y = \sum_{i=1}^n x_i \cdot y_i $

Here, the two arrays v and w are interpreted as one-dimensional arrays, by using the element vectors Array::e of both. So you can use this method for two N-dimensional arrays with $N \geq 2$, but will always receive a single scalar value.
If you want to calculate the inner product for those arrays with respect to the number of dimensions, use method innerProduct.

Parameters:
v the first array.
w the second array.
Returns:
the scalar product $\alpha$ of the element vectors of the two arrays
Exceptions:
check_exception the type of the exception will be "size mismatch" and means that the two vectors have different sizes
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 767 of file ArrayOp.h.

References Array< T >::elem(), ArrayBase::nelem(), and ArrayBase::samedim().

Referenced by innerProduct().

template<class T >
T sqrDistance ( const Array< T > &  v,
const Array< T > &  w 
) [inline]

Returns the square distance between the two arrays "v" and "w".

The square distance $d$ is evaluated as

$ d = \sum_{i=0}^{N-1} {(v_i - w_i)}^2 $

where $N$ is the total number of elements in each array and the single elements are taken in the order as they are stored in the element vector Array::e.
Notice, that the two arrays must have the same number of elements.

Parameters:
v the first array.
w the second array.
Returns:
the square distance $d$
Exceptions:
check_exception the type of the exception will be "size mismatch" and indicates that the two arrays v and w have different sizes
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 811 of file ArrayOp.h.

References Array< T >::elem(), ArrayBase::nelem(), and ArrayBase::samedim().

Referenced by euclidianDistance().

template<class T >
T sum ( const Array< T > &  v  )  [inline]

Returns the sum of all values in array "v".

The sum is evaluated as

$ t = \sum_{i=0}^{N-1} v_i $

where $N$ is the total number of values in the array and the single values are taken in the order as they are stored in the element vector Array::e.

Parameters:
v the array of which the sum will be calculated
Returns:
the sum $t$
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 894 of file ArrayOp.h.

References Array< T >::elem(), and ArrayBase::nelem().

template<class T >
T sumOfAbs ( const Array< T > &  v  )  [inline]

Returns the sum of all absolute values in array "v".

The sum is evaluated as

$ t = \sum_{i=0}^{N-1} |v_i| $

where $N$ is the total number of values in the array and the single values are taken in the order as they are stored in the element vector Array::e.

Parameters:
v the array of which the sum will be calculated
Returns:
the sum $t$
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 930 of file ArrayOp.h.

References Array< T >::elem(), and ArrayBase::nelem().

template<class T >
T sumOfSqr ( const Array< T > &  v  )  [inline]

Returns the sum of all square values in array "v".

The sum is evaluated as

$ t = \sum_{i=0}^{N-1} v_i^2 $

where $N$ is the total number of values in the array and the single values are taken in the order as they are stored in the element vector Array::e.

Parameters:
v the array of which the sum will be calculated
Returns:
the sum $t$
Author:
M. Kreutz
Date:
1995
Changes
none
Status
stable

Definition at line 967 of file ArrayOp.h.

References Array< T >::elem(), and ArrayBase::nelem().

template<class T >
Array< T >& Array< T >::transpose (  )  [inline, inherited]

Returns the transposition of the current array.

See the current array as matrix $A$, then the transposed matrix $A^T$ is returned.

Returns:
the transposed array
Example
Given an array with the content
$ \left(\begin{array}{lll} 1 & 2 & 3\\ 4 & 5 & 6\\ \end{array}\right) $

then the transposed array will be

$ \left(\begin{array}{ll} 1 & 4\\ 2 & 5\\ 3 & 6 \end{array}\right) $

Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Definition at line 3929 of file Array.h.