SOFA API  ca70b0f0
Open source framework for multi-physics simuation
sofa::type::Mat< L, C, real > Class Template Reference

#include <Mat.h>

Inheritance diagram for sofa::type::Mat< L, C, real >:

Public Attributes

ArrayLineType elems {}
 

Static Public Attributes

static constexpr sofa::Size N = L * C
 
static constexpr Size nbLines = L
 
static constexpr Size nbCols = C
 
static constexpr sofa::Size static_size = L
 
static constexpr sofa::Size total_size = L
 

Public Member Functions

constexpr Mat () noexcept=default
 
constexpr Mat (NoInit) noexcept
 
template<sofa::Size TL = L, sofa::Size TC = C, typename = std::enable_if_t<(TL == 1 && TC != 1) || (TC == 1 && TL != 1)>>
constexpr Mat (std::initializer_list< Real > &&scalars) noexcept
 
constexpr Mat (std::initializer_list< std::initializer_list< Real >> &&rows) noexcept
 
template<typename... ArgsT, typename = std::enable_if_t< (std::is_convertible_v<ArgsT, Line> && ...) >, typename = std::enable_if_t< (sizeof...(ArgsT) == L && sizeof...(ArgsT) > 1) >>
constexpr Mat (ArgsT &&... r) noexcept
 
constexpr Mat (const real &v) noexcept
 Constructor from an element. More...
 
template<typename real2 >
constexpr Mat (const Mat< L, C, real2 > &m) noexcept
 Constructor from another matrix. More...
 
template<Size L2, Size C2, typename real2 >
constexpr Mat (const Mat< L2, C2, real2 > &m) noexcept
 Constructor from another matrix with different size (with null default entries and ignoring outside entries) More...
 
template<typename real2 >
constexpr Mat (const real2 *p) noexcept
 Constructor from an array of elements (stored per line). More...
 
constexpr Size getNbLines () const
 number of lines More...
 
constexpr Size getNbCols () const
 number of colums More...
 
constexpr void operator= (const real *p) noexcept
 Assignment from an array of elements (stored per line). More...
 
template<typename real2 >
constexpr void operator= (const Mat< L, C, real2 > &m) noexcept
 Assignment from another matrix. More...
 
template<Size L2, Size C2>
constexpr void operator= (const Mat< L2, C2, real > &m) noexcept
 Assignment from a matrix of different size. More...
 
template<Size L2, Size C2>
constexpr void getsub (Size L0, Size C0, Mat< L2, C2, real > &m) const noexcept
 
template<Size C2>
constexpr void getsub (const Size L0, const Size C0, Vec< C2, real > &m) const noexcept
 
constexpr void getsub (Size L0, Size C0, real &m) const noexcept
 
template<Size L2, Size C2>
constexpr void setsub (Size L0, Size C0, const Mat< L2, C2, real > &m) noexcept
 
template<Size L2>
constexpr void setsub (Size L0, Size C0, const Vec< L2, real > &v) noexcept
 
constexpr void clear () noexcept
 Sets each element to 0. More...
 
constexpr void fill (real r) noexcept
 Sets each element to r. More...
 
constexpr const Lineline (Size i) const noexcept
 Read-only access to line i. More...
 
constexpr Col col (Size j) const noexcept
 Copy of column j. More...
 
constexpr LineNoInitoperator[] (Size i) noexcept
 Write acess to line i. More...
 
constexpr const LineNoInitoperator[] (Size i) const noexcept
 Read-only access to line i. More...
 
constexpr LineNoInitoperator() (Size i) noexcept
 Write acess to line i. More...
 
constexpr const LineNoInitoperator() (Size i) const noexcept
 Read-only access to line i. More...
 
constexpr real & operator() (Size i, Size j) noexcept
 Write access to element (i,j). More...
 
constexpr const real & operator() (Size i, Size j) const noexcept
 Read-only access to element (i,j). More...
 
constexpr const Linelptr () const noexcept
 Cast into a standard C array of lines (read-only). More...
 
constexpr Linelptr () noexcept
 Cast into a standard C array of lines. More...
 
constexpr const real * ptr () const noexcept
 Cast into a standard C array of elements (stored per line) (read-only). More...
 
constexpr real * ptr () noexcept
 Cast into a standard C array of elements (stored per line). More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 1>
constexpr Linex () noexcept
 Special access to first line. More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 2>
constexpr Liney () noexcept
 Special access to second line. More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 3>
constexpr Linez () noexcept
 Special access to third line. More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 4>
constexpr Linew () noexcept
 Special access to fourth line. More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 1>
constexpr const Linex () const noexcept
 Special access to first line (read-only). More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 2>
constexpr const Liney () const noexcept
 Special access to second line (read-only). More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 3>
constexpr const Linez () const noexcept
 Special access to thrid line (read-only). More...
 
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 4>
constexpr const Linew () const noexcept
 Special access to fourth line (read-only). More...
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == 1 && NbColumn == 1>>
constexpr real toReal () const
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == 1 && NbColumn == 1>>
constexpr operator real () const
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr void identity () noexcept
 Set matrix to identity. More...
 
constexpr void transpose (const Mat< C, L, real > &m) noexcept
 Set matrix as the transpose of m. More...
 
constexpr Mat< C, L, real > transposed () const noexcept
 Return the transpose of m. More...
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr void transpose () noexcept
 Transpose the square matrix. More...
 
constexpr Mat< L, C, real > operator+ (const Mat< L, C, real > &m) const noexcept
 Matrix addition operator. More...
 
constexpr Mat< L, C, real > operator- (const Mat< L, C, real > &m) const noexcept
 Matrix subtraction operator. More...
 
constexpr Mat< L, C, real > operator- () const noexcept
 Matrix negation operator. More...
 
constexpr Col operator* (const Line &v) const noexcept
 Multiplication operator Matrix * Line. More...
 
constexpr Mat< L, C, real > multDiagonal (const Line &d) const noexcept
 Multiplication with a diagonal Matrix CxC represented as a vector of size C. More...
 
constexpr Line multTranspose (const Col &v) const noexcept
 Multiplication of the transposed Matrix * Column. More...
 
template<Size P>
constexpr Mat< C, P, real > multTranspose (const Mat< L, P, real > &m) const noexcept
 
template<Size P>
constexpr Mat< L, P, real > multTransposed (const Mat< P, C, real > &m) const noexcept
 Multiplication with the transposed of the given matrix operator. More...
 
constexpr Mat< L, C, real > plusTransposed (const Mat< C, L, real > &m) const noexcept
 Addition with the transposed of the given matrix operator. More...
 
constexpr Mat< L, C, real > minusTransposed (const Mat< C, L, real > &m) const noexcept
 Substraction with the transposed of the given matrix operator. More...
 
constexpr Mat< L, C, real > operator* (real f) const noexcept
 Scalar multiplication operator. More...
 
constexpr Mat< L, C, real > operator/ (real f) const
 Scalar division operator. More...
 
constexpr void operator*= (real r) noexcept
 Scalar multiplication assignment operator. More...
 
constexpr void operator/= (real r)
 Scalar division assignment operator. More...
 
constexpr void operator+= (const Mat< L, C, real > &m) noexcept
 Addition assignment operator. More...
 
constexpr void addTransposed (const Mat< C, L, real > &m) noexcept
 Addition of the transposed of m. More...
 
constexpr void subTransposed (const Mat< C, L, real > &m) noexcept
 Substraction of the transposed of m. More...
 
constexpr void operator-= (const Mat< L, C, real > &m) noexcept
 Substraction assignment operator. More...
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr Mat< L, C, real > inverted () const
 invert this More...
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr bool invert (const Mat< L, C, real > &m)
 Invert square matrix m. More...
 
constexpr bool isTransform () const
 
constexpr Vec< C-1, real > transform (const Vec< C-1, real > &v) const noexcept
 Multiplication operator Matrix * Vector considering the matrix as a transformation. More...
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr bool transformInvert (const Mat< L, C, real > &m)
 Invert transformation matrix m. More...
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr void symmetrize () noexcept
 
constexpr const real * data () const noexcept
 
constexpr ArrayLineType::iterator begin () noexcept
 
constexpr ArrayLineType::const_iterator begin () const noexcept
 
constexpr ArrayLineType::iterator end () noexcept
 
constexpr ArrayLineType::const_iterator end () const noexcept
 
constexpr reference front ()
 
constexpr const_reference front () const
 
constexpr reference back ()
 
constexpr const_reference back () const
 
Tests operators
constexpr bool operator== (const Mat< L, C, real > &b) const noexcept
 
constexpr bool operator!= (const Mat< L, C, real > &b) const noexcept
 
bool isSymmetric () const
 
bool isDiagonal () const noexcept
 

Static Public Member Functions

static constexpr sofa::Size size ()
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static const Mat< L, L, real > & Identity () noexcept
 Returns the identity matrix. More...
 
template<Size S>
static bool canSelfTranspose (const Mat< S, S, real > &lhs, const Mat< S, S, real > &rhs) noexcept
 
template<Size I, Size J>
static bool canSelfTranspose (const Mat< I, J, real > &, const Mat< J, I, real > &) noexcept
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static Mat< L, C, real > transformTranslation (const Vec< C-1, real > &t) noexcept
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static Mat< L, C, real > transformScale (real s) noexcept
 
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static Mat< L, C, real > transformScale (const Vec< C-1, real > &s) noexcept
 
template<class Quat >
static Mat< L, C, real > transformRotation (const Quat &q) noexcept
 

Friends

constexpr friend Mat< L, C, real > operator* (real r, const Mat< L, C, real > &m) noexcept
 Scalar matrix multiplication operator. More...
 

Attribute details

◆ elems

template<sofa::Size L, sofa::Size C, class real >
ArrayLineType sofa::type::Mat< L, C, real >::elems {}

◆ N

template<sofa::Size L, sofa::Size C, class real >
constexpr sofa::Size sofa::type::Mat< L, C, real >::N = L * C
staticconstexpr

◆ nbCols

template<sofa::Size L, sofa::Size C, class real >
constexpr Size sofa::type::Mat< L, C, real >::nbCols = C
staticconstexpr

◆ nbLines

template<sofa::Size L, sofa::Size C, class real >
constexpr Size sofa::type::Mat< L, C, real >::nbLines = L
staticconstexpr

◆ static_size

template<sofa::Size L, sofa::Size C, class real >
constexpr sofa::Size sofa::type::Mat< L, C, real >::static_size = L
staticconstexpr

◆ total_size

template<sofa::Size L, sofa::Size C, class real >
constexpr sofa::Size sofa::type::Mat< L, C, real >::total_size = L
staticconstexpr

Constructor details

◆ Mat() [1/9]

template<sofa::Size L, sofa::Size C, class real >
constexpr sofa::type::Mat< L, C, real >::Mat ( )
constexprdefaultnoexcept

◆ Mat() [2/9]

template<sofa::Size L, sofa::Size C, class real >
constexpr sofa::type::Mat< L, C, real >::Mat ( NoInit  )
inlineexplicitconstexprnoexcept

◆ Mat() [3/9]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size TL = L, sofa::Size TC = C, typename = std::enable_if_t<(TL == 1 && TC != 1) || (TC == 1 && TL != 1)>>
constexpr sofa::type::Mat< L, C, real >::Mat ( std::initializer_list< Real > &&  scalars)
inlineconstexprnoexcept

Constructs a 1xC matrix (single-row, multiple columns) or a Lx1 matrix (multiple row, single column) and initializes it from a scalar initializer-list. Allows to build a matrix with the following syntax: sofa::type::Mat<1, 3, int> M {1, 2, 3} or sofa::type::Mat<3, 1, int> M {1, 2, 3} Initializer-list must match matrix column size, otherwise an assert is triggered.

◆ Mat() [4/9]

template<sofa::Size L, sofa::Size C, class real >
constexpr sofa::type::Mat< L, C, real >::Mat ( std::initializer_list< std::initializer_list< Real >> &&  rows)
inlineconstexprnoexcept

Constructs a matrix and initializes it from scalar initializer-lists grouped by row. Allows to build a matrix with the following syntax: sofa::type::Mat<3, 3, int> M {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} Initializer-lists must match matrix size, otherwise an assert is triggered.

◆ Mat() [5/9]

template<sofa::Size L, sofa::Size C, class real >
template<typename... ArgsT, typename = std::enable_if_t< (std::is_convertible_v<ArgsT, Line> && ...) >, typename = std::enable_if_t< (sizeof...(ArgsT) == L && sizeof...(ArgsT) > 1) >>
constexpr sofa::type::Mat< L, C, real >::Mat ( ArgsT &&...  r)
inlineconstexprnoexcept

◆ Mat() [6/9]

template<sofa::Size L, sofa::Size C, class real >
constexpr sofa::type::Mat< L, C, real >::Mat ( const real &  v)
inlineexplicitconstexprnoexcept

Constructor from an element.

◆ Mat() [7/9]

template<sofa::Size L, sofa::Size C, class real >
template<typename real2 >
constexpr sofa::type::Mat< L, C, real >::Mat ( const Mat< L, C, real2 > &  m)
inlineconstexprnoexcept

Constructor from another matrix.

◆ Mat() [8/9]

template<sofa::Size L, sofa::Size C, class real >
template<Size L2, Size C2, typename real2 >
constexpr sofa::type::Mat< L, C, real >::Mat ( const Mat< L2, C2, real2 > &  m)
inlineexplicitconstexprnoexcept

Constructor from another matrix with different size (with null default entries and ignoring outside entries)

◆ Mat() [9/9]

template<sofa::Size L, sofa::Size C, class real >
template<typename real2 >
constexpr sofa::type::Mat< L, C, real >::Mat ( const real2 *  p)
inlineexplicitconstexprnoexcept

Constructor from an array of elements (stored per line).

Function details

◆ addTransposed()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::addTransposed ( const Mat< C, L, real > &  m)
inlineconstexprnoexcept

Addition of the transposed of m.

◆ back() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr reference sofa::type::Mat< L, C, real >::back ( )
inlineconstexpr

◆ back() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr const_reference sofa::type::Mat< L, C, real >::back ( ) const
inlineconstexpr

◆ begin() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr ArrayLineType::const_iterator sofa::type::Mat< L, C, real >::begin ( ) const
inlineconstexprnoexcept

◆ begin() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr ArrayLineType::iterator sofa::type::Mat< L, C, real >::begin ( )
inlineconstexprnoexcept

◆ canSelfTranspose() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<Size I, Size J>
static bool sofa::type::Mat< L, C, real >::canSelfTranspose ( const Mat< I, J, real > &  ,
const Mat< J, I, real > &   
)
inlinestaticnoexcept

◆ canSelfTranspose() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<Size S>
static bool sofa::type::Mat< L, C, real >::canSelfTranspose ( const Mat< S, S, real > &  lhs,
const Mat< S, S, real > &  rhs 
)
inlinestaticnoexcept

◆ clear()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::clear ( )
inlineconstexprnoexcept

Sets each element to 0.

◆ col()

template<sofa::Size L, sofa::Size C, class real >
constexpr Col sofa::type::Mat< L, C, real >::col ( Size  j) const
inlineconstexprnoexcept

Copy of column j.

◆ data()

template<sofa::Size L, sofa::Size C, class real >
constexpr const real* sofa::type::Mat< L, C, real >::data ( ) const
inlineconstexprnoexcept

◆ end() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr ArrayLineType::const_iterator sofa::type::Mat< L, C, real >::end ( ) const
inlineconstexprnoexcept

◆ end() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr ArrayLineType::iterator sofa::type::Mat< L, C, real >::end ( )
inlineconstexprnoexcept

◆ fill()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::fill ( real  r)
inlineconstexprnoexcept

Sets each element to r.

◆ front() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr reference sofa::type::Mat< L, C, real >::front ( )
inlineconstexpr

◆ front() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr const_reference sofa::type::Mat< L, C, real >::front ( ) const
inlineconstexpr

◆ getNbCols()

template<sofa::Size L, sofa::Size C, class real >
constexpr Size sofa::type::Mat< L, C, real >::getNbCols ( ) const
inlineconstexpr

number of colums

◆ getNbLines()

template<sofa::Size L, sofa::Size C, class real >
constexpr Size sofa::type::Mat< L, C, real >::getNbLines ( ) const
inlineconstexpr

number of lines

◆ getsub() [1/3]

template<sofa::Size L, sofa::Size C, class real >
template<Size C2>
constexpr void sofa::type::Mat< L, C, real >::getsub ( const Size  L0,
const Size  C0,
Vec< C2, real > &  m 
) const
inlineconstexprnoexcept

◆ getsub() [2/3]

template<sofa::Size L, sofa::Size C, class real >
template<Size L2, Size C2>
constexpr void sofa::type::Mat< L, C, real >::getsub ( Size  L0,
Size  C0,
Mat< L2, C2, real > &  m 
) const
inlineconstexprnoexcept

◆ getsub() [3/3]

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::getsub ( Size  L0,
Size  C0,
real &  m 
) const
inlineconstexprnoexcept

◆ identity()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr void sofa::type::Mat< L, C, real >::identity ( )
inlineconstexprnoexcept

Set matrix to identity.

◆ Identity()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static const Mat<L,L,real>& sofa::type::Mat< L, C, real >::Identity ( )
inlinestaticnoexcept

Returns the identity matrix.

◆ invert()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr bool sofa::type::Mat< L, C, real >::invert ( const Mat< L, C, real > &  m)
inlineconstexpr

Invert square matrix m.

◆ inverted()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::inverted ( ) const
inlineconstexpr

invert this

◆ isDiagonal()

template<sofa::Size L, sofa::Size C, class real >
bool sofa::type::Mat< L, C, real >::isDiagonal ( ) const
inlinenoexcept

◆ isSymmetric()

template<sofa::Size L, sofa::Size C, class real >
bool sofa::type::Mat< L, C, real >::isSymmetric ( ) const
inline

◆ isTransform()

template<sofa::Size L, sofa::Size C, class real >
constexpr bool sofa::type::Mat< L, C, real >::isTransform ( ) const
inlineconstexpr
Returns
True if and only if the Matrix is a transformation matrix

◆ line()

template<sofa::Size L, sofa::Size C, class real >
constexpr const Line& sofa::type::Mat< L, C, real >::line ( Size  i) const
inlineconstexprnoexcept

Read-only access to line i.

◆ lptr() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr const Line* sofa::type::Mat< L, C, real >::lptr ( ) const
inlineconstexprnoexcept

Cast into a standard C array of lines (read-only).

◆ lptr() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr Line* sofa::type::Mat< L, C, real >::lptr ( )
inlineconstexprnoexcept

Cast into a standard C array of lines.

◆ minusTransposed()

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::minusTransposed ( const Mat< C, L, real > &  m) const
inlineconstexprnoexcept

Substraction with the transposed of the given matrix operator.

Returns
this - mt

◆ multDiagonal()

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::multDiagonal ( const Line d) const
inlineconstexprnoexcept

Multiplication with a diagonal Matrix CxC represented as a vector of size C.

◆ multTranspose() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr Line sofa::type::Mat< L, C, real >::multTranspose ( const Col v) const
inlineconstexprnoexcept

Multiplication of the transposed Matrix * Column.

◆ multTranspose() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<Size P>
constexpr Mat<C,P,real> sofa::type::Mat< L, C, real >::multTranspose ( const Mat< L, P, real > &  m) const
inlineconstexprnoexcept

Transposed Matrix multiplication operator. Result = (*this)^T * m Sizes: [L,C]^T * [L,P] = [C,L] * [L,P] = [C,P]

◆ multTransposed()

template<sofa::Size L, sofa::Size C, class real >
template<Size P>
constexpr Mat<L,P,real> sofa::type::Mat< L, C, real >::multTransposed ( const Mat< P, C, real > &  m) const
inlineconstexprnoexcept

Multiplication with the transposed of the given matrix operator.

Returns
this * mt

◆ operator real()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == 1 && NbColumn == 1>>
constexpr sofa::type::Mat< L, C, real >::operator real ( ) const
inlineconstexpr

◆ operator!=()

template<sofa::Size L, sofa::Size C, class real >
constexpr bool sofa::type::Mat< L, C, real >::operator!= ( const Mat< L, C, real > &  b) const
inlineconstexprnoexcept

◆ operator()() [1/4]

template<sofa::Size L, sofa::Size C, class real >
constexpr const LineNoInit& sofa::type::Mat< L, C, real >::operator() ( Size  i) const
inlineconstexprnoexcept

Read-only access to line i.

◆ operator()() [2/4]

template<sofa::Size L, sofa::Size C, class real >
constexpr LineNoInit& sofa::type::Mat< L, C, real >::operator() ( Size  i)
inlineconstexprnoexcept

Write acess to line i.

◆ operator()() [3/4]

template<sofa::Size L, sofa::Size C, class real >
constexpr const real& sofa::type::Mat< L, C, real >::operator() ( Size  i,
Size  j 
) const
inlineconstexprnoexcept

Read-only access to element (i,j).

◆ operator()() [4/4]

template<sofa::Size L, sofa::Size C, class real >
constexpr real& sofa::type::Mat< L, C, real >::operator() ( Size  i,
Size  j 
)
inlineconstexprnoexcept

Write access to element (i,j).

◆ operator*() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr Col sofa::type::Mat< L, C, real >::operator* ( const Line v) const
inlineconstexprnoexcept

Multiplication operator Matrix * Line.

◆ operator*() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::operator* ( real  f) const
inlineconstexprnoexcept

Scalar multiplication operator.

◆ operator*=()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::operator*= ( real  r)
inlineconstexprnoexcept

Scalar multiplication assignment operator.

◆ operator+()

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::operator+ ( const Mat< L, C, real > &  m) const
inlineconstexprnoexcept

Matrix addition operator.

◆ operator+=()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::operator+= ( const Mat< L, C, real > &  m)
inlineconstexprnoexcept

Addition assignment operator.

◆ operator-() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::operator- ( ) const
inlineconstexprnoexcept

Matrix negation operator.

◆ operator-() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::operator- ( const Mat< L, C, real > &  m) const
inlineconstexprnoexcept

Matrix subtraction operator.

◆ operator-=()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::operator-= ( const Mat< L, C, real > &  m)
inlineconstexprnoexcept

Substraction assignment operator.

◆ operator/()

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::operator/ ( real  f) const
inlineconstexpr

Scalar division operator.

◆ operator/=()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::operator/= ( real  r)
inlineconstexpr

Scalar division assignment operator.

◆ operator=() [1/3]

template<sofa::Size L, sofa::Size C, class real >
template<typename real2 >
constexpr void sofa::type::Mat< L, C, real >::operator= ( const Mat< L, C, real2 > &  m)
inlineconstexprnoexcept

Assignment from another matrix.

◆ operator=() [2/3]

template<sofa::Size L, sofa::Size C, class real >
template<Size L2, Size C2>
constexpr void sofa::type::Mat< L, C, real >::operator= ( const Mat< L2, C2, real > &  m)
inlineconstexprnoexcept

Assignment from a matrix of different size.

◆ operator=() [3/3]

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::operator= ( const real *  p)
inlineconstexprnoexcept

Assignment from an array of elements (stored per line).

◆ operator==()

template<sofa::Size L, sofa::Size C, class real >
constexpr bool sofa::type::Mat< L, C, real >::operator== ( const Mat< L, C, real > &  b) const
inlineconstexprnoexcept

◆ operator[]() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr const LineNoInit& sofa::type::Mat< L, C, real >::operator[] ( Size  i) const
inlineconstexprnoexcept

Read-only access to line i.

◆ operator[]() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr LineNoInit& sofa::type::Mat< L, C, real >::operator[] ( Size  i)
inlineconstexprnoexcept

Write acess to line i.

◆ plusTransposed()

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<L,C,real> sofa::type::Mat< L, C, real >::plusTransposed ( const Mat< C, L, real > &  m) const
inlineconstexprnoexcept

Addition with the transposed of the given matrix operator.

Returns
this + mt

◆ ptr() [1/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr const real* sofa::type::Mat< L, C, real >::ptr ( ) const
inlineconstexprnoexcept

Cast into a standard C array of elements (stored per line) (read-only).

◆ ptr() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr real* sofa::type::Mat< L, C, real >::ptr ( )
inlineconstexprnoexcept

Cast into a standard C array of elements (stored per line).

◆ setsub() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<Size L2, Size C2>
constexpr void sofa::type::Mat< L, C, real >::setsub ( Size  L0,
Size  C0,
const Mat< L2, C2, real > &  m 
)
inlineconstexprnoexcept

◆ setsub() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<Size L2>
constexpr void sofa::type::Mat< L, C, real >::setsub ( Size  L0,
Size  C0,
const Vec< L2, real > &  v 
)
inlineconstexprnoexcept

◆ size()

template<sofa::Size L, sofa::Size C, class real >
static constexpr sofa::Size sofa::type::Mat< L, C, real >::size ( void  )
inlinestaticconstexpr

◆ subTransposed()

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::subTransposed ( const Mat< C, L, real > &  m)
inlineconstexprnoexcept

Substraction of the transposed of m.

◆ symmetrize()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr void sofa::type::Mat< L, C, real >::symmetrize ( )
inlineconstexprnoexcept

for square matrices

Warning
in-place simple symmetrization this = ( this + this.transposed() ) / 2.0

◆ toReal()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == 1 && NbColumn == 1>>
constexpr real sofa::type::Mat< L, C, real >::toReal ( ) const
inlineconstexpr

◆ transform()

template<sofa::Size L, sofa::Size C, class real >
constexpr Vec<C-1,real> sofa::type::Mat< L, C, real >::transform ( const Vec< C-1, real > &  v) const
inlineconstexprnoexcept

Multiplication operator Matrix * Vector considering the matrix as a transformation.

◆ transformInvert()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr bool sofa::type::Mat< L, C, real >::transformInvert ( const Mat< L, C, real > &  m)
inlineconstexpr

Invert transformation matrix m.

◆ transformRotation()

template<sofa::Size L, sofa::Size C, class real >
template<class Quat >
static Mat<L,C,real> sofa::type::Mat< L, C, real >::transformRotation ( const Quat q)
inlinestaticnoexcept

◆ transformScale() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static Mat<L,C,real> sofa::type::Mat< L, C, real >::transformScale ( const Vec< C-1, real > &  s)
inlinestaticnoexcept

◆ transformScale() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static Mat<L,C,real> sofa::type::Mat< L, C, real >::transformScale ( real  s)
inlinestaticnoexcept

◆ transformTranslation()

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
static Mat<L,C,real> sofa::type::Mat< L, C, real >::transformTranslation ( const Vec< C-1, real > &  t)
inlinestaticnoexcept

◆ transpose() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, sofa::Size NbColumn = C, typename = std::enable_if_t<NbLine == NbColumn>>
constexpr void sofa::type::Mat< L, C, real >::transpose ( )
inlineconstexprnoexcept

Transpose the square matrix.

◆ transpose() [2/2]

template<sofa::Size L, sofa::Size C, class real >
constexpr void sofa::type::Mat< L, C, real >::transpose ( const Mat< C, L, real > &  m)
inlineconstexprnoexcept

Set matrix as the transpose of m.

◆ transposed()

template<sofa::Size L, sofa::Size C, class real >
constexpr Mat<C,L,real> sofa::type::Mat< L, C, real >::transposed ( ) const
inlineconstexprnoexcept

Return the transpose of m.

◆ w() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 4>
constexpr const Line& sofa::type::Mat< L, C, real >::w ( ) const
inlineconstexprnoexcept

Special access to fourth line (read-only).

◆ w() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 4>
constexpr Line& sofa::type::Mat< L, C, real >::w ( )
inlineconstexprnoexcept

Special access to fourth line.

◆ x() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 1>
constexpr const Line& sofa::type::Mat< L, C, real >::x ( ) const
inlineconstexprnoexcept

Special access to first line (read-only).

◆ x() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 1>
constexpr Line& sofa::type::Mat< L, C, real >::x ( )
inlineconstexprnoexcept

Special access to first line.

◆ y() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 2>
constexpr const Line& sofa::type::Mat< L, C, real >::y ( ) const
inlineconstexprnoexcept

Special access to second line (read-only).

◆ y() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 2>
constexpr Line& sofa::type::Mat< L, C, real >::y ( )
inlineconstexprnoexcept

Special access to second line.

◆ z() [1/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 3>
constexpr const Line& sofa::type::Mat< L, C, real >::z ( ) const
inlineconstexprnoexcept

Special access to thrid line (read-only).

◆ z() [2/2]

template<sofa::Size L, sofa::Size C, class real >
template<sofa::Size NbLine = L, typename = std::enable_if_t<NbLine >= 3>
constexpr Line& sofa::type::Mat< L, C, real >::z ( )
inlineconstexprnoexcept

Special access to third line.

Related details

◆ operator*

template<sofa::Size L, sofa::Size C, class real >
constexpr friend Mat<L,C,real> operator* ( real  r,
const Mat< L, C, real > &  m 
)
friend

Scalar matrix multiplication operator.