library of assembled shared sources

http://lass.cocamware.com

lass::num::Matrix< T, S > Class Template Reference

a dynamic sized n-dimensional matrix with expression templates More...

#include <matrix.h>


Data Structures

class  Column
class  ConstColumn
class  ConstRow
struct  Rebind
class  Row

Public Types

typedef Matrix< T, S > TSelf
typedef S TStorage
typedef TStorage::TSize TSize
typedef util::CallTraits< T >
::TValue 
TValue
typedef util::CallTraits< T >
::TParam 
TParam
typedef util::CallTraits< T >
::TReference 
TReference
typedef util::CallTraits< T >
::TConstReference 
TConstReference
typedef num::NumTraits< T > TNumTraits
typedef TValueTPointer

Public Member Functions

 Matrix ()
 constructs an empty matrix
 Matrix (TSize iRows, TSize iCols)
 Construct a matrix of dimension iRows x iColumns.
 Matrix (const TStorage &iStorage)
template<typename T2 , typename S2 >
 Matrix (const Matrix< T2, S2 > &iOther)
 assign storage/expression matrix to this (this should be a storage matrix).
template<typename T2 , typename S2 >
Matrix< T, S > & operator= (const Matrix< T2, S2 > &iOther)
 assign storage/expression matrix to this (this should be a storage matrix).
const TSize rows () const
 return number of rows in matrix.
const TSize columns () const
 return number of columns in matrix.
const TValue operator() (TSize iRow, TSize iCol) const
 return the component value at position (iRow, iColumn)
TReference operator() (TSize iRow, TSize iCol)
 access the component value at position (iRow, iColumn)
const TValue at (signed iRow, signed iCol) const
 return the component value at position (iRow, iColumn) (iRow, iColumn) will be wrapped to range [0, this->rows()) x [0, this->columns()] by using a modulus operator
TReference at (signed iRow, signed iCol)
 access the component value at position (iRow, iColumn) (iRow, iColumn) will be wrapped to range [0, this->rows()) x [0, this->columns()] by using a modulus operator
ConstRow row (signed iRow) const
 return a row of matrix.
Row row (signed iRow)
 return a row of matrix.
ConstColumn column (signed iColumn) const
 return a column of matrix.
Column column (signed iColumn)
 return a column of matrix.
const Matrix< T, S > & operator+ () const
 A weird way to get back the same object.
const Matrix< T, impl::MNeg< T,
S > > 
operator- () const
 return a vector with all components negated (-a)(i, j) == -(a(i, j)).
template<typename S2 >
Matrix< T, S > & operator+= (const Matrix< T, S2 > &iB)
 componentswise addition assignment of two matrices
template<typename S2 >
Matrix< T, S > & operator-= (const Matrix< T, S2 > &iB)
 componentswise subtraction assignment of two matrices This method is equivalent to
this+=(-iB) .
Matrix< T, S > & operator*= (TParam iB)
 scalar multiplication assignment of matrix
Matrix< T, S > & operator/= (TParam iB)
 scalar multiplication assignment of matrix
void setZero (TSize iRows, TSize iCols)
 set this to a zero matrix of iRows rows and iColumns columns.
void setIdentity (TSize iSize)
 set matrix to an identity matrix of size iSize.
bool isEmpty () const
 return true if this is a (0×0) matrix
bool isZero () const
 test if this matrix equals a zero matrix.
bool isIdentity () const
 test if this matrix equals a identity matrix
bool isDiagonal () const
 test if this matrix is an diagonal matrix
bool isSquare () const
 return true if matrix has as many rows as columns
const Matrix< T, impl::MTrans
< T, S > > 
transpose () const
 return transposed matrix
bool invert ()
 replace matrix by its inverse.
const TStoragestorage () const
TStoragestorage ()
void swap (Matrix< T, S > &iOther)
 swap two matrices

Private Attributes

TStorage storage_

Related Functions

(Note that these are not member functions.)

template<typename T , typename S1 , typename S2 >
bool operator== (const Matrix< T, S1 > &iA, const Matrix< T, S2 > &iB)
template<typename T , typename S1 , typename S2 >
bool operator!= (const Matrix< T, S1 > &iA, const Matrix< T, S2 > &iB)
template<typename T , typename S1 , typename S2 >
const Matrix< T, impl::MAdd< T,
S1, S2 > > 
operator+ (const Matrix< T, S1 > &iA, const Matrix< T, S2 > &iB)
 componentwise addition
template<typename T , typename S1 , typename S2 >
const Matrix< T, impl::MSub< T,
S1, S2 > > 
operator- (const Matrix< T, S1 > &iA, const Matrix< T, S2 > &iB)
 componentwise addition
template<typename T , typename S1 , typename S2 >
const Matrix< T, impl::MProd
< T, S1, S2 > > 
operator* (const Matrix< T, S1 > &iA, const Matrix< T, S2 > &iB)
 Matrix multiplication.
template<typename T , typename S >
const Matrix< T, impl::MAdd< T,
impl::MScalar< T >, S > > 
operator+ (const T &iA, const Matrix< T, S > &iB)
 add iA to all components of iB
template<typename T , typename S >
const Matrix< T, impl::MSub< T,
impl::MScalar< T >, S > > 
operator- (const T &iA, const Matrix< T, S > &iB)
 add iA to all negated components of iB
template<typename T , typename S >
const Matrix< T, impl::MMul< T,
impl::MScalar< T >, S > > 
operator* (const T &iA, const Matrix< T, S > &iB)
 multiply iA with all components of iB
template<typename T , typename S >
const Matrix< T, impl::MAdd< T,
S, impl::MScalar< T > > > 
operator+ (const Matrix< T, S > &iA, const T &iB)
 add iB to all components of iA
template<typename T , typename S >
const Matrix< T, impl::MAdd< T,
S, impl::MScalar< T > > > 
operator- (const Matrix< T, S > &iA, const T &iB)
 subtract iB from all components of iA
template<typename T , typename S >
const Matrix< T, impl::MMul< T,
S, impl::MScalar< T > > > 
operator* (const Matrix< T, S > &iA, const T &iB)
 multiply all components of iA with iB.
template<typename T , typename S >
const Matrix< T, impl::MMul< T,
S, impl::MScalar< T > > > 
operator/ (const Matrix< T, S > &iA, const T &iB)
 divide all components of iA by iB.
template<typename T , typename S , typename S2 >
bool solve (const Matrix< T, S > &iA, Matrix< T, S2 > &ioB)
 solve equation A * X = B
template<typename T , typename S , typename Char , typename Traits >
std::basic_ostream< Char,
Traits > & 
operator<< (std::basic_ostream< Char, Traits > &oOStream, const Matrix< T, S > &iB)


Detailed Description

template<typename T, typename S = impl::MStorage<T>>
class lass::num::Matrix< T, S >

a dynamic sized n-dimensional matrix with expression templates

Author:
Bram de Greve [BdG]

Definition at line 69 of file matrix.h.


Member Typedef Documentation

template<typename T , typename S = impl::MStorage<T>>
typedef Matrix<T, S> lass::num::Matrix< T, S >::TSelf

Definition at line 73 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef S lass::num::Matrix< T, S >::TStorage

Definition at line 74 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef TStorage::TSize lass::num::Matrix< T, S >::TSize

Definition at line 75 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef util::CallTraits<T>::TValue lass::num::Matrix< T, S >::TValue

Definition at line 77 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef util::CallTraits<T>::TParam lass::num::Matrix< T, S >::TParam

Definition at line 78 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef util::CallTraits<T>::TReference lass::num::Matrix< T, S >::TReference

Definition at line 79 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef util::CallTraits<T>::TConstReference lass::num::Matrix< T, S >::TConstReference

Definition at line 80 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef num::NumTraits<T> lass::num::Matrix< T, S >::TNumTraits

Definition at line 81 of file matrix.h.

template<typename T , typename S = impl::MStorage<T>>
typedef TValue* lass::num::Matrix< T, S >::TPointer

Definition at line 82 of file matrix.h.


Constructor & Destructor Documentation

template<typename T , typename S >
lass::num::Matrix< T, S >::Matrix (  )  [inline]

constructs an empty matrix

Exception Safety:
strong guarentee.

Definition at line 82 of file matrix.inl.

template<typename T , typename S >
lass::num::Matrix< T, S >::Matrix ( TSize  iRows,
TSize  iColumns 
) [inline, explicit]

Construct a matrix of dimension iRows x iColumns.

Can be used as default constructor for storage in containers.

Parameters:
iRows the number of rows of the matrix to be created.
iColumns the number of columns of the matrix to be created. By default both iRows and iColumns are zero, what creates an empty matrix. Not very usefull though, except as place holder. So, it's safe to pass zero as arguments, but you shouldn't pass negative values.
Complexity:
O(iRows * iColumns)
Exception Safety:
strong guarentee.

Definition at line 104 of file matrix.inl.

template<typename T , typename S >
lass::num::Matrix< T, S >::Matrix ( const TStorage iStorage  )  [inline, explicit]

Definition at line 112 of file matrix.inl.

template<typename T , typename S >
template<typename T2 , typename S2 >
lass::num::Matrix< T, S >::Matrix ( const Matrix< T2, S2 > &  iOther  )  [inline]

assign storage/expression matrix to this (this should be a storage matrix).

Precondition:
this must be an l-value (storage matrix).
Complexity:
O(iOther.rows() * iOther.columns())
Exception Safety:
basic guarentee.

Definition at line 131 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_META_ASSERT, lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::storage(), and lass::num::Matrix< T, S >::storage_.


Member Function Documentation

template<typename T , typename S >
template<typename T2 , typename S2 >
Matrix< T, S > & lass::num::Matrix< T, S >::operator= ( const Matrix< T2, S2 > &  iOther  )  [inline]

assign storage/expression matrix to this (this should be a storage matrix).

Precondition:
this must be an l-value (storage matrix).
Complexity:
O(iOther.rows() * iOther.columns())
Exception Safety:
basic guarentee.

Definition at line 162 of file matrix.inl.

References LASS_META_ASSERT, lass::num::Matrix< T, S >::storage(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
const Matrix< T, S >::TSize lass::num::Matrix< T, S >::rows (  )  const [inline]

template<typename T , typename S >
const Matrix< T, S >::TSize lass::num::Matrix< T, S >::columns (  )  const [inline]

template<typename T , typename S >
const Matrix< T, S >::TValue lass::num::Matrix< T, S >::operator() ( TSize  iRow,
TSize  iColumn 
) const [inline]

return the component value at position (iRow, iColumn)

Precondition:
(iRow, iColumn) shouldn't be out of the range [0, this->rows()) x [0, this->columns()], unless you're asking for trouble.

Definition at line 227 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_ASSERT, lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
util::CallTraits< T >::TReference lass::num::Matrix< T, S >::operator() ( TSize  iRow,
TSize  iColumn 
) [inline]

access the component value at position (iRow, iColumn)

Precondition:
(iRow, iColumn) shouldn't be out of the range [0, this->rows()) x [0, this->columns()], unless you're asking for trouble.

this must be an l-value (storage matrix).

Definition at line 244 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_ASSERT, LASS_META_ASSERT, lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
const Matrix< T, S >::TValue lass::num::Matrix< T, S >::at ( signed  iRow,
signed  iCol 
) const [inline]

return the component value at position (iRow, iColumn) (iRow, iColumn) will be wrapped to range [0, this->rows()) x [0, this->columns()] by using a modulus operator

Definition at line 259 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), lass::num::mod(), lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
util::CallTraits< T >::TReference lass::num::Matrix< T, S >::at ( signed  iRow,
signed  iColumn 
) [inline]

access the component value at position (iRow, iColumn) (iRow, iColumn) will be wrapped to range [0, this->rows()) x [0, this->columns()] by using a modulus operator

Precondition:
this must be an l-value (storage matrix).

Definition at line 274 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_META_ASSERT, lass::num::mod(), lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
Matrix< T, S >::ConstRow lass::num::Matrix< T, S >::row ( signed  iRow  )  const [inline]

return a row of matrix.

iRow will be wrapped to range [0, this->rows()) by using a modulus operator

Definition at line 287 of file matrix.inl.

References lass::num::mod(), and lass::num::Matrix< T, S >::rows().

template<typename T , typename S >
Matrix< T, S >::Row lass::num::Matrix< T, S >::row ( signed  iRow  )  [inline]

return a row of matrix.

iRow will be wrapped to range [0, this->rows()) by using a modulus operator. THIS MUST BE LVALUE (storage matrix).

Definition at line 300 of file matrix.inl.

References lass::num::mod(), and lass::num::Matrix< T, S >::rows().

template<typename T , typename S >
Matrix< T, S >::ConstColumn lass::num::Matrix< T, S >::column ( signed  iColumn  )  const [inline]

return a column of matrix.

iColumn will be wrapped to range [0, this->columns()) by using a modulus operator

Definition at line 312 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), and lass::num::mod().

Referenced by lass::num::Matrix< T, S >::invert(), and lass::num::Matrix< T, S >::solve().

template<typename T , typename S >
Matrix< T, S >::Column lass::num::Matrix< T, S >::column ( signed  iColumn  )  [inline]

return a column of matrix.

iColumn will be wrapped to range [0, this->columns()) by using a modulus operator THIS MUST BE LVALUE (storage matrix).

Definition at line 325 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), and lass::num::mod().

template<typename T , typename S >
const Matrix< T, S > & lass::num::Matrix< T, S >::operator+ (  )  const [inline]

A weird way to get back the same object.

Complexity:
O(1)
Exception safety:
no-fail

Definition at line 341 of file matrix.inl.

template<typename T , typename S >
const Matrix< T, impl::MNeg< T, S > > lass::num::Matrix< T, S >::operator- (  )  const [inline]

return a vector with all components negated (-a)(i, j) == -(a(i, j)).

Complexity:
O(1)
Exception safety:
no-fail

Definition at line 359 of file matrix.inl.

References lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
template<typename S2 >
Matrix< T, S > & lass::num::Matrix< T, S >::operator+= ( const Matrix< T, S2 > &  iB  )  [inline]

componentswise addition assignment of two matrices

Matrix Addition: Denote the sum of two matrices
A and
B (of the same dimensions) by
C=A+B. The sum is defined by adding entries with the same indices
Cij=Aij+Bij over all
i and
j.
http://mathworld.wolfram.com/MatrixAddition.html

This method implements the assignment addition what reduces to
Aij+=Bij over all
i and
j.

Precondition:
this must be an l-value (storage matrix).
Complexity:
O(this->rows() * this->columns())
Exceptions:
an exception is thrown if *this and iB are not of the same dimensions

Definition at line 386 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_META_ASSERT, LASS_NUM_MATRIX_ENFORCE_EQUAL_DIMENSION, lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::storage(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
template<typename S2 >
Matrix< T, S > & lass::num::Matrix< T, S >::operator-= ( const Matrix< T, S2 > &  iB  )  [inline]

componentswise subtraction assignment of two matrices This method is equivalent to
this+=(-iB) .

See also:
Matrix<T>::operator+=
Precondition:
this must be an l-value (storage matrix).
Complexity:
O(this->rows() * this->columns())
Exceptions:
an exception is thrown if *this and iB are not of the same dimensions

Definition at line 419 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_META_ASSERT, LASS_NUM_MATRIX_ENFORCE_EQUAL_DIMENSION, lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::storage(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
Matrix< T, S > & lass::num::Matrix< T, S >::operator*= ( TParam  iB  )  [inline]

scalar multiplication assignment of matrix

Precondition:
this must be an l-value (storage matrix).
Complexity:
O(this->rows() * this->columns())

Definition at line 446 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_META_ASSERT, lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
Matrix< T, S > & lass::num::Matrix< T, S >::operator/= ( TParam  iB  )  [inline]

scalar multiplication assignment of matrix

Precondition:
this must be an l-value (storage matrix).

Definition at line 469 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), LASS_META_ASSERT, lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
void lass::num::Matrix< T, S >::setZero ( TSize  iRows,
TSize  iColumns 
) [inline]

set this to a zero matrix of iRows rows and iColumns columns.

See also:
Matrix<T>::isZero
Precondition:
this should be an lvalue
Complexity:
O(this->rows() * this->columns())

Definition at line 495 of file matrix.inl.

References LASS_META_ASSERT, lass::num::Matrix< T, S >::storage_, and lass::num::NumTraits< C >::zero.

Referenced by lass::num::Matrix< T, S >::invert(), and lass::num::Matrix< T, S >::solve().

template<typename T , typename S >
void lass::num::Matrix< T, S >::setIdentity ( TSize  iSize  )  [inline]

set matrix to an identity matrix of size iSize.

See also:
Matrix<T>::isIdentity
Precondition:
this should be an lvalue
Complexity:
O(this->rows() * this->columns())

Definition at line 519 of file matrix.inl.

References LASS_META_ASSERT, lass::num::NumTraits< C >::one, lass::num::Matrix< T, S >::storage_, and lass::num::NumTraits< C >::zero.

Referenced by lass::num::Matrix< T, S >::invert().

template<typename T , typename S >
bool lass::num::Matrix< T, S >::isEmpty (  )  const [inline]

return true if this is a (0×0) matrix

Complexity:
O(1)
Exception safety:
no-fail

Definition at line 543 of file matrix.inl.

References lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
bool lass::num::Matrix< T, S >::isZero (  )  const [inline]

test if this matrix equals a zero matrix.

A zero matrix is an
m×n matrix consisting of all 0s (MacDuffee 1943, p. 27), denoted
0. Zero matrices are sometimes also known as null matrices (Akivis and Goldberg 1972, p. 71).
http://mathworld.wolfram.com/ZeroMatrix.html

an empty matrix is also a zero matrix.

Complexity:
O(this->rows() * this->columns())

Definition at line 562 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::storage_, and lass::num::NumTraits< C >::zero.

template<typename T , typename S >
bool lass::num::Matrix< T, S >::isIdentity (  )  const [inline]

test if this matrix equals a identity matrix

The identity matrix is a the simplest nontrivial diagonal matrix, defined such that
I(X)=X for all vectors
X. An identity matrix may be denoted
1,
I, or
E (the latter being an abbreviation for the German term "Einheitsmatrix"; Courant and Hilbert 1989, p. 7). Identity matrices are sometimes also known as unit matrices (Akivis and Goldberg 1972, p. 71). The
n×n identity matrix is given explicitly by
Iij=dij for
i,
j = 1, 2, ..., n, where
dij is the Kronecker delta.
http://mathworld.wolfram.com/IdentityMatrix.html

an empty matrix is also an identity matrix.

Complexity:
O(this->rows() * this->columns())

Definition at line 597 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), lass::num::Matrix< T, S >::isSquare(), lass::num::NumTraits< C >::one, lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::storage_, and lass::num::NumTraits< C >::zero.

template<typename T , typename S >
bool lass::num::Matrix< T, S >::isDiagonal (  )  const [inline]

test if this matrix is an diagonal matrix

A diagonal matrix is a square matrix
A of the form
Aij=Ci*dij where
dij is the Kronecker delta,
Ci are constants, and
i,
j = 1, 2, ..., n, with is no implied summation over indices.
http://mathworld.wolfram.com/DiagonalMatrix.html

Note:
both square zero matrices and identity matrices will yield true on this one.
Complexity:
O(this->rows() * this->columns())

Definition at line 633 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), lass::num::Matrix< T, S >::isSquare(), lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::storage_, and lass::num::NumTraits< C >::zero.

template<typename T , typename S >
bool lass::num::Matrix< T, S >::isSquare (  )  const [inline]

return true if matrix has as many rows as columns

Complexity:
O(1)

Definition at line 662 of file matrix.inl.

References lass::num::Matrix< T, S >::storage_.

Referenced by lass::num::Matrix< T, S >::invert(), lass::num::Matrix< T, S >::isDiagonal(), lass::num::Matrix< T, S >::isIdentity(), and lass::num::Matrix< T, S >::solve().

template<typename T , typename S >
const Matrix< T, impl::MTrans< T, S > > lass::num::Matrix< T, S >::transpose (  )  const [inline]

return transposed matrix

Complexity:
O(1)

Definition at line 676 of file matrix.inl.

References lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
bool lass::num::Matrix< T, S >::invert (  )  [inline]

replace matrix by its inverse.

If matrix has no inverse (this is singular), no exception is thrown. Instead, an empty matrix is made.

Precondition:
this must be an l-value (storage matrix).
Returns:
true if succeeded, false if not.
Exceptions:
an exception is thrown if this is not a square matrix

Definition at line 695 of file matrix.inl.

References lass::num::Matrix< T, S >::column(), lass::num::Matrix< T, S >::isSquare(), LASS_ENFORCE, LASS_META_ASSERT, lass::num::impl::ludecomp(), lass::num::impl::lusolve(), lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::setIdentity(), lass::num::Matrix< T, S >::setZero(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, S >::TStorage & lass::num::Matrix< T, S >::storage (  )  const [inline]

template<typename T , typename S >
Matrix< T, S >::TStorage & lass::num::Matrix< T, S >::storage (  )  [inline]

Definition at line 733 of file matrix.inl.

References lass::num::Matrix< T, S >::storage_.

template<typename T , typename S >
void lass::num::Matrix< T, S >::swap ( Matrix< T, S > &  iOther  )  [inline]

swap two matrices

Precondition:
this and iOther must be an l-value (storage matrix).
Complexity:
O(1)
Exception safety:
no-fail

Definition at line 751 of file matrix.inl.

References LASS_META_ASSERT, and lass::num::Matrix< T, S >::storage_.


Friends And Related Function Documentation

template<typename T , typename S1 , typename S2 >
bool operator== ( const Matrix< T, S1 > &  iA,
const Matrix< T, S2 > &  iB 
) [related]

Complexity:
O(iA.rows() * iA.columns())

Definition at line 775 of file matrix.inl.

References lass::num::Matrix< T, S >::columns(), and lass::num::Matrix< T, S >::rows().

template<typename T , typename S1 , typename S2 >
bool operator!= ( const Matrix< T, S1 > &  iA,
const Matrix< T, S2 > &  iB 
) [related]

Complexity:
O(iA.rows() * iA.columns())

Definition at line 805 of file matrix.inl.

template<typename T , typename S1 , typename S2 >
const Matrix< T, impl::MAdd< T, S1, S2 > > operator+ ( const Matrix< T, S1 > &  iA,
const Matrix< T, S2 > &  iB 
) [related]

componentwise addition

Complexity:
O(1)

Definition at line 820 of file matrix.inl.

References LASS_NUM_MATRIX_ENFORCE_EQUAL_DIMENSION, and lass::num::Matrix< T, S >::storage().

template<typename T , typename S1 , typename S2 >
const Matrix< T, impl::MSub< T, S1, S2 > > operator- ( const Matrix< T, S1 > &  iA,
const Matrix< T, S2 > &  iB 
) [related]

componentwise addition

Complexity:
O(1)

Definition at line 837 of file matrix.inl.

References LASS_NUM_MATRIX_ENFORCE_EQUAL_DIMENSION, and lass::num::Matrix< T, S >::storage().

template<typename T , typename S1 , typename S2 >
const Matrix< T, impl::MProd< T, S1, S2 > > operator* ( const Matrix< T, S1 > &  iA,
const Matrix< T, S2 > &  iB 
) [related]

Matrix multiplication.

The product
C of two matrices
A and
B is defined by
Cik=Aij*Bjk, where
j is summed over for all possible values of
i and
k. The implied summation over repeated indices without the presence of an explicit sum sign is called Einstein summation, and is commonly used in both matrix and tensor analysis. Therefore, in order for matrix multiplication to be defined, the dimensions of the matrices must satisfy
(n×m)*(m×p)=(n×p) where
(a×b) denotes a matrix with
a rows and
b columns.
http://mathworld.wolfram.com/MatrixMultiplication.html

Exceptions:
an exception is throw in iA and iB don't meet the requirement
iA.columns()==iB.rows() .
Complexity:
O(1)

Definition at line 865 of file matrix.inl.

References LASS_NUM_MATRIX_ENFORCE_ADJACENT_DIMENSION, and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, impl::MAdd< T, impl::MScalar< T >, S > > operator+ ( const T &  iA,
const Matrix< T, S > &  iB 
) [related]

add iA to all components of iB

Complexity:
O(1)

Definition at line 882 of file matrix.inl.

References lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, impl::MSub< T, impl::MScalar< T >, S > > operator- ( const T &  iA,
const Matrix< T, S > &  iB 
) [related]

add iA to all negated components of iB

Complexity:
O(1)

Definition at line 899 of file matrix.inl.

References lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, impl::MMul< T, impl::MScalar< T >, S > > operator* ( const T &  iA,
const Matrix< T, S > &  iB 
) [related]

multiply iA with all components of iB

Complexity:
O(1)

Definition at line 916 of file matrix.inl.

References lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, impl::MAdd< T, S, impl::MScalar< T > > > operator+ ( const Matrix< T, S > &  iA,
const T &  iB 
) [related]

add iB to all components of iA

Complexity:
O(1)

Definition at line 933 of file matrix.inl.

References lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, impl::MAdd< T, S, impl::MScalar< T > > > operator- ( const Matrix< T, S > &  iA,
const T &  iB 
) [related]

subtract iB from all components of iA

Complexity:
O(1)

Definition at line 950 of file matrix.inl.

References lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, impl::MMul< T, S, impl::MScalar< T > > > operator* ( const Matrix< T, S > &  iA,
const T &  iB 
) [related]

multiply all components of iA with iB.

Complexity:
O(1)

Definition at line 967 of file matrix.inl.

References lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S >
const Matrix< T, impl::MMul< T, S, impl::MScalar< T > > > operator/ ( const Matrix< T, S > &  iA,
const T &  iB 
) [related]

divide all components of iA by iB.

Complexity:
O(1)

Definition at line 984 of file matrix.inl.

References lass::num::Matrix< T, S >::rows(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S , typename S2 >
bool solve ( const Matrix< T, S > &  iA,
Matrix< T, S2 > &  ioB 
) [related]

solve equation A * X = B

Precondition:
ioB must be an l-value (storage matrix).
Returns:
true if solution is found, false if set has no solution.
Exceptions:
an exception is thrown if dimensions don't match (this->isSquare() && this->columns() == ioB.rows())

Definition at line 1003 of file matrix.inl.

References lass::num::Matrix< T, S >::column(), lass::num::Matrix< T, S >::columns(), lass::num::Matrix< T, S >::isSquare(), LASS_ASSERT, LASS_ENFORCE, LASS_META_ASSERT, LASS_NUM_MATRIX_ENFORCE_ADJACENT_DIMENSION, lass::num::Matrix< T, S >::rows(), lass::num::Matrix< T, S >::setZero(), and lass::num::Matrix< T, S >::storage().

template<typename T , typename S , typename Char , typename Traits >
std::basic_ostream< Char, Traits > & operator<< ( std::basic_ostream< Char, Traits > &  oOStream,
const Matrix< T, S > &  iB 
) [related]

Definition at line 1034 of file matrix.inl.

References LASS_ENFORCE_STREAM.


Field Documentation

template<typename T , typename S = impl::MStorage<T>>
TStorage lass::num::Matrix< T, S >::storage_ [private]


The documentation for this class was generated from the following files:

Generated on Mon Nov 10 14:22:10 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo