CEDRIC  Revision_backup-2009-02
Functions
ublasTools Namespace Reference

Some utility function for vector and matrix calculation. More...

Functions

template<class ValueType >
bool affine_fit (const ublas::matrix< ValueType > &q_, const ublas::matrix< ValueType > &p, ublas::matrix< ValueType > &A, ublas::vector< ValueType > &b)
 Fit affine transformation such that $p_i\approx Aq_i + t$. More...
 
template<class ValueType >
ublas::vector< ValueType > column_means (ublas::matrix< ValueType > &A)
 Calculate column means of a matrix. More...
 
template<class ValueType >
ublas::vector< ValueType > row_means (ublas::matrix< ValueType > &A)
 Calculate row means of a matrix. More...
 
template<class ValueType >
ValueType grand_mean (const ublas::matrix< ValueType > &A)
 Calculate grand means of a matrix. More...
 
template<class ValueType >
void double_center (ublas::matrix< ValueType > &D)
 Double center matrix, i.e. substract column and row means and add in grand mean. More...
 
template<class ValueType >
void zero_eps (ublas::matrix< ValueType > &A, ValueType eps=1e-7)
 Eliminate all matrix entries smaller than some epsilon. More...
 
template<class ValueType >
void zero_eps (ublas::vector< ValueType > &v, ValueType eps=1e-7)
 Eliminate all vector entries smaller than some epsilon. More...
 

Detailed Description

Some utility function for vector and matrix calculation.

Function Documentation

template<class ValueType >
bool ublasTools::affine_fit ( const ublas::matrix< ValueType > &  q_,
const ublas::matrix< ValueType > &  p,
ublas::matrix< ValueType > &  A,
ublas::vector< ValueType > &  b 
)

Fit affine transformation such that $p_i\approx Aq_i + t$.

Parameters
qMatrix $q$ containing $m$ points $q_i$ of dimension $n$
pMatrix $p$ containing $m$ points $p_i$ of dimension $n$
[out]MatrixA
[out]Vectorb
Returns
false if LU decomposition fails

Implemented after Helmut Spaeth's paper "Fitting affine and orthogonal transformations between two set of points".

template<class ValueType >
ublas::vector<ValueType> ublasTools::column_means ( ublas::matrix< ValueType > &  A)

Calculate column means of a matrix.

Parameters
[in]A$n\times m$ matrix (also it is not const, A isn't changed!)
Returns
Vector of size m containing column means of A

Referenced by double_center().

template<class ValueType >
void ublasTools::double_center ( ublas::matrix< ValueType > &  D)

Double center matrix, i.e. substract column and row means and add in grand mean.

Parameters
[in,out]D$n\times m$ matrix, overwritten by double-centered $n\times m$ matrix

References column_means(), grand_mean(), and row_means().

Referenced by CMDS< ValueType >::CMDS().

template<class ValueType >
ValueType ublasTools::grand_mean ( const ublas::matrix< ValueType > &  A)

Calculate grand means of a matrix.

Parameters
[in]A$n\times m$ matrix (also it is not const, A isn't changed!)
Returns
grand mean of A, that is sum over all components $a_{ij}$ divided by $n*m$

Referenced by double_center().

template<class ValueType >
ublas::vector<ValueType> ublasTools::row_means ( ublas::matrix< ValueType > &  A)

Calculate row means of a matrix.

Parameters
[in]A$n\times m$ matrix (also it is not const, A isn't changed!)
Returns
Vector of size n containing row means of A

Referenced by double_center().

template<class ValueType >
void ublasTools::zero_eps ( ublas::matrix< ValueType > &  A,
ValueType  eps = 1e-7 
)

Eliminate all matrix entries smaller than some epsilon.

template<class ValueType >
void ublasTools::zero_eps ( ublas::vector< ValueType > &  v,
ValueType  eps = 1e-7 
)

Eliminate all vector entries smaller than some epsilon.