ITK  6.0.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
itk::Matrix< T, VRows, VColumns > Class Template Reference

#include <itkMatrix.h>

Detailed Description

template<typename T, unsigned int VRows = 3, unsigned int VColumns = 3>
class itk::Matrix< T, VRows, VColumns >

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:
  • <a href=
  • <a href=
  • <a href=

Definition at line 52 of file itkMatrix.h.

Public Types

using CompatibleSquareMatrixType = Matrix< T, VColumns, VColumns >
 
using ComponentType = T
 
using const_iterator = const ValueType *
 
using const_pointer = const ValueType *
 
using const_reference = const ValueType &
 
using InternalMatrixType = vnl_matrix_fixed< T, VRows, VColumns >
 
using iterator = ValueType *
 
using pointer = ValueType *
 
using reference = ValueType &
 
using Self = Matrix
 
using ValueType = T
 

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
iterator end ()
 
const_iterator end () const
 
void Fill (const T &value)
 
InternalMatrixTypeGetVnlMatrix ()
 
const InternalMatrixTypeGetVnlMatrix () const
 
 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (Self)
 
 Matrix ()=default
 
 Matrix (const InternalMatrixType &matrix)
 
template<typename TElement >
 Matrix (const TElement(&elements)[VRows][VColumns])
 
 Matrix (const vnl_matrix< T > &matrix)
 
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, VRows > operator* (const CovariantVector< T, VColumns > &covect) const
 
Point< T, VRows > operator* (const Point< T, VColumns > &pnt) const
 
Self operator* (const T &value) const
 
Vector< T, VRows > operator* (const Vector< T, VColumns > &vect) const
 
vnl_matrix< T > operator* (const vnl_matrix< T > &matrix) const
 
template<unsigned int OuterDim>
Matrix< T, VRows, OuterDim > operator* (const vnl_matrix_fixed< T, VRows, OuterDim > &matrix) const
 
vnl_vector< T > operator* (const vnl_vector< T > &vc) const
 
vnl_vector_fixed< T, VRows > operator* (const vnl_vector_fixed< T, VColumns > &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)
 
Selfoperator= (const InternalMatrixType &matrix)
 
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 PrintSelf (std::ostream &os, Indent indent) const
 
void SetIdentity ()
 
constexpr unsigned int size () const
 
void swap (Self &other)
 
vnl_matrix_fixed< T, VColumns, VRows > GetInverse () const
 
vnl_matrix_fixed< T, VColumns, VRows > GetTranspose () const
 

Static Public Member Functions

static Self GetIdentity ()
 

Static Public Attributes

static constexpr unsigned int ColumnDimensions = VColumns
 
static constexpr unsigned int RowDimensions = VRows
 

Private Attributes

InternalMatrixType m_Matrix {}
 

Member Typedef Documentation

◆ CompatibleSquareMatrixType

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::CompatibleSquareMatrixType = Matrix<T, VColumns, VColumns>

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 VColumns by XRows.

Definition at line 90 of file itkMatrix.h.

◆ ComponentType

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::ComponentType = T

Definition at line 60 of file itkMatrix.h.

◆ const_iterator

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::const_iterator = const ValueType *

The return type of cbegin() and cend(), and the const overloads of begin() and end().

Definition at line 78 of file itkMatrix.h.

◆ const_pointer

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::const_pointer = const ValueType *

A const pointer to the ValueType.

Definition at line 66 of file itkMatrix.h.

◆ const_reference

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::const_reference = const ValueType &

A const reference to the ValueType.

Definition at line 72 of file itkMatrix.h.

◆ InternalMatrixType

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

Internal matrix type

Definition at line 85 of file itkMatrix.h.

◆ iterator

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::iterator = ValueType *

The return type of the non-const overloads of begin() and end().

Definition at line 75 of file itkMatrix.h.

◆ pointer

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::pointer = ValueType *

A pointer to the ValueType.

Definition at line 63 of file itkMatrix.h.

◆ reference

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::reference = ValueType &

A reference to the ValueType.

Definition at line 69 of file itkMatrix.h.

◆ Self

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::Self = Matrix

Standard class type aliases.

Definition at line 56 of file itkMatrix.h.

◆ ValueType

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
using itk::Matrix< T, VRows, VColumns >::ValueType = T

Component value type

Definition at line 59 of file itkMatrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/4]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
itk::Matrix< T, VRows, VColumns >::Matrix ( const vnl_matrix< T > &  matrix)
inlineexplicit

Explicit constructor. Copies the elements from the specified vnl_matrix (assuming it has the same dimensions).

Definition at line 243 of file itkMatrix.h.

◆ Matrix() [2/4]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
template<typename TElement >
itk::Matrix< T, VRows, VColumns >::Matrix ( const TElement(&)  elements[VRows][VColumns])
inlineexplicit

Explicit constructor template. Copies the elements from the specified C-style array of rows.

Note
It might have been clearer to just declare a Matrix(const T (&)[VRows][VColumns]) constructor, but SWIG did not like that, saying: "Wrapping/Typedefs/itkMatrix.i:76: Error: Syntax error in input(3)."

Definition at line 252 of file itkMatrix.h.

◆ Matrix() [3/4]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
itk::Matrix< T, VRows, VColumns >::Matrix ( const InternalMatrixType matrix)
inline

Converting constructor (implicit).

Definition at line 290 of file itkMatrix.h.

◆ Matrix() [4/4]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
itk::Matrix< T, VRows, VColumns >::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

◆ begin() [1/2]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
iterator itk::Matrix< T, VRows, VColumns >::begin ( )
inline

Returns an iterator to the first element.

Definition at line 331 of file itkMatrix.h.

◆ begin() [2/2]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
const_iterator itk::Matrix< T, VRows, VColumns >::begin ( ) const
inline

Returns a const iterator to the first element.

Definition at line 345 of file itkMatrix.h.

◆ cbegin()

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
const_iterator itk::Matrix< T, VRows, VColumns >::cbegin ( ) const
inline

Returns a const iterator to the first element.

Definition at line 359 of file itkMatrix.h.

◆ cend()

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
const_iterator itk::Matrix< T, VRows, VColumns >::cend ( ) const
inline

Returns a const iterator just beyond the last element.

Definition at line 366 of file itkMatrix.h.

◆ end() [1/2]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
iterator itk::Matrix< T, VRows, VColumns >::end ( )
inline

Returns an iterator just beyond the last element.

Definition at line 338 of file itkMatrix.h.

◆ end() [2/2]

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
const_iterator itk::Matrix< T, VRows, VColumns >::end ( ) const
inline

Returns a const iterator just beyond the last element.

Definition at line 352 of file itkMatrix.h.

◆ Fill()

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

Fill the matrix with a value.

Definition at line 228 of file itkMatrix.h.

◆ GetIdentity()

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
static Self itk::Matrix< T, VRows, VColumns >::GetIdentity ( )
inlinestatic

Get an identity matrix.

Definition at line 218 of file itkMatrix.h.

◆ GetInverse()

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

Return the inverse matrix.

Definition at line 296 of file itkMatrix.h.

◆ GetTranspose()

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

Return the transposed matrix.

Definition at line 309 of file itkMatrix.h.

◆ GetVnlMatrix() [1/2]

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

Return the matrix.

Definition at line 197 of file itkMatrix.h.

Referenced by itk::detail::GetPointerToMatrixData(), and itk::operator<<().

◆ GetVnlMatrix() [2/2]

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

Return the matrix.

Definition at line 204 of file itkMatrix.h.

◆ ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION()

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
itk::Matrix< T, VRows, VColumns >::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION ( Self  )

◆ operator()() [1/2]

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

Return an element of the matrix.

Definition at line 177 of file itkMatrix.h.

◆ operator()() [2/2]

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

Return an element of the matrix.

Definition at line 184 of file itkMatrix.h.

◆ operator*() [1/9]

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

Matrix by Matrix multiplication.

◆ operator*() [2/9]

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

Matrix by CovariantVector multiplication.

◆ operator*() [3/9]

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

Matrix by Point multiplication.

◆ operator*() [4/9]

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

Matrix by scalar multiplication.

Definition at line 150 of file itkMatrix.h.

◆ operator*() [5/9]

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

Matrix by Vector multiplication.

◆ operator*() [6/9]

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

Matrix by vnl_matrix multiplication.

◆ operator*() [7/9]

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

Definition at line 108 of file itkMatrix.h.

◆ operator*() [8/9]

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

Matrix by vnl_vector multiplication.

◆ operator*() [9/9]

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

Matrix by vnl_vector_fixed multiplication.

◆ operator*=() [1/3]

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

Matrix by Matrix multiplication.

◆ operator*=() [2/3]

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

Matrix by scalar multiplication.

Definition at line 144 of file itkMatrix.h.

◆ operator*=() [3/3]

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

Matrix by vnl_matrix multiplication.

◆ operator+()

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

Matrix addition.

◆ operator+=()

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

◆ operator-()

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

Matrix addition.

◆ operator-=()

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

◆ operator/()

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

Matrix by scalar division.

Definition at line 167 of file itkMatrix.h.

◆ operator/=()

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

Matrix by scalar division.

Definition at line 160 of file itkMatrix.h.

◆ operator=() [1/2]

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

Definition at line 283 of file itkMatrix.h.

◆ operator=() [2/2]

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

Assignment operator.

Definition at line 235 of file itkMatrix.h.

◆ operator==()

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

Comparison operators.

Definition at line 261 of file itkMatrix.h.

References itk::Matrix< T, VRows, VColumns >::m_Matrix, and itk::Math::NotExactlyEquals().

◆ operator[]() [1/2]

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

Return a row of the matrix.

Definition at line 190 of file itkMatrix.h.

◆ operator[]() [2/2]

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

Return a row of the matrix.

Definition at line 193 of file itkMatrix.h.

◆ PrintSelf()

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
void itk::Matrix< T, VRows, VColumns >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
inline

Definition at line 380 of file itkMatrix.h.

◆ SetIdentity()

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

Set the matrix to identity.

Definition at line 211 of file itkMatrix.h.

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

◆ size()

template<typename T , unsigned int VRows = 3, unsigned int VColumns = 3>
constexpr unsigned int itk::Matrix< T, VRows, VColumns >::size ( ) const
inlineconstexpr

Returns the number of elements.

Definition at line 324 of file itkMatrix.h.

◆ swap()

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

Definition at line 372 of file itkMatrix.h.

References itk::Matrix< T, VRows, VColumns >::m_Matrix, and itk::swap().

Referenced by itk::swap().

Member Data Documentation

◆ ColumnDimensions

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

Definition at line 82 of file itkMatrix.h.

◆ m_Matrix

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

◆ RowDimensions

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

Number Of Columns and Rows.

Definition at line 81 of file itkMatrix.h.


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