LTL  2.0.x
Public Types | Public Member Functions | Protected Attributes | Friends | Related Functions | List of all members
ltl::FMatrix< T, M, N > Class Template Reference

Matrix with dimensions known at compile time. More...

Public Types

enum  { static_size = 1 }
 Used by expression engine to decide which loops to unroll. More...
 
typedef T value_type
 STL-compatible type definitions. More...
 
typedef FMIter< T, M, N > iterator
 
typedef FMIterConst< T, M, N > const_iterator
 
typedef T & reference
 
typedef const T & const_reference
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 
typedef FVector< T, M, N > ColumnVector
 
typedef FVector< T, N, 1 > RowVector
 
typedef FVector< T, M, N+1 > TraceVector
 

Public Member Functions

 FMatrix ()
 default constructor More...
 
 ~FMatrix ()
 default destructor More...
 
 FMatrix (const FMatrix< T, M, N > &other)
 copy constructor: copy elements of other. More...
 
 FMatrix (const T *t)
 copy contents of memory pointed to by t. More...
 
 FMatrix (const T t)
 fill with value t. More...
 
template<class Expr >
 FMatrix (const FMExprNode< Expr, M, N > &e)
 construct from expression. More...
 
ListInitializationSwitch
< FMatrix< T, M, N > > 
operator= (T x)
 Initialize with list of values or single value. More...
 
int length () const
 return length of container (M*N). More...
 
int minIndex (const int dim) const
 return lowest index of dimension dim. Always 1. More...
 
int maxIndex (const int dim) const
 return highest index of dimension dim. Returns M or N. More...
 
ColumnVector col (const int col)
 Return an ltl::FVector object REFERENCEING the column vector col. More...
 
RowVector row (const int row)
 Return an ltl::FVector object REFERENCEING the row vector row. More...
 
TraceVector traceVector ()
 Return an ltl::FVector object REFERENCEING the trace vector. More...
 
T * data ()
 Return a pointer to the data. More...
 
const T * data () const
 Return a const pointer to the data. More...
 
iterator begin ()
 return an iterator pointing to the first element. More...
 
const_iterator begin () const
 return a const iterator pointing to the first element. More...
 
void fill (const T x)
 fill with value x. More...
 
void swapRows (const int row1, const int row2)
 Swap the values in two row vectors. More...
 
void swapCols (const int col1, const int col2)
 Swap the values in two column vectors. More...
 
operator() (const int i, const int j) const
 1-based access to elements. More...
 
T & operator() (const int i, const int j)
 1-based access to elements. More...
 
operator[] (const int i) const
 Direct zero-based access to the (linear) block of memory. More...
 
T & operator[] (const int i)
 Direct zero-based access to the (linear) block of memory. More...
 
template<class Expr >
FMatrix< T, M, N > & operator= (const FMExprNode< Expr, M, N > &e)
 operatorX= for expression rhs. More...
 
template<class Expr >
FMatrix< T, M, N > & operator+= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator-= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator*= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator/= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator%= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator^= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator&= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator|= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator<<= (const FMExprNode< Expr, M, N > &e)
 
template<class Expr >
FMatrix< T, M, N > & operator>>= (const FMExprNode< Expr, M, N > &e)
 
template<class T2 >
FMatrix< T, M, N > & operator= (const FMatrix< T2, M, N > &v)
 operatorX for FMatrix rhs. More...
 
FMatrix< T, M, N > & operator= (const FMatrix< T, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator+= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator-= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator*= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator/= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator%= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator^= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator&= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator|= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator<<= (const FMatrix< T2, M, N > &v)
 
template<class T2 >
FMatrix< T, M, N > & operator>>= (const FMatrix< T2, M, N > &v)
 
FMatrix< T, M, N > & operator+= (const T t)
 operatorX= for scalar rhs. More...
 
FMatrix< T, M, N > & operator-= (const T t)
 
FMatrix< T, M, N > & operator*= (const T t)
 
FMatrix< T, M, N > & operator/= (const T t)
 
FMatrix< T, M, N > & operator%= (const T t)
 
FMatrix< T, M, N > & operator^= (const T t)
 
FMatrix< T, M, N > & operator&= (const T t)
 
FMatrix< T, M, N > & operator|= (const T t)
 
FMatrix< T, M, N > & operator<<= (const T t)
 
FMatrix< T, M, N > & operator>>= (const T t)
 

Static Public Member Functions

static size_type size ()
 STL return M*N. More...
 
static bool empty ()
 STL empty(). Always false. More...
 
static size_type max_size ()
 STL: Maximum capacity. Always ==size() More...
 

Protected Attributes

__data_ [M *N]
 Storage for the matrix elements. More...
 

Friends

class FMIter< T, M, N >
 
class FMIterConst< T, M, N >
 
class ListInitializationSwitch< FMatrix< T, M, N > >
 

Related Functions

(Note that these are not member functions.)

template<class T , int M, int N>
ostream & operator<< (ostream &os, const FMatrix< T, M, N > &A)
 
template<class T , int M, int N>
istream & operator>> (istream &is, FMatrix< T, M, N > &A)
 

Detailed Description

template<class T, int M, int N>
class ltl::FMatrix< T, M, N >

Matrix with dimensions known at compile time.

Indices are 1-based. The FMatrix does not require more storage than is necessary to hold the MxN elements. STL-compatible iterators and types.

Member Typedef Documentation

template<class T, int M, int N>
typedef T ltl::FMatrix< T, M, N >::value_type

STL-compatible type definitions.

template<class T, int M, int N>
typedef FMIter<T,M,N> ltl::FMatrix< T, M, N >::iterator
template<class T, int M, int N>
typedef FMIterConst<T,M,N> ltl::FMatrix< T, M, N >::const_iterator
template<class T, int M, int N>
typedef T& ltl::FMatrix< T, M, N >::reference
template<class T, int M, int N>
typedef const T& ltl::FMatrix< T, M, N >::const_reference
template<class T, int M, int N>
typedef std::size_t ltl::FMatrix< T, M, N >::size_type
template<class T, int M, int N>
typedef std::ptrdiff_t ltl::FMatrix< T, M, N >::difference_type
template<class T, int M, int N>
typedef FVector<T,M,N> ltl::FMatrix< T, M, N >::ColumnVector
template<class T, int M, int N>
typedef FVector<T,N,1> ltl::FMatrix< T, M, N >::RowVector
template<class T, int M, int N>
typedef FVector<T,M,N+1> ltl::FMatrix< T, M, N >::TraceVector

Member Enumeration Documentation

template<class T, int M, int N>
anonymous enum

Used by expression engine to decide which loops to unroll.

Enumerator
static_size 

Constructor & Destructor Documentation

template<class T, int M, int N>
ltl::FMatrix< T, M, N >::FMatrix ( )
inline

default constructor

template<class T, int M, int N>
ltl::FMatrix< T, M, N >::~FMatrix ( )
inline

default destructor

template<class T, int M, int N>
ltl::FMatrix< T, M, N >::FMatrix ( const FMatrix< T, M, N > &  other)

copy constructor: copy elements of other.

template<class T, int M, int N>
ltl::FMatrix< T, M, N >::FMatrix ( const T *  t)

copy contents of memory pointed to by t.

template<class T, int M, int N>
ltl::FMatrix< T, M, N >::FMatrix ( const T  t)

fill with value t.

template<class T, int M, int N>
template<class Expr >
ltl::FMatrix< T, M, N >::FMatrix ( const FMExprNode< Expr, M, N > &  e)

construct from expression.

Member Function Documentation

template<class T, int M, int N>
static size_type ltl::FMatrix< T, M, N >::size ( )
inlinestatic

STL return M*N.

Functions needed for STL container conformance

template<class T, int M, int N>
static bool ltl::FMatrix< T, M, N >::empty ( )
inlinestatic

STL empty(). Always false.

template<class T, int M, int N>
static size_type ltl::FMatrix< T, M, N >::max_size ( )
inlinestatic

STL: Maximum capacity. Always ==size()

template<class T, int M, int N>
ListInitializationSwitch< FMatrix<T,M,N> > ltl::FMatrix< T, M, N >::operator= ( x)
inline

Initialize with list of values or single value.

Assign values through initialization list. A bit more comlicated since we have to discriminate between A = 3; and A = 1, 2, 3, 4; which is done using ListInitializationSwitch which either calls ListInitializer or FVector::fill().

template<class T, int M, int N>
int ltl::FMatrix< T, M, N >::length ( ) const
inline

return length of container (M*N).

Referenced by ltl::FMatrix< double, N, N >::operator[]().

template<class T, int M, int N>
int ltl::FMatrix< T, M, N >::minIndex ( const int  dim) const
inline

return lowest index of dimension dim. Always 1.

Referenced by ltl::FMatrix< T, M, N >::operator>>().

template<class T, int M, int N>
int ltl::FMatrix< T, M, N >::maxIndex ( const int  dim) const
inline

return highest index of dimension dim. Returns M or N.

Referenced by ltl::FMatrix< T, M, N >::operator>>().

template<class T, int M, int N>
T ltl::FMatrix< T, M, N >::operator() ( const int  i,
const int  j 
) const
inline

1-based access to elements.

template<class T, int M, int N>
T& ltl::FMatrix< T, M, N >::operator() ( const int  i,
const int  j 
)
inline

1-based access to elements.

template<class T, int M, int N>
T ltl::FMatrix< T, M, N >::operator[] ( const int  i) const
inline

Direct zero-based access to the (linear) block of memory.

template<class T, int M, int N>
T& ltl::FMatrix< T, M, N >::operator[] ( const int  i)
inline

Direct zero-based access to the (linear) block of memory.

template<class T, int M, int N>
ColumnVector ltl::FMatrix< T, M, N >::col ( const int  col)
inline

Return an ltl::FVector object REFERENCEING the column vector col.

Referenced by ltl::tMatClearHesseSplit< TPAR, NPAR, true >::eval(), and ltl::LUDecomposition< T, N >::solve().

template<class T, int M, int N>
RowVector ltl::FMatrix< T, M, N >::row ( const int  row)
inline

Return an ltl::FVector object REFERENCEING the row vector row.

Referenced by ltl::GaussJ< T, N >::divByPiv(), and ltl::tMatClearHesseSplit< TPAR, NPAR, true >::eval().

template<class T, int M, int N>
TraceVector ltl::FMatrix< T, M, N >::traceVector ( )
inline
template<class T, int M, int N>
T* ltl::FMatrix< T, M, N >::data ( )
inline

Return a pointer to the data.

template<class T, int M, int N>
const T* ltl::FMatrix< T, M, N >::data ( ) const
inline

Return a const pointer to the data.

template<class T, int M, int N>
iterator ltl::FMatrix< T, M, N >::begin ( )
inline

return an iterator pointing to the first element.

template<class T, int M, int N>
const_iterator ltl::FMatrix< T, M, N >::begin ( ) const
inline

return a const iterator pointing to the first element.

template<class T, int M, int N>
void ltl::FMatrix< T, M, N >::fill ( const T  x)

fill with value x.

template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator= ( const FMExprNode< Expr, M, N > &  e)

operatorX= for expression rhs.

template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator+= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator-= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator*= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator/= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator%= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator^= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator&= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator|= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator<<= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class Expr >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator>>= ( const FMExprNode< Expr, M, N > &  e)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator= ( const FMatrix< T2, M, N > &  v)

operatorX for FMatrix rhs.

template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator= ( const FMatrix< T, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator+= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator-= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator*= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator/= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator%= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator^= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator&= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator|= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator<<= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
template<class T2 >
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator>>= ( const FMatrix< T2, M, N > &  v)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator+= ( const T  t)

operatorX= for scalar rhs.

template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator-= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator*= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator/= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator%= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator^= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator&= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator|= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator<<= ( const T  t)
template<class T, int M, int N>
FMatrix<T,M,N>& ltl::FMatrix< T, M, N >::operator>>= ( const T  t)
template<class T, int M, int N>
void ltl::FMatrix< T, M, N >::swapRows ( const int  row1,
const int  row2 
)

Swap the values in two row vectors.

Referenced by ltl::GaussJ< T, N >::invert(), and ltl::GaussJ< T, N >::swapRows().

template<class T, int M, int N>
void ltl::FMatrix< T, M, N >::swapCols ( const int  col1,
const int  col2 
)

Swap the values in two column vectors.

Friends And Related Function Documentation

template<class T, int M, int N>
friend class FMIter< T, M, N >
friend
template<class T, int M, int N>
friend class FMIterConst< T, M, N >
friend
template<class T, int M, int N>
friend class ListInitializationSwitch< FMatrix< T, M, N > >
friend
template<class T , int M, int N>
ostream & operator<< ( ostream &  os,
const FMatrix< T, M, N > &  A 
)
related

Write ltl::FVector to ascii stream. Compatible with opertor>>.

template<class T , int M, int N>
istream & operator>> ( istream &  is,
FMatrix< T, M, N > &  A 
)
related

Read ltl::FMatrix from ascii stream. Compatible with operator<<.

References ltl::FMatrix< T, M, N >::maxIndex(), and ltl::FMatrix< T, M, N >::minIndex().

Member Data Documentation

template<class T, int M, int N>
T ltl::FMatrix< T, M, N >::__data_[M *N]
protected