primatologist-gpl  5.1.2
aims::math::MatrixBase< T > Class Template Reference

Matrix class implementing matrix operations. More...

#include <primatologist/math/matrix.h>

Inheritance diagram for aims::math::MatrixBase< T >:
Collaboration diagram for aims::math::MatrixBase< T >:

Public Member Functions

 MatrixBase (int nrow=1, int ncol=1)
 Standard constructor Allocate a matrix of size nrow x ncol. More...
 
template<typename U >
 MatrixBase (const carto::VolumeRef< U > &volume)
 Copy constructor. More...
 
template<typename U >
 MatrixBase (const std::vector< U > &vector)
 Copy constructor. More...
 
 ~MatrixBase ()
 Destructor. More...
 
template<typename U >
MatrixBase< T > & operator= (const carto::VolumeRef< U > &matrix)
 Assignment operator The content from other is entirely copied. More...
 
template<typename U >
MatrixBase< T > & operator= (const std::vector< U > &vector)
 Assignment operator. More...
 
template<typename U >
 operator MatrixBase< U > () const
 Convertion towards a BaseMatrix of different data type. More...
 
template<typename U >
MatrixBase< T > & operator*= (const MatrixBase< U > &)
 Matrix product. More...
 
MatrixBase< T > & transpose ()
 Matrix transposition. More...
 
MatrixBase< T > & invert ()
 Matrix inversion. More...
 
double trace () const
 Returns the trace of the matrix, i.e. More...
 
int nrow () const
 Number of rows. More...
 
int ncol () const
 Number of columns. More...
 
int size () const
 Number of elements. More...
 

Friends

MatrixBase< T > asMatrix (carto::VolumeRef< T > &)
 Interprets the volume as a matrix. More...
 

Detailed Description

template<typename T>
class aims::math::MatrixBase< T >

Matrix class implementing matrix operations.

Warning
The orientation differs from that of a VolumeRef, where the X direction os horizontal and the Y direction is vertical. Consequently, when writing a matrix (on screen or as an image file), the resulting image will be transposed.

Definition at line 49 of file matrix.h.

Constructor & Destructor Documentation

◆ MatrixBase() [1/3]

template<typename T >
aims::math::MatrixBase< T >::MatrixBase ( int  nrow = 1,
int  ncol = 1 
)

Standard constructor Allocate a matrix of size nrow x ncol.

Definition at line 30 of file matrix_d.h.

◆ MatrixBase() [2/3]

template<typename T >
template<typename U >
aims::math::MatrixBase< T >::MatrixBase ( const carto::VolumeRef< U > &  volume)

Copy constructor.

The other volume X direction allows to access rows and its Y direction accesses columns. The other volume is entirely copied: no data is shared. In order to interpret a volume as a matrix with data sharing, use the asMatrix() utility function.

Definition at line 38 of file matrix_d.h.

◆ MatrixBase() [3/3]

template<typename T >
template<typename U >
aims::math::MatrixBase< T >::MatrixBase ( const std::vector< U > &  vector)

Copy constructor.

Definition at line 45 of file matrix_d.h.

References at().

◆ ~MatrixBase()

template<typename T >
aims::math::MatrixBase< T >::~MatrixBase

Destructor.

Definition at line 53 of file matrix_d.h.

Member Function Documentation

◆ invert()

template<typename T >
MatrixBase< T > & aims::math::MatrixBase< T >::invert

Matrix inversion.

Note
The matrix product of the original and the resulting matrices yields the identity matrix.
Warning
This method performs in place inversion. The object content will be modififed.

Definition at line 175 of file matrix_d.h.

References aims::math::invert().

◆ ncol()

template<typename T >
int aims::math::MatrixBase< T >::ncol

Number of columns.

Definition at line 311 of file matrix_d.h.

Referenced by aims::math::operator*(), aims::math::operator==(), and aims::math::transpose().

◆ nrow()

template<typename T >
int aims::math::MatrixBase< T >::nrow

Number of rows.

Definition at line 305 of file matrix_d.h.

Referenced by aims::math::operator*(), aims::math::operator==(), and aims::math::transpose().

◆ operator MatrixBase< U >()

template<typename T >
template<typename U >
aims::math::MatrixBase< T >::operator MatrixBase< U >

Convertion towards a BaseMatrix of different data type.

Definition at line 118 of file matrix_d.h.

◆ operator*=()

template<typename T >
template<typename U >
MatrixBase< T > & aims::math::MatrixBase< T >::operator*= ( const MatrixBase< U > &  m)

Matrix product.

Note
ths number of columns in the left hand matrix should be the same as the number of rows in the right hand matrix.

Definition at line 129 of file matrix_d.h.

◆ operator=() [1/2]

template<typename T >
template<typename U >
MatrixBase< T > & aims::math::MatrixBase< T >::operator= ( const carto::VolumeRef< U > &  matrix)

Assignment operator The content from other is entirely copied.

No data is shared.

Definition at line 84 of file matrix_d.h.

◆ operator=() [2/2]

template<typename T >
template<typename U >
MatrixBase< T > & aims::math::MatrixBase< T >::operator= ( const std::vector< U > &  vector)

Assignment operator.

Definition at line 95 of file matrix_d.h.

References at().

◆ size()

template<typename T >
int aims::math::MatrixBase< T >::size ( void  ) const

Number of elements.

Definition at line 317 of file matrix_d.h.

◆ trace()

template<typename T >
double aims::math::MatrixBase< T >::trace ( ) const

Returns the trace of the matrix, i.e.

the sum of its diagonal elements.

◆ transpose()

template<typename T >
MatrixBase< T > & aims::math::MatrixBase< T >::transpose

Matrix transposition.

Note
Rows and columns will be inverted.
Warning
This method performs in place transposition. The object content will be modififed.

Definition at line 158 of file matrix_d.h.

References aims::math::transpose().

Friends And Related Function Documentation

◆ asMatrix

template<typename T >
MatrixBase<T> asMatrix ( carto::VolumeRef< T > &  volume)
friend

Interprets the volume as a matrix.

Warning
Data will be shared between the two objects.

Definition at line 341 of file matrix_d.h.


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