Linear Algebra

Vector and Matrix classes, and helpers. More...


Classes

struct  Matrix< Rows, Cols, Precision, Layout >
 A matrix. More...
class  DiagonalMatrix< Size, Precision, Base >
 A diagonal matrix. More...
class  Vector< Size, Precision, Base >
 A vector. More...

Functions

template<int R, int C, typename Precision , typename Base >
Precision determinant_gaussian_elimination (const Matrix< R, C, Precision, Base > &A_)
template<int R, int C, class P , class B >
determinant_LU (const Matrix< R, C, P, B > &A)
template<int R, int C, class P , class B >
determinant (const Matrix< R, C, P, B > &A)
template<int Size, class Precision , class Base >
TOON_DEPRECATED void Fill (Vector< Size, Precision, Base > &v, const Precision &p)
template<int Rows, int Cols, class Precision , class Base >
TOON_DEPRECATED void Fill (Matrix< Rows, Cols, Precision, Base > &m, const Precision &p)
template<int Size, class Precision , class Base >
Precision norm (const Vector< Size, Precision, Base > &v)
template<int Size, class Precision , class Base >
Precision norm_sq (const Vector< Size, Precision, Base > &v)
template<int Size, class Precision , class Base >
Vector< Size, Precision > unit (const Vector< Size, Precision, Base > &v)
template<int Size, class Precision , class Base >
void normalize (Vector< Size, Precision, Base > &v)
template<int Size, typename Precision , typename Base >
Vector<(Size==Dynamic?Dynamic:Size-1),
Precision > 
project (const Vector< Size, Precision, Base > &v)
template<int Size, typename Precision , typename Base >
Vector<(Size==Dynamic?Dynamic:Size+1),
Precision > 
unproject (const Vector< Size, Precision, Base > &v)
template<int R, int C, typename P , typename B >
norm_fro (const Matrix< R, C, P, B > &m)
template<int R, int C, typename P , typename B >
norm_inf (const Matrix< R, C, P, B > &m)
template<int R, int C, typename P , typename B >
norm_1 (const Matrix< R, C, P, B > &m)
template<int R, int C, typename P , typename B >
Matrix< R, C, P > exp (const Matrix< R, C, P, B > &m)
template<int S, class P , class B >
bool isfinite (const Vector< S, P, B > &v)
template<int S, class P , class B >
bool isnan (const Vector< S, P, B > &v)
template<int Rows, int Cols, typename Precision , typename Base >
void Symmetrize (Matrix< Rows, Cols, Precision, Base > &m)
template<int Rows, int Cols, typename Precision , typename Base >
Precision trace (const Matrix< Rows, Cols, Precision, Base > &m)
template<int Size, class P , class B >
TooN::Matrix< 3, 3, P > cross_product_matrix (const Vector< Size, P, B > &vec)
template<int I>
Internal::StaticEndMarker< I > End ()
Internal::DynamicEndMarker End (int e)
template<int R, int C, class Precision , class Base >
Internal::MatrixStartFill< R,
C, Precision, Base > 
Fill (Matrix< R, C, Precision, Base > &m)
template<int Size, class Precision , class Base >
Internal::VectorStartFill
< Size, Precision, Base > 
Fill (Vector< Size, Precision, Base > &v)
Operator< Internal::Data< N,
double > > 
Data (double a,...)
template<typename Precision >
Operator< Internal::Data< N,
Precision > > 
Data (const Precision &a,...)

Variables

static const Operator
< Internal::Scalars
< Internal::One > > 
Ones
static Operator< Internal::Zero > Zeros
static Operator
< Internal::Identity
< Internal::One > > 
Identity
template<int Rows, int Cols>
Matrix< Rows, Cols, double,
Reference::RowMajor > 
wrapMatrix (double *data)
template<int Rows, int Cols>
const Matrix< Rows, Cols,
double, Reference::RowMajor > 
wrapMatrix (const double *data)
template<int Rows, int Cols, class Precision >
Matrix< Rows, Cols, Precision,
Reference::RowMajor > 
wrapMatrix (Precision *data)
template<int Rows, int Cols, class Precision >
const Matrix< Rows, Cols,
Precision, Reference::RowMajor > 
wrapMatrix (const Precision *data)
template<int Rows, int Cols>
Matrix< Rows, Cols, double,
Reference::RowMajor > 
wrapMatrix (double *data, int rows, int cols)
template<int Rows, int Cols>
const Matrix< Rows, Cols,
double, Reference::RowMajor > 
wrapMatrix (const double *data, int rows, int cols)
template<int Rows, int Cols, class Precision >
Matrix< Rows, Cols, Precision,
Reference::RowMajor > 
wrapMatrix (Precision *data, int rows, int cols)
template<int Rows, int Cols, class Precision >
const Matrix< Rows, Cols,
Precision, Reference::RowMajor > 
wrapMatrix (const Precision *data, int rows, int cols)


Detailed Description

Vector and Matrix classes, and helpers.


Function Documentation

Precision TooN::determinant_gaussian_elimination ( const Matrix< R, C, Precision, Base > &  A_  ) 

Compute the determinant using Gaussian elimination.

Parameters:
A_ The matrix to find the determinant of.
Returns:
determinant.

References TooN::determinant(), Matrix< Rows, Cols, Precision, Layout >::num_cols(), and Matrix< Rows, Cols, Precision, Layout >::num_rows().

Referenced by TooN::determinant().

P TooN::determinant_LU ( const Matrix< R, C, P, B > &  A  ) 

Compute the determinant using TooN::LU.

Parameters:
A The matrix to find the determinant of.
Returns:
determinant.

References Matrix< Rows, Cols, Precision, Layout >::num_cols(), and Matrix< Rows, Cols, Precision, Layout >::num_rows().

Referenced by TooN::determinant().

P TooN::determinant ( const Matrix< R, C, P, B > &  A  ) 

Compute the determinant of a matrix using an appropriate method.

The obvious method is used for 2x2, otherwise determinant_gaussian_elimination() or determinant_LU() is used depending on the value of TOON_DETERMINANT_LAPACK. See also Functions using LAPACK.

Parameters:
A The matrix to find the determinant of.
Returns:
determinant.

References TooN::determinant_gaussian_elimination(), TooN::determinant_LU(), Matrix< Rows, Cols, Precision, Layout >::num_cols(), and Matrix< Rows, Cols, Precision, Layout >::num_rows().

Referenced by TooN::determinant_gaussian_elimination().

TOON_DEPRECATED void TooN::Fill ( Vector< Size, Precision, Base > &  v,
const Precision &  p 
)

TOON_DEPRECATED void TooN::Fill ( Matrix< Rows, Cols, Precision, Base > &  m,
const Precision &  p 
)

Precision TooN::norm ( const Vector< Size, Precision, Base > &  v  ) 

Compute the $L_2$ norm of v.

Parameters:
v v

Referenced by DownhillSimplex< N, Precision >::finished().

Precision TooN::norm_sq ( const Vector< Size, Precision, Base > &  v  ) 

Compute the $L_2^2$ norm of v.

Parameters:
v v

Referenced by SO3< P >::SO3().

Vector<Size, Precision> TooN::unit ( const Vector< Size, Precision, Base > &  v  ) 

Compute a the unit vector $\hat{v}$.

Parameters:
v v

Referenced by SO3< P >::coerce(), SO2< P >::coerce(), SO3< Precision >::ln(), and SO3< P >::SO3().

void TooN::normalize ( Vector< Size, Precision, Base > &  v  ) 

Normalize a vector in place.

Parameters:
v Vector to normalize

Vector<(Size==Dynamic?Dynamic:Size-1), Precision> TooN::project ( const Vector< Size, Precision, Base > &  v  ) 

For a vector v of length i, return $[v_1, v_2, \cdots, v_{i-1}] / v_i $.

Parameters:
v v

References TooN::End(), and Vector< Size, Precision, Base >::size().

Vector<(Size==Dynamic?Dynamic:Size+1), Precision> TooN::unproject ( const Vector< Size, Precision, Base > &  v  ) 

For a vector v of length i, return $[v_1, v_2, \cdots, v_{i}, 1]$.

Parameters:
v v

References TooN::End(), and Vector< Size, Precision, Base >::size().

P TooN::norm_fro ( const Matrix< R, C, P, B > &  m  ) 

Frobenius (root of sum of squares) norm of input matrix m.

Parameters:
m m

References Matrix< Rows, Cols, Precision, Layout >::num_cols(), and Matrix< Rows, Cols, Precision, Layout >::num_rows().

P TooN::norm_inf ( const Matrix< R, C, P, B > &  m  ) 

L&#8734; (row sum) norm of input matrix m computes the maximum of the sums of absolute values over rows

References TooN::max(), Matrix< Rows, Cols, Precision, Layout >::num_cols(), and Matrix< Rows, Cols, Precision, Layout >::num_rows().

Referenced by TooN::exp().

P TooN::norm_1 ( const Matrix< R, C, P, B > &  m  ) 

L1 (col sum) norm of input matrix m computes the maximum of the sums of absolute values over columns

References TooN::max(), Matrix< Rows, Cols, Precision, Layout >::num_cols(), and Matrix< Rows, Cols, Precision, Layout >::num_rows().

Matrix<R, C, P> TooN::exp ( const Matrix< R, C, P, B > &  m  ) 

computes the matrix exponential of a matrix m by scaling m by 1/(powers of 2), using Taylor series and squaring again.

Parameters:
m input matrix, must be square
Returns:
result matrix of the same size/type as input

References TooN::max(), TooN::norm_inf(), Matrix< Rows, Cols, Precision, Layout >::num_cols(), and Matrix< Rows, Cols, Precision, Layout >::num_rows().

bool TooN::isfinite ( const Vector< S, P, B > &  v  ) 

Returns true if every element is finite.

References Vector< Size, Precision, Base >::size().

bool TooN::isnan ( const Vector< S, P, B > &  v  ) 

Returns true if any element is NaN.

References Vector< Size, Precision, Base >::size().

void TooN::Symmetrize ( Matrix< Rows, Cols, Precision, Base > &  m  ) 

Precision TooN::trace ( const Matrix< Rows, Cols, Precision, Base > &  m  ) 

TooN::Matrix<3, 3, P> TooN::cross_product_matrix ( const Vector< Size, P, B > &  vec  ) 

creates an returns a cross product matrix M from a 3 vector v, such that for all vectors w, the following holds: v ^ w = M * w

Parameters:
vec the 3 vector input
Returns:
the 3x3 matrix to set to the cross product matrix

References Vector< Size, Precision, Base >::size().

Internal::DynamicEndMarker End (  ) 

Used for slicing relative to the end, rather than with a known size.

For example:

           Vector<3> v = makeVector(6,5,4,3,2);
           v.slice<1,  End<0> >(); //5 4 3 2 
           v.slice<0, End<-1> >(); //6 5 4 3
See also ``What elementary operations are supported?''.

For example:

           Vector<> v = makeVector(6,5,4,3,2);
           v.slice(1, End); //5 4 3 2 
See also ``What elementary operations are supported?''.

Referenced by TooN::project(), and TooN::unproject().

Internal::DynamicEndMarker TooN::End ( int  e  ) 

Used for slicing relative to the end, rather than with a known size.

For example:

           Vector<> v = makeVector(6,5,4,3,2);
           v.slice(1, End(-1)); //5 4 3 
See also ``What elementary operations are supported?''.

Internal::MatrixStartFill<R, C, Precision, Base> TooN::Fill ( Matrix< R, C, Precision, Base > &  m  ) 

Set up a matrix for filling.

Uses the following syntax:

    Matrix<2,2> m;
    Fill(m) = 1, 2,
              3, 4;
Overfill is detected at compile time if possible, underfill is detected at run-time. The checks can not be optimized out for dynamic matrices, so define TOON_NDEBUG_FILL to prevent the checks from being used.
Parameters:
m Matrix to fill

Internal::VectorStartFill<Size, Precision, Base> TooN::Fill ( Vector< Size, Precision, Base > &  v  ) 

Set up a vector for filling.

Uses the following syntax:

    Vector<2> v;
    Fill(v) = 1, 2;
Overfill is detected at compile time if possible, underfill is detected at run-time. The checks can not be optimized out for dynamic vectors, so define TOON_NDEBUG_FILL to prevent the checks from being used.
Parameters:
v Vector to fill

Operator<Internal::Data<N, double> > TooN::Data ( double  a,
  ... 
)

Package up the function arguments as some data for filling matrices.

Matrices are filled in row major order. For example:

              double theta = 2;
              Matrix<2> rotation = data( cos(theta), sin(theta)
                                        -sin(theta), cos(theta));
See also TooN::wrapMatrix().
Parameters:
a The first data element.

Operator<Internal::Data<N, Precision> > TooN::Data ( const Precision &  a,
  ... 
)

Package up the function arguments as some data for filling matrices.

Any type can be uses. Matrices are filled in row-major order.

              Matrix<2,2,float> rotation = data(1f, 2f, 3f, 4f);
See also TooN::wrapMatrix().
Parameters:
a The first data element.

Matrix<Rows, Cols, double, Reference::RowMajor> TooN::wrapMatrix ( double *  data  ) 

Wrap external data as a Matrix As usual, if template sizes are provided, then the run-time size is only used if the template size is not Dynamic.


Variable Documentation

const Operator<Internal::Scalars<Internal::One> > Ones [static]

This function is used to add a scalar to every element of a vector or matrix.

For example:

   Vector<3> v;
   ...
   ...
   v += Ones * 3; //Add 3 to every element of v;
Both + and += are supported on vectors,matrices and slices.

For construction of dynamic vectors and matrices, a size needs to be given:

       Vector<3> v_static = Ones;    
       Vector<>  v_dynamic = Ones(3); //Construct a 3x1 vector full one 1s
       Matrix<3> m_static = Ones;     
       Matrix<>  m_dynamic = Ones(3,4); //Construct a 3x4 matrix

Referenced by TooN::unproject().

Operator<Internal::Zero> Zeros [static]

This function is used to initialize vectors and matrices to zero.

For construction of dynamic vectors and matrices, a size needs to be given. For example:

       Vector<3> v_static = Zeros;
       Vector<>  v_dynamic = Zeros(3); //Construct a 3x1 vector
       Matrix<3> m_static = Zeros;
       Matrix<>  m_dynamic = Zeros(3,4); //Construct a 3x4 matrix

Referenced by TooN::Internal::bracket_minimum_forward(), WLS< Size, Precision >::clear(), IRLS< Size, Precision, Reweight >::clear(), SL< N, Precision >::exp(), DownhillSimplex< N, Precision >::find_next_point(), SO3< P >::generator(), SL< N, Precision >::generator(), SE2< P >::generator(), and SE3< P >::generator_field().

Operator<Internal::Identity<Internal::One> > Identity [static]

This function is used to add a scalar to the diagonal of a matrix, or to construct matrices.

For example:

   Matrix<3> v;
   ...
   ...
   Matrix<3> u = v  + Identity * 4;
Both + and += are supported. For assignment, if the matrix is non-square, then all elements off the leading diagonal are set to zero. For construction of dynamic matrices, a size needs to be given:
       Matrix<3> m_static = Identity;     
       Matrix<>  m_dynamic = Identity(3); //Construct a 3x3 matrix

Referenced by Cholesky< Size, Precision >::get_inverse(), and SO3< P >::SO3().


Generated on Tue Oct 27 16:08:51 2009 for TooN by  doxygen 1.5.9