DGtal
1.5.beta
|
Aim: implements basic MxN Matrix services (M,N>=1). More...
#include <DGtal/math/linalg/SimpleMatrix.h>
Public Types | |
typedef TComponent | Component |
typedef PointVector< N, Component > | RowVector |
typedef PointVector< M, Component > | ColumnVector |
typedef SimpleMatrix< Component, TM, TN > | Self |
typedef Dimension | Index |
Types needed by CLinearAlgebraContainer. More... | |
typedef Component | Scalar |
Static Public Attributes | |
static const DGtal::Dimension | M = TM |
static const DGtal::Dimension | N = TN |
Private Attributes | |
std::array< Component, M *N > | myValues |
Matrix values containers. More... | |
std::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.
Matrix coefficient indices are in the range [0,M-1] and [0,N-1].
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 75 of file SimpleMatrix.h.
typedef PointVector<M,Component> DGtal::SimpleMatrix< TComponent, TM, TN >::ColumnVector |
Definition at line 84 of file SimpleMatrix.h.
typedef TComponent DGtal::SimpleMatrix< TComponent, TM, TN >::Component |
Definition at line 79 of file SimpleMatrix.h.
typedef Dimension DGtal::SimpleMatrix< TComponent, TM, TN >::Index |
Types needed by CLinearAlgebraContainer.
Definition at line 89 of file SimpleMatrix.h.
typedef PointVector<N,Component> DGtal::SimpleMatrix< TComponent, TM, TN >::RowVector |
Definition at line 83 of file SimpleMatrix.h.
typedef Component DGtal::SimpleMatrix< TComponent, TM, TN >::Scalar |
Definition at line 90 of file SimpleMatrix.h.
typedef SimpleMatrix<Component,TM,TN> DGtal::SimpleMatrix< TComponent, TM, TN >::Self |
Definition at line 86 of file SimpleMatrix.h.
DGtal::SimpleMatrix< TComponent, TM, TN >::SimpleMatrix | ( | ) |
Create a static mxn matrix.
SimpleMatrix values are all set to the zero value associated to Component type.
DGtal::SimpleMatrix< TComponent, TM, TN >::SimpleMatrix | ( | std::initializer_list< TComponent > | values | ) |
Constructor from initializer list.
This matrix values are given row by row (top to bottom) from left to right. {a,b,c,d} = [[a b] [c d]]
values | the initializer list. |
DGtal::SimpleMatrix< TComponent, TM, TN >::SimpleMatrix | ( | const Self & | other | ) |
Copy constructor.
other | the object to clone. Forbidden by default. |
DGtal::SimpleMatrix< TComponent, TM, TN >::~SimpleMatrix | ( | ) |
Destructor.
DGtal::SimpleMatrix< TComponent, TM, TN >::BOOST_CONCEPT_ASSERT | ( | (concepts::CEuclideanRing< TComponent >) | ) |
DGtal::SimpleMatrix< TComponent, TM, TN >::BOOST_STATIC_ASSERT | ( | TM | , |
0 | |||
) |
DGtal::SimpleMatrix< TComponent, TM, TN >::BOOST_STATIC_ASSERT | ( | TM | , |
0 | |||
) |
void DGtal::SimpleMatrix< TComponent, TM, TN >::clear | ( | ) |
Clear matrix values
Referenced by LSF().
Self DGtal::SimpleMatrix< TComponent, TM, TN >::cofactor | ( | ) | const |
Cofactor matrix computation.
Component DGtal::SimpleMatrix< TComponent, TM, TN >::cofactor | ( | const DGtal::Dimension | i, |
const DGtal::Dimension | j | ||
) | const |
Cofactor of the matrix at position (i,j).
|
inline |
Get number of columns.
Definition at line 180 of file SimpleMatrix.h.
References DGtal::SimpleMatrix< TComponent, TM, TN >::N.
ColumnVector DGtal::SimpleMatrix< TComponent, TM, TN >::column | ( | const DGtal::Dimension | j | ) | const |
Get column vector.
j | the column index. |
Referenced by DGtal::deprecated::IntegralInvariantNormalVectorEstimator< TKSpace, TPointPredicate >::CovarianceMatrix2NormalDirectionFunctor::operator()(), DGtal::CorrectedNormalCurrentComputer< TRealPoint, TRealVector >::principalCurvatures(), DGtal::NormalCycleComputer< TRealPoint, TRealVector >::principalCurvatures(), and testColRow().
void DGtal::SimpleMatrix< TComponent, TM, TN >::constant | ( | const Component & | aScalar | ) |
Set a constant scalar to each matrix component.
aScalar | the scalar |
Referenced by DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::reset(), DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::TensorVotingFeatureExtraction(), and testArithm().
Component DGtal::SimpleMatrix< TComponent, TM, TN >::determinant | ( | ) | const |
Returns the determinant of square matrix. Slow method for large matrices.
Specialized methods exist for 2x2 and 3x3 matrices.
void DGtal::SimpleMatrix< TComponent, TM, TN >::identity | ( | ) |
Set values to create identity matrix
Referenced by DGtal::SimpleMatrix< TComponent, TM, TN >::setIdentity(), and DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::TensorVotingFeatureExtraction().
SimpleMatrix<Component,TM,TN> DGtal::SimpleMatrix< TComponent, TM, TN >::inverse | ( | ) | const |
Compute the inverse of the matrix.
bool DGtal::SimpleMatrix< TComponent, TM, TN >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Component DGtal::SimpleMatrix< TComponent, TM, TN >::minorDeterminant | ( | const DGtal::Dimension | i, |
const DGtal::Dimension | j | ||
) | const |
Return the minor determinant (i,j) of the current matrix
Specialized methods exist for 2x2 and 3x3 matrices.
i | row index |
j | column index |
Component& DGtal::SimpleMatrix< TComponent, TM, TN >::operator() | ( | const DGtal::Dimension | i, |
const DGtal::Dimension | j | ||
) |
Get a reference to the value at position (i,j).
i | row index |
j | column index |
Component DGtal::SimpleMatrix< TComponent, TM, TN >::operator() | ( | const DGtal::Dimension | i, |
const DGtal::Dimension | j | ||
) | const |
Get a value at position (i,j).
i | row index |
j | column index |
Self DGtal::SimpleMatrix< TComponent, TM, TN >::operator* | ( | const Component & | aScalar | ) | const |
Product between the matrix 'this' and a scalar
aScalar | the scalar coefficient |
ColumnVector DGtal::SimpleMatrix< TComponent, TM, TN >::operator* | ( | const RowVector & | aVector | ) | const |
Product between the matrix and a Column vector.
aVector | the vector to multiply |
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 |
Self& DGtal::SimpleMatrix< TComponent, TM, TN >::operator*= | ( | const Component & | aScalar | ) |
Product between the matrix 'this' and a scalar
aScalar | the scalar coefficient |
Self DGtal::SimpleMatrix< TComponent, TM, TN >::operator+ | ( | const Self & | aMatrix | ) | const |
Addition between the matrix 'this' and aMatrix.
aMatrix | the matrix to add to self. |
Self& DGtal::SimpleMatrix< TComponent, TM, TN >::operator+= | ( | const Self & | aMatrix | ) |
Addition and assignment between the matrix 'this' and aMatrix.
aMatrix | the matrix to add to self. |
Self DGtal::SimpleMatrix< TComponent, TM, TN >::operator- | ( | const Self & | aMatrix | ) | const |
Substract between the matrix 'this' and aMatrix.
aMatrix | the matrix to substract to self. |
Self& DGtal::SimpleMatrix< TComponent, TM, TN >::operator-= | ( | const Self & | aMatrix | ) |
Substract and assignment between the matrix 'this' and aMatrix.
aMatrix | the matrix to substract to self. |
Self DGtal::SimpleMatrix< TComponent, TM, TN >::operator/ | ( | const Component & | aScalar | ) | const |
Division of a matrix by a scalar.
aScalar | the scalar value |
Self& DGtal::SimpleMatrix< TComponent, TM, TN >::operator/= | ( | const Component & | aScalar | ) |
Division of a matrix by a scalar.
aScalar | the scalar value |
|
default |
Default assignment operator.
other | the object to copy. |
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. |
bool DGtal::SimpleMatrix< TComponent, TM, TN >::operator== | ( | const Self & | aMatrix | ) | const |
RowVector DGtal::SimpleMatrix< TComponent, TM, TN >::row | ( | const DGtal::Dimension | i | ) | const |
|
inline |
Get number of rows.
Definition at line 166 of file SimpleMatrix.h.
References DGtal::SimpleMatrix< TComponent, TM, TN >::M.
void DGtal::SimpleMatrix< TComponent, TM, TN >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
void DGtal::SimpleMatrix< TComponent, TM, TN >::setComponent | ( | const DGtal::Dimension | i, |
const DGtal::Dimension | j, | ||
const Component & | aValue | ||
) |
Set a value at position (i,j).
i | row index |
j | column index |
aValue | a component |
Referenced by DGtal::CorrectedNormalCurrentFormula< TRealPoint, TRealVector >::muXYInterpolatedU(), DGtal::functors::TensorVotingFeatureExtraction< TSurfel, TEmbedder >::pushSurfel(), DGtal::functors::SphericalHoughNormalVectorEstimator< TSurfel, TEmbedder >::randomRotation(), testColRow(), testDetCofactor(), and testInverse().
|
inline |
Definition at line 152 of file SimpleMatrix.h.
References DGtal::SimpleMatrix< TComponent, TM, TN >::identity().
SimpleMatrix<Component,TN,TM> DGtal::SimpleMatrix< TComponent, TM, TN >::transpose | ( | ) | const |
Transpose the matrix.
Referenced by DGtal::CorrectedNormalCurrentComputer< TRealPoint, TRealVector >::principalCurvatures(), and DGtal::NormalCycleComputer< TRealPoint, TRealVector >::principalCurvatures().
|
static |
Definition at line 80 of file SimpleMatrix.h.
Referenced by DGtal::SimpleMatrix< TComponent, TM, TN >::rows().
|
private |
Static computation of cofactor coefficients
Definition at line 426 of file SimpleMatrix.h.
|
private |
Matrix values containers.
Definition at line 422 of file SimpleMatrix.h.
|
static |
Definition at line 81 of file SimpleMatrix.h.
Referenced by DGtal::SimpleMatrix< TComponent, TM, TN >::cols().