Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
spat::SquareMatrix< Valtype, nColsAndRows > Class Template Reference

Square matrix with nColumns == nRows. More...

#include <C:/Trend/Development/Trax3/Code/spat/Matrix.h>

Inheritance diagram for spat::SquareMatrix< Valtype, nColsAndRows >:

Public Types

using Basetype = Matrix<Valtype,nColsAndRows,nColsAndRows>
 Utmost base type of this SquareMatrix.
Public Types inherited from spat::Matrix< Valtype, nColsAndRows, nColsAndRows >
typedef Valtype value_type

Public Member Functions

void SetIdentity () noexcept
 Sets the matrix to the identity matrix (i.e. all 1 in diagonal, 0 for everything else).
bool IsIdentity (Valtype epsilon=0) const noexcept
bool IsDiagonal () const noexcept
bool IsSymmetric (Valtype epsilon=0) const noexcept
SquareMatrix & Transpose () noexcept
 Change colums and rows.
SquareMatrix & Invert ()
 Invert matrix so that M*I == Identity.
Valtype Trace () const noexcept
 Trace of the matrix, wich is the sum of all element with same indices.
const Valtype & operator() (unsigned short col, unsigned short row) const noexcept
Valtype & operator() (unsigned short col, unsigned short row) noexcept
Construction
Parameters
matrixConstruct from matrix
elementsCreate from initializer list
 SquareMatrix (const SquareMatrix &)=default
 SquareMatrix (const Basetype &matrix)
 SquareMatrix (Basetype &&matrix) noexcept
 SquareMatrix (const std::initializer_list< Valtype > &elements)
Assignment
Parameters
matrixAssign from matrix
Matrix & operator= (const Matrix &matrix) noexcept
Matrix & operator= (Matrix &&matrix) noexcept
Matrix & operator= (const std::initializer_list< Valtype > &elements) noexcept
Public Member Functions inherited from spat::Matrix< Valtype, nColsAndRows, nColsAndRows >
void SetNull () noexcept
 Sets all elements to 0.
constexpr unsigned short Cols () const noexcept
 Number of columns.
constexpr unsigned short Rows () const noexcept
 Number of rows.
bool IsEqual (const Matrix &matrix, Valtype delta=0) const noexcept
 Test elements for equality up to delta distance.
bool operator== (const Matrix &matrix) const noexcept
 Comparison for equality.
bool operator!= (const Matrix &matrix) const noexcept
 Comparison for inequality.
void operator*= (Valtype skalar) noexcept
 Matrix * Skalar multiplication.
void operator*= (const Matrix< Valtype, nCols, nCols > &matrix)
 Matrix multiplication.
void operator/= (Valtype skalar) noexcept
 Matrix / Skalar division.
void operator+= (const Matrix &matrix) noexcept
 Matrix addition.
void operator-= (const Matrix &matrix) noexcept
 Matrix subtraction.
const Valtype * ptr () const noexcept
 Pointer accessor for direct copying. The memory layout is column-major order.
Matrix< Valtype, nCols-1, nRows-1 > SubMatrix (unsigned short c, unsigned short r) const
 Extracts the submatrix of mat wich results from omitting the row r and collumn c.
 Matrix (const Matrix &matrix)
 Matrix (Matrix &&matrix) noexcept
 Matrix (const std::initializer_list< Valtype > &elements)
Matrix & operator= (const Matrix &matrix) noexcept
Matrix & operator= (Matrix &&matrix) noexcept
Matrix & operator= (const std::initializer_list< Valtype > &elements) noexcept
const Valtype & operator() (unsigned short col, unsigned short row) const noexcept
Valtype & operator() (unsigned short col, unsigned short row) noexcept

Detailed Description

template<typename Valtype, const unsigned short nColsAndRows>
class spat::SquareMatrix< Valtype, nColsAndRows >

Square matrix with nColumns == nRows.

Some special operations like determinant calculation are provided.

Member Function Documentation

◆ IsDiagonal()

template<typename Valtype, const unsigned short nColsAndRows>
bool spat::SquareMatrix< Valtype, nColsAndRows >::IsDiagonal ( ) const
noexcept
Returns
true if the matrix is diagonal.

◆ IsIdentity()

template<typename Valtype, const unsigned short nColsAndRows>
bool spat::SquareMatrix< Valtype, nColsAndRows >::IsIdentity ( Valtype epsilon = 0) const
noexcept
Returns
true if the matrix is the identity matrix.

◆ IsSymmetric()

template<typename Valtype, unsigned short nColsAndRows>
bool spat::SquareMatrix< Valtype, nColsAndRows >::IsSymmetric ( Valtype epsilon = 0) const
inlinenoexcept
Returns
true if the matrix is symmetric, i.e m(i,j) == m(j,i)

◆ Trace()

template<typename Valtype, const unsigned short nColsAndRows>
Valtype spat::SquareMatrix< Valtype, nColsAndRows >::Trace ( ) const
noexcept

Trace of the matrix, wich is the sum of all element with same indices.

Returns
the trace of the matrix

The documentation for this class was generated from the following file:
  • C:/Trend/Development/Trax3/Code/spat/Matrix.h