ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Attributes | List of all members
itk::Matrix< T, NRows, NColumns > Class Template Reference

#include <itkMatrix.h>

+ Inheritance diagram for itk::Matrix< T, NRows, NColumns >:

Public Types

using CompatibleSquareMatrixType = Matrix< T, NColumns, NColumns >
 
using ComponentType = T
 
using InternalMatrixType = vnl_matrix_fixed< T, NRows, NColumns >
 
using Self = Matrix
 
using ValueType = T
 

Public Member Functions

void Fill (const T &value)
 
InternalMatrixTypeGetVnlMatrix ()
 
const InternalMatrixTypeGetVnlMatrix () const
 
 Matrix (const InternalMatrixType &matrix)
 
 Matrix (const vnl_matrix< T > &matrix)
 
bool operator!= (const Self &matrix) const
 
T & operator() (unsigned int row, unsigned int col)
 
const T & operator() (unsigned int row, unsigned int col) const
 
Self operator* (const CompatibleSquareMatrixType &matrix) const
 
CovariantVector< T, NRows > operator* (const CovariantVector< T, NColumns > &covect) const
 
Point< T, NRows > operator* (const Point< T, NColumns > &pnt) const
 
Self operator* (const T &value) const
 
Vector< T, NRows > operator* (const Vector< T, NColumns > &vect) const
 
vnl_matrix< T > operator* (const vnl_matrix< T > &matrix) const
 
template<unsigned int OuterDim>
Matrix< T, NRows, OuterDim > operator* (const vnl_matrix_fixed< T, NRows, OuterDim > &matrix) const
 
vnl_vector< T > operator* (const vnl_vector< T > &vc) const
 
vnl_vector_fixed< T, NRows > operator* (const vnl_vector_fixed< T, NColumns > &inVNLvect) const
 
void operator*= (const CompatibleSquareMatrixType &matrix)
 
void operator*= (const T &value)
 
void operator*= (const vnl_matrix< T > &matrix)
 
Self operator+ (const Self &matrix) const
 
const Selfoperator+= (const Self &matrix)
 
Self operator- (const Self &matrix) const
 
const Selfoperator-= (const Self &matrix)
 
Self operator/ (const T &value) const
 
void operator/= (const T &value)
 
const Selfoperator= (const InternalMatrixType &matrix)
 
const Selfoperator= (const vnl_matrix< T > &matrix)
 
bool operator== (const Self &matrix) const
 
T * operator[] (unsigned int i)
 
const T * operator[] (unsigned int i) const
 
void SetIdentity ()
 

Static Public Attributes

static constexpr unsigned int ColumnDimensions = NColumns
 
static constexpr unsigned int RowDimensions = NRows
 
InternalMatrixType m_Matrix {}
 
vnl_matrix_fixed< T, NColumns, NRows > GetInverse () const
 
vnl_matrix_fixed< T, NColumns, NRows > GetTranspose () const
 
 Matrix ()=default
 
void swap (Self &other)
 

Detailed Description

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
class itk::Matrix< T, NRows, NColumns >

A templated class holding a M x N size Matrix.

This class contains a vnl_matrix_fixed in order to make all the vnl mathematical methods available.

ITK Sphinx Examples:
Examples
Examples/DataRepresentation/Image/Image4.cxx, Examples/DataRepresentation/Mesh/MeshTraits.cxx, SphinxExamples/src/Core/Common/Matrix/Code.cxx, SphinxExamples/src/Core/Common/MatrixInverse/Code.cxx, and SphinxExamples/src/Core/Transform/ApplyAffineTransformFromHomogeneousMatrixAndResample/Code.cxx.

Definition at line 51 of file itkMatrix.h.

Member Typedef Documentation

◆ CompatibleSquareMatrixType

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
using itk::Matrix< T, NRows, NColumns >::CompatibleSquareMatrixType = Matrix<T, NColumns, NColumns>

Compatible square matrix. This is currently used by operator* to help with wrapping.

Todo:
In the future, the method should be templated to allow multiplication by NColumns by XRows.

Definition at line 71 of file itkMatrix.h.

◆ ComponentType

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
using itk::Matrix< T, NRows, NColumns >::ComponentType = T

Definition at line 59 of file itkMatrix.h.

◆ InternalMatrixType

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
using itk::Matrix< T, NRows, NColumns >::InternalMatrixType = vnl_matrix_fixed<T, NRows, NColumns>

Internal matrix type

Definition at line 66 of file itkMatrix.h.

◆ Self

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
using itk::Matrix< T, NRows, NColumns >::Self = Matrix

Standard class type aliases.

Definition at line 55 of file itkMatrix.h.

◆ ValueType

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
using itk::Matrix< T, NRows, NColumns >::ValueType = T

Component value type

Definition at line 58 of file itkMatrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/3]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
itk::Matrix< T, NRows, NColumns >::Matrix ( const vnl_matrix< T > &  matrix)
inline

For every operator=, there should be an equivalent copy constructor.

Definition at line 213 of file itkMatrix.h.

◆ Matrix() [2/3]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
itk::Matrix< T, NRows, NColumns >::Matrix ( const InternalMatrixType matrix)
inlineexplicit

For every operator=, there should be an equivalent copy constructor.

Definition at line 251 of file itkMatrix.h.

◆ Matrix() [3/3]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
itk::Matrix< T, NRows, NColumns >::Matrix ( )
default

Defaulted default-constructor. Zero-initializes all of its elements.

Note
The other five "special member functions" (copy-constructor, copy-assignment operator, move-constructor, move-assignment operator, and destructor) are implicitly defaulted, following the C++ "Rule of Zero".

Member Function Documentation

◆ Fill()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
void itk::Matrix< T, NRows, NColumns >::Fill ( const T &  value)
inline

◆ GetInverse()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
vnl_matrix_fixed<T, NColumns, NRows> itk::Matrix< T, NRows, NColumns >::GetInverse ( ) const
inline

Return the inverse matrix.

Definition at line 257 of file itkMatrix.h.

◆ GetTranspose()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
vnl_matrix_fixed<T, NColumns, NRows> itk::Matrix< T, NRows, NColumns >::GetTranspose ( ) const
inline

Return the transposed matrix.

Definition at line 270 of file itkMatrix.h.

◆ GetVnlMatrix() [1/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
InternalMatrixType& itk::Matrix< T, NRows, NColumns >::GetVnlMatrix ( )
inline

◆ GetVnlMatrix() [2/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
const InternalMatrixType& itk::Matrix< T, NRows, NColumns >::GetVnlMatrix ( ) const
inline

Return the matrix.

Definition at line 185 of file itkMatrix.h.

◆ operator!=()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
bool itk::Matrix< T, NRows, NColumns >::operator!= ( const Self matrix) const
inline

Definition at line 238 of file itkMatrix.h.

◆ operator()() [1/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
T& itk::Matrix< T, NRows, NColumns >::operator() ( unsigned int  row,
unsigned int  col 
)
inline

Return an element of the matrix.

Definition at line 158 of file itkMatrix.h.

◆ operator()() [2/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
const T& itk::Matrix< T, NRows, NColumns >::operator() ( unsigned int  row,
unsigned int  col 
) const
inline

Return an element of the matrix.

Definition at line 165 of file itkMatrix.h.

◆ operator*() [1/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
Self itk::Matrix< T, NRows, NColumns >::operator* ( const CompatibleSquareMatrixType matrix) const

Matrix by Matrix multiplication.

◆ operator*() [2/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
CovariantVector<T, NRows> itk::Matrix< T, NRows, NColumns >::operator* ( const CovariantVector< T, NColumns > &  covect) const

Matrix by CovariantVector multiplication.

◆ operator*() [3/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
Point<T, NRows> itk::Matrix< T, NRows, NColumns >::operator* ( const Point< T, NColumns > &  pnt) const

Matrix by Point multiplication.

◆ operator*() [4/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
Self itk::Matrix< T, NRows, NColumns >::operator* ( const T &  value) const
inline

Matrix by scalar multiplication.

Definition at line 131 of file itkMatrix.h.

◆ operator*() [5/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
Vector<T, NRows> itk::Matrix< T, NRows, NColumns >::operator* ( const Vector< T, NColumns > &  vect) const

Matrix by Vector multiplication.

◆ operator*() [6/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
vnl_matrix<T> itk::Matrix< T, NRows, NColumns >::operator* ( const vnl_matrix< T > &  matrix) const

Matrix by vnl_matrix multiplication.

◆ operator*() [7/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
template<unsigned int OuterDim>
Matrix<T, NRows, OuterDim> itk::Matrix< T, NRows, NColumns >::operator* ( const vnl_matrix_fixed< T, NRows, OuterDim > &  matrix) const
inline

Definition at line 89 of file itkMatrix.h.

◆ operator*() [8/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
vnl_vector<T> itk::Matrix< T, NRows, NColumns >::operator* ( const vnl_vector< T > &  vc) const

Matrix by vnl_vector multiplication.

◆ operator*() [9/9]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
vnl_vector_fixed<T, NRows> itk::Matrix< T, NRows, NColumns >::operator* ( const vnl_vector_fixed< T, NColumns > &  inVNLvect) const

Matrix by vnl_vector_fixed multiplication.

◆ operator*=() [1/3]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
void itk::Matrix< T, NRows, NColumns >::operator*= ( const CompatibleSquareMatrixType matrix)

Matrix by Matrix multiplication.

◆ operator*=() [2/3]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
void itk::Matrix< T, NRows, NColumns >::operator*= ( const T &  value)
inline

Matrix by scalar multiplication.

Definition at line 125 of file itkMatrix.h.

◆ operator*=() [3/3]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
void itk::Matrix< T, NRows, NColumns >::operator*= ( const vnl_matrix< T > &  matrix)

Matrix by vnl_matrix multiplication.

◆ operator+()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
Self itk::Matrix< T, NRows, NColumns >::operator+ ( const Self matrix) const

Matrix addition.

◆ operator+=()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
const Self& itk::Matrix< T, NRows, NColumns >::operator+= ( const Self matrix)

◆ operator-()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
Self itk::Matrix< T, NRows, NColumns >::operator- ( const Self matrix) const

Matrix addition.

◆ operator-=()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
const Self& itk::Matrix< T, NRows, NColumns >::operator-= ( const Self matrix)

◆ operator/()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
Self itk::Matrix< T, NRows, NColumns >::operator/ ( const T &  value) const
inline

Matrix by scalar division.

Definition at line 148 of file itkMatrix.h.

◆ operator/=()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
void itk::Matrix< T, NRows, NColumns >::operator/= ( const T &  value)
inline

Matrix by scalar division.

Definition at line 141 of file itkMatrix.h.

◆ operator=() [1/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
const Self& itk::Matrix< T, NRows, NColumns >::operator= ( const InternalMatrixType matrix)
inline

Definition at line 244 of file itkMatrix.h.

◆ operator=() [2/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
const Self& itk::Matrix< T, NRows, NColumns >::operator= ( const vnl_matrix< T > &  matrix)
inline

Assignment operator.

Definition at line 206 of file itkMatrix.h.

◆ operator==()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
bool itk::Matrix< T, NRows, NColumns >::operator== ( const Self matrix) const
inline

Comparison operators.

Definition at line 219 of file itkMatrix.h.

◆ operator[]() [1/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
T* itk::Matrix< T, NRows, NColumns >::operator[] ( unsigned int  i)
inline

Return a row of the matrix.

Definition at line 171 of file itkMatrix.h.

◆ operator[]() [2/2]

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
const T* itk::Matrix< T, NRows, NColumns >::operator[] ( unsigned int  i) const
inline

Return a row of the matrix.

Definition at line 174 of file itkMatrix.h.

◆ SetIdentity()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
void itk::Matrix< T, NRows, NColumns >::SetIdentity ( )
inline

Set the matrix to identity.

Definition at line 192 of file itkMatrix.h.

Referenced by itk::IOTestHelper::SetIdentityDirection().

◆ swap()

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
void itk::Matrix< T, NRows, NColumns >::swap ( Self other)
inline

Return the inverse matrix.

Definition at line 284 of file itkMatrix.h.

Referenced by itk::swap().

Member Data Documentation

◆ ColumnDimensions

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
constexpr unsigned int itk::Matrix< T, NRows, NColumns >::ColumnDimensions = NColumns
staticconstexpr

Definition at line 63 of file itkMatrix.h.

◆ m_Matrix

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
InternalMatrixType itk::Matrix< T, NRows, NColumns >::m_Matrix {}
private

◆ RowDimensions

template<typename T, unsigned int NRows = 3, unsigned int NColumns = 3>
constexpr unsigned int itk::Matrix< T, NRows, NColumns >::RowDimensions = NRows
staticconstexpr

Number Of Columns and Rows.

Definition at line 62 of file itkMatrix.h.


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