DGtal
0.6.devel
|
#include <SimpleMatrix.h>
Public Types | |
typedef TComponent | Component |
typedef PointVector< N, Component > | RowVector |
typedef PointVector< M, Component > | ColumnVector |
typedef SimpleMatrix < Component, TM, TN > | Self |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((CEuclideanRing< TComponent >)) | |
BOOST_STATIC_ASSERT (TM > 0) | |
BOOST_STATIC_ASSERT (TM > 0) | |
SimpleMatrix () | |
SimpleMatrix (const Self &other) | |
void | clear () |
void | constant (const Component &aScalar) |
void | identity () |
RowVector | row (const DGtal::Dimension i) const |
ColumnVector | column (const DGtal::Dimension j) const |
void | setComponent (const DGtal::Dimension i, const DGtal::Dimension j, const Component &aValue) |
Component | operator() (const DGtal::Dimension i, const DGtal::Dimension j) const |
bool | operator== (const Self &aMatrix) const |
template<typename TComponentOther > | |
Self & | operator= (const SimpleMatrix< TComponentOther, M, N > &aMatrix) |
Self | operator+ (const Self &aMatrix) const |
Self & | operator+= (const Self &aMatrix) |
Self | operator- (const Self &aMatrix) const |
Self & | operator-= (const Self &aMatrix) |
Self | operator* (const Component &aScalar) const |
Self & | operator*= (const Component &aScalar) |
Self | operator/ (const Component &aScalar) const |
Self & | operator/= (const Component &aScalar) |
SimpleMatrix< Component, TM, TM > | operator* (const SimpleMatrix< Component, N, M > &aMatrix) const |
ColumnVector | operator* (const RowVector &aVector) const |
SimpleMatrix< Component, TN, TM > | transpose () const |
Component | cofactor (const DGtal::Dimension i, const DGtal::Dimension j) const |
Self | cofactor () const |
Component | minorDeterminant (const DGtal::Dimension i, const DGtal::Dimension j) const |
Component | determinant () const |
SimpleMatrix< Component, TM, TN > | inverse () const |
~SimpleMatrix () | |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
template<typename TC > | |
DGtal::SimpleMatrix< T, TM, TN > & | operator= (const SimpleMatrix< TC, M, N > &other) |
Static Public Attributes | |
static const DGtal::Dimension | M = TM |
static const DGtal::Dimension | N = TN |
Private Attributes | |
boost::array< Component, M *N > | myValues |
boost::array< Component, M *N > | myCofactorCoefs |
Aim: implements basic MxN Matrix services (M,N>=1).
Description of template class 'SimpleMatrix'
This class defines simple matrix with static size. Computations are performed in the euclidean ring associated with the type TComponent.
This class also defines types for row and column vectors as specialized PointVector types.
Class inspired by Anis Benyoub (INSA-Lyon).
TComponent | any model of CEuclideanRing |
TM | number of rows of the matrix |
TN | number of columns of the matrix |
Definition at line 72 of file SimpleMatrix.h.
typedef PointVector<M,Component> DGtal::SimpleMatrix< TComponent, TM, TN >::ColumnVector |
Definition at line 81 of file SimpleMatrix.h.
typedef TComponent DGtal::SimpleMatrix< TComponent, TM, TN >::Component |
Definition at line 76 of file SimpleMatrix.h.
typedef PointVector<N,Component> DGtal::SimpleMatrix< TComponent, TM, TN >::RowVector |
Definition at line 80 of file SimpleMatrix.h.
typedef SimpleMatrix<Component,TM,TN> DGtal::SimpleMatrix< TComponent, TM, TN >::Self |
Definition at line 83 of file SimpleMatrix.h.
|
inline |
Create a static mxn matrix.
SimpleMatrix values are all set to the zero value associated to Component type.
Constructor.
Definition at line 56 of file SimpleMatrix.ih.
|
inline |
Copy constructor.
other | the object to clone. Forbidden by default. |
Definition at line 70 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myCofactorCoefs, and DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
|
inline |
DGtal::SimpleMatrix< TComponent, TM, TN >::BOOST_CONCEPT_ASSERT | ( | (CEuclideanRing< TComponent >) | ) |
DGtal::SimpleMatrix< TComponent, TM, TN >::BOOST_STATIC_ASSERT | ( | TM | , |
0 | |||
) |
DGtal::SimpleMatrix< TComponent, TM, TN >::BOOST_STATIC_ASSERT | ( | TM | , |
0 | |||
) |
|
inline |
Clear matrix values
Definition at line 83 of file SimpleMatrix.ih.
|
inline |
Cofactor of the matrix at position (i,j).
Definition at line 170 of file SimpleMatrix.ih.
|
inline |
Cofactor matrix computation.
Definition at line 180 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::setComponent().
|
inline |
Get column vector.
j | the column index. |
Definition at line 125 of file SimpleMatrix.ih.
|
inline |
Set a constant scalar to each matrix component.
aScalar | the scalar |
Definition at line 92 of file SimpleMatrix.ih.
|
inline |
Returns the determinant of square matrix. Slow method for large matrices.
Specialized methods exist for 2x2 and 3x3 matrices.
Definition at line 204 of file SimpleMatrix.ih.
|
inline |
Set values to create identity matrix
Definition at line 101 of file SimpleMatrix.ih.
|
inline |
Compute the inverse of the matrix.
Definition at line 213 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::transpose().
|
inline |
Checks the validity/consistency of the object.
Definition at line 402 of file SimpleMatrix.ih.
|
inline |
Return the minor determinant (i,j) of the current matrix
Specialized methods exist for 2x2 and 3x3 matrices.
i | row index |
j | column index |
Definition at line 195 of file SimpleMatrix.ih.
|
inline |
Self DGtal::SimpleMatrix< TComponent, TM, TN >::operator* | ( | const Component & | aScalar | ) | const |
Product between the matrix 'this' and a scalar
aScalar | the scalar coefficient |
SimpleMatrix<Component,TM,TM> DGtal::SimpleMatrix< TComponent, TM, TN >::operator* | ( | const SimpleMatrix< Component, N, M > & | aMatrix | ) | const |
Product between the matrix 'this' and aMatrix.
aMatrix | the NxM matrix to multiply |
|
inline |
Product between the matrix and a Column vector.
aMatrix | the NxM matrix to multiply |
Definition at line 271 of file SimpleMatrix.ih.
|
inline |
Product between the matrix 'this' and a scalar
aScalar | the scalar coefficient |
Definition at line 328 of file SimpleMatrix.ih.
|
inline |
Addition between the matrix 'this' and aMatrix.
aMatrix | the matrix to add to self. |
Definition at line 149 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
|
inline |
Addition and assignment between the matrix 'this' and aMatrix.
aMatrix | the matrix to add to self. |
Definition at line 160 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
|
inline |
Substract between the matrix 'this' and aMatrix.
aMatrix | the matrix to substract to self. |
Definition at line 229 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
|
inline |
Substract and assignment between the matrix 'this' and aMatrix.
aMatrix | the matrix to substract to self. |
Definition at line 240 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
|
inline |
Division of a matrix by a scalar.
aScalar | the scalar value |
Definition at line 316 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
|
inline |
Division of a matrix by a scalar.
aScalar | the scalar value |
Definition at line 306 of file SimpleMatrix.ih.
|
inline |
Definition at line 138 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
Self& DGtal::SimpleMatrix< TComponent, TM, TN >::operator= | ( | const SimpleMatrix< TComponentOther, M, N > & | aMatrix | ) |
Assignment operator from another matrix. Note: a static_cast from TComponentOther to Component is performed.
TComponentOther | another Component type. |
aMatrix | the matrix to copy. |
|
inline |
SimpleMatrix comparison.
another | matrix. |
Definition at line 250 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::myValues.
|
inline |
Get row vector.
i | the row index |
Definition at line 114 of file SimpleMatrix.ih.
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 382 of file SimpleMatrix.ih.
|
inline |
Set a value at position (i,j).
i | row index |
j | column index |
aValue | a component |
Definition at line 352 of file SimpleMatrix.ih.
Referenced by DGtal::SimpleMatrix< TComponent, TM, TN >::cofactor(), and DGtal::SimpleMatrix< TComponent, TM, TN >::transpose().
|
inline |
Transpose the matrix.
Definition at line 259 of file SimpleMatrix.ih.
References DGtal::SimpleMatrix< TComponent, TM, TN >::setComponent().
Referenced by DGtal::SimpleMatrix< TComponent, TM, TN >::inverse().
|
static |
Definition at line 77 of file SimpleMatrix.h.
|
private |
Static computation of cofactor coefficients
Definition at line 384 of file SimpleMatrix.h.
Referenced by DGtal::SimpleMatrix< TComponent, TM, TN >::SimpleMatrix().
|
private |
Matrix values containers.
Definition at line 380 of file SimpleMatrix.h.
Referenced by DGtal::SimpleMatrix< TComponent, TM, TN >::operator+(), DGtal::SimpleMatrix< TComponent, TM, TN >::operator+=(), DGtal::SimpleMatrix< TComponent, TM, TN >::operator-(), DGtal::SimpleMatrix< TComponent, TM, TN >::operator-=(), DGtal::SimpleMatrix< TComponent, TM, TN >::operator/(), DGtal::SimpleMatrix< TComponent, TM, TN >::operator=(), DGtal::SimpleMatrix< TComponent, TM, TN >::operator==(), and DGtal::SimpleMatrix< TComponent, TM, TN >::SimpleMatrix().
|
static |
Definition at line 78 of file SimpleMatrix.h.