#include <matrix.h>
Public Member Functions | |
~TMatrix () | |
Destructor. | |
T & | operator() (uint i, uint j) |
Reference operator. | |
uint | GetN () |
Columns. | |
uint | GetM () |
Rows. | |
T ** | GetAnsiRef () |
Returns the ANSI (C/C++) reference. | |
T | Det () |
Determinant. | |
void | LoadIdentity () |
Loads identity. | |
| |
T ** | _matrix |
Matrix' internal state. | |
uint | _N |
Columns. | |
uint | _M |
Rows. | |
TMatrix (uint N=3, uint M=3, T data=(T) 0) | |
Default constructor. | |
TMatrix (const TMatrix< T > &r) | |
Copy constructor. | |
TMatrix (T **block, uint N, uint M) | |
ANSI casting constructor. | |
TMatrix< T > & | operator= (const TMatrix< T > &r) |
Natural assignation. | |
TMatrix< T > & | operator= (TVector< T > &r) |
Vector assignation. | |
TMatrix< T > & | operator= (T r) |
Scalar assignation. | |
bool | operator== (const TMatrix< T > &r) |
Equality. | |
bool | operator!= (const TMatrix< T > &r) |
Inequality. | |
TMatrix< T > | operator+ (const TMatrix< T > &r) |
Addition. | |
TMatrix< T > | operator- (const TMatrix< T > &r) |
Substraction. | |
TMatrix< T > | operator* (const TMatrix< T > &r) |
Product. | |
TMatrix< T > | operator* (TVector< T > &r) |
Product (vector). | |
TMatrix< T > | operator* (T r) |
Scalar product. | |
TMatrix< T > & | operator+= (const TMatrix< T > &r) |
Addition. | |
TMatrix< T > & | operator-= (const TMatrix< T > &r) |
Substraction. | |
TMatrix< T > & | operator*= (const TMatrix< T > &r) |
Product. | |
TMatrix< T > & | operator*= (TVector< T > &r) |
Product (vector). | |
TMatrix< T > & | operator*= (T r) |
Scalar product. | |
TMatrix< T > | operator- () |
Additive inverse. | |
TMatrix< T > | operator! () |
Matrix inverse. | |
TMatrix< T > | operator~ () |
Matrix transpose. |
TMatrix class.
This class defines a C++ template to use mathematical matrices of NxM.
Definition at line 39 of file matrix.h.
gtm::TMatrix< T >::TMatrix | ( | uint | N = 3 , |
|
uint | M = 3 , |
|||
T | data = ( T )0 | |||
) | [inline] |
Default constructor.
Constructors.
N | Columns. | |
M | Rows. | |
data | Initial data. | |
r | Copy object (matrix or vector). | |
block | Memory block. |
Definition at line 214 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
gtm::TMatrix< T >::TMatrix | ( | const TMatrix< T > & | r | ) | [inline] |
Copy constructor.
Definition at line 225 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
gtm::TMatrix< T >::TMatrix | ( | T ** | block, | |
uint | N, | |||
uint | M | |||
) | [inline] |
ANSI casting constructor.
Definition at line 235 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
gtm::TMatrix< T >::~TMatrix | ( | ) | [inline] |
Destructor.
Definition at line 61 of file matrix.h.
References gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
T gtm::TMatrix< T >::Det | ( | ) | [inline] |
Determinant.
Definition at line 106 of file matrix.h.
References gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
Referenced by UtilVtk3DGeometriSelection::IntersectPlaneWithLine(), and vtk3DSurfaceSTLWidget::IntersectPlaneWithLine().
T** gtm::TMatrix< T >::GetAnsiRef | ( | ) | [inline] |
Returns the ANSI (C/C++) reference.
Definition at line 102 of file matrix.h.
References gtm::TMatrix< T >::_matrix.
00102 { 00103 return( _matrix ); 00104 };
uint gtm::TMatrix< T >::GetM | ( | ) | [inline] |
Rows.
Definition at line 98 of file matrix.h.
References gtm::TMatrix< T >::_M.
Referenced by gtm::TVector< T >::operator=().
00098 { 00099 return( _M ); 00100 };
uint gtm::TMatrix< T >::GetN | ( | ) | [inline] |
Columns.
Definition at line 94 of file matrix.h.
References gtm::TMatrix< T >::_N.
Referenced by gtm::TVector< T >::operator=().
00094 { 00095 return( _N ); 00096 };
void gtm::TMatrix< T >::LoadIdentity | ( | ) | [inline] |
Loads identity.
Definition at line 110 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, gtm::TMatrix< T >::_N, and GTM_MIN.
TMatrix< T > gtm::TMatrix< T >::operator! | ( | ) | [inline] |
Matrix inverse.
Definition at line 406 of file matrix.h.
References gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
bool gtm::TMatrix< T >::operator!= | ( | const TMatrix< T > & | r | ) | [inline] |
Inequality.
Definition at line 307 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
T& gtm::TMatrix< T >::operator() | ( | uint | i, | |
uint | j | |||
) | [inline] |
Reference operator.
Definition at line 90 of file matrix.h.
References gtm::TMatrix< T >::_matrix.
00090 { 00091 return( _matrix[ i ][ j ] ); 00092 };
TMatrix< T > gtm::TMatrix< T >::operator* | ( | T | r | ) | [inline] |
Scalar product.
Definition at line 372 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
TMatrix< T > gtm::TMatrix< T >::operator* | ( | TVector< T > & | r | ) | [inline] |
TMatrix< T > gtm::TMatrix< T >::operator* | ( | const TMatrix< T > & | r | ) | [inline] |
Product.
Definition at line 361 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
TMatrix< T >& gtm::TMatrix< T >::operator*= | ( | T | r | ) | [inline] |
TMatrix< T >& gtm::TMatrix< T >::operator*= | ( | TVector< T > & | r | ) | [inline] |
TMatrix< T >& gtm::TMatrix< T >::operator*= | ( | const TMatrix< T > & | r | ) | [inline] |
TMatrix< T > gtm::TMatrix< T >::operator+ | ( | const TMatrix< T > & | r | ) | [inline] |
Addition.
Binary operators.
r | Right objet (matrix, vector or scalar). |
Definition at line 327 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, gtm::TMatrix< T >::_N, and GTM_MIN.
TMatrix< T >& gtm::TMatrix< T >::operator+= | ( | const TMatrix< T > & | r | ) | [inline] |
TMatrix< T > gtm::TMatrix< T >::operator- | ( | ) | [inline] |
Additive inverse.
Unary operators.
Definition at line 393 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
TMatrix< T > gtm::TMatrix< T >::operator- | ( | const TMatrix< T > & | r | ) | [inline] |
Substraction.
Definition at line 344 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, gtm::TMatrix< T >::_N, and GTM_MIN.
TMatrix< T >& gtm::TMatrix< T >::operator-= | ( | const TMatrix< T > & | r | ) | [inline] |
TMatrix< T > & gtm::TMatrix< T >::operator= | ( | T | r | ) | [inline] |
Scalar assignation.
Definition at line 278 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
TMatrix< T > & gtm::TMatrix< T >::operator= | ( | TVector< T > & | r | ) | [inline] |
Vector assignation.
Definition at line 261 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, gtm::TMatrix< T >::_N, COL_VECTOR, gtm::TVector< T >::GetN(), and gtm::TVector< T >::GetType().
00262 { 00263 uint i; 00264 uint n = r.GetN( ); 00265 bool column = ( r.GetType( ) == COL_VECTOR ); 00266 00267 MatrixFreeMemory< T >( _matrix, _N ); 00268 _N = ( column )? 1: n; 00269 _M = ( column )? n: 1; 00270 _matrix = MatrixAllocateMemory< T >( _N, _M ); 00271 for( i = 0; i < n; _matrix[ ( column )? 0: i ][ ( column )? i: 0 ] = r( i ), i++ ); 00272 return( *this ); 00273 00274 }
TMatrix< T > & gtm::TMatrix< T >::operator= | ( | const TMatrix< T > & | r | ) | [inline] |
Natural assignation.
Assignation operators.
r | Right object (matrix, vector or scalar). |
Definition at line 245 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
00246 { 00247 if( _N != r._N || _M != r._M ) { 00248 00249 MatrixFreeMemory< T >( _matrix, _N ); 00250 _N = r._N; 00251 _M = r._M; 00252 _matrix = MatrixCopyMemory< T >( r._matrix, _N, _M ); 00253 00254 } else MatrixAssignMemory< T >( _matrix, r._matrix, _N, _M ); 00255 return( *this ); 00256 00257 }
bool gtm::TMatrix< T >::operator== | ( | const TMatrix< T > & | r | ) | [inline] |
Equality.
Comparation operators.
Right | matrix. |
Definition at line 287 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
TMatrix< T > gtm::TMatrix< T >::operator~ | ( | ) | [inline] |
Matrix transpose.
Definition at line 418 of file matrix.h.
References gtm::TMatrix< T >::_M, gtm::TMatrix< T >::_matrix, and gtm::TMatrix< T >::_N.
uint gtm::TMatrix< T >::_M [private] |
Rows.
Definition at line 183 of file matrix.h.
Referenced by gtm::TMatrix< T >::GetM(), gtm::TMatrix< T >::LoadIdentity(), gtm::TMatrix< T >::operator!=(), gtm::TMatrix< T >::operator*(), gtm::TMatrix< T >::operator+(), gtm::TMatrix< T >::operator-(), gtm::TMatrix< T >::operator=(), gtm::TMatrix< T >::operator==(), gtm::TMatrix< T >::operator~(), and gtm::TMatrix< T >::TMatrix().
T** gtm::TMatrix< T >::_matrix [private] |
Matrix' internal state.
Memory block.
Definition at line 179 of file matrix.h.
Referenced by gtm::TMatrix< T >::Det(), gtm::TMatrix< T >::GetAnsiRef(), gtm::TMatrix< T >::LoadIdentity(), gtm::TMatrix< T >::operator!(), gtm::TMatrix< T >::operator!=(), gtm::TMatrix< T >::operator()(), gtm::TMatrix< T >::operator*(), gtm::TMatrix< T >::operator+(), gtm::TMatrix< T >::operator-(), gtm::TMatrix< T >::operator=(), gtm::TMatrix< T >::operator==(), gtm::TMatrix< T >::operator~(), gtm::TMatrix< T >::TMatrix(), and gtm::TMatrix< T >::~TMatrix().
uint gtm::TMatrix< T >::_N [private] |
Columns.
Definition at line 181 of file matrix.h.
Referenced by gtm::TMatrix< T >::Det(), gtm::TMatrix< T >::GetN(), gtm::TMatrix< T >::LoadIdentity(), gtm::TMatrix< T >::operator!(), gtm::TMatrix< T >::operator!=(), gtm::TMatrix< T >::operator*(), gtm::TMatrix< T >::operator+(), gtm::TMatrix< T >::operator-(), gtm::TMatrix< T >::operator=(), gtm::TMatrix< T >::operator==(), gtm::TMatrix< T >::operator~(), gtm::TMatrix< T >::TMatrix(), and gtm::TMatrix< T >::~TMatrix().