Itasca C++ Interface
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Related Symbols | List of all members
Matrix< T, SX, SY > Class Template Reference

A template-based matrix class, size fixed at compile time. Defaults to symmetric sized matrix. More...

#include <matrix.h>

Inheritance diagram for Matrix< T, SX, SY >:
VMatrix< double, S > DMatrix< SX, SY > DVMatrix< S >

Public Member Functions

PUSHWARNING Matrix ()
 Default constructor, does nothing and no initialization.
 
POPWARNING constexpr Matrix (const T &t)
 Explicit constructor, initializes all elements to value t.
 
constexpr Matrix (const std::array< std::array< T, SY >, SX > &a)
 
constexpr Matrix (const std::initializer_list< std::initializer_list< T > > l)
 
constexpr Matrix (const Matrix< T, SX, SY > &m)
 Copy constructor.
 
constexpr const Matrix< T, SX, SY > & operator= (const Matrix< T, SX, SY > &m)
 Equality operator.
 
constexpr const T & get (unsigned x, unsigned y) const
 Retrieve value at row x column y. Bounds checking is done in a debug compile.
 
constexpr T & get (unsigned x, unsigned y)
 Retrieve value at row x column y. Bounds checking is done in a debug compile.
 
constexpr const Column operator[] (unsigned y) const
 Array access operator returns a Column helper class, which has it's own [] operator to access a column of the row.
 
constexpr Column operator[] (unsigned y)
 Array access operator returns a Column helper class, which has it's own [] operator to access a column of the row.
 
constexpr const T & operator() (unsigned x, unsigned y) const
 () operator access to get(x,y)
 
constexpr T & operator() (unsigned x, unsigned y)
 () operator access to get(x,y)
 
constexpr UVect2 size () const
 
constexpr const Matrix< T, SX, SY > & operator+= (const Matrix< T, SX, SY > &m)
 In-place matrix addition.
 
constexpr const Matrix< T, SX, SY > & operator-= (const Matrix< T, SX, SY > &m)
 In-place matrix subtraction.
 
constexpr const Matrix< T, SX, SY > & operator*= (const T &t)
 In-place multiplication by a scalar.
 
constexpr const Matrix< T, SX, SY > & operator/= (const T &t)
 In-place division by a scalar.
 
Matrix< T, SX, SY > operator+ (const Matrix< T, SX, SY > &m) const
 Binary addition operator.
 
Matrix< T, SX, SY > operator- (const Matrix< T, SX, SY > &m) const
 Binary subtraction operator.
 
Matrix< T, SX, SY > operator* (const T &t) const
 Binary scalar multiplication operator.
 
Matrix< T, SX, SY > operator/ (const T &t) const
 Binary scalar division operator.
 
template<unsigned SZ>
Matrix< T, SX, SZ > operator* (const Matrix< T, SY, SZ > &m) const
 Binary matrix multiplication operator – simplest naive approach.
 
template<unsigned BX, unsigned BY, unsigned SX2, unsigned SY2>
void addBlock (const Matrix< T, SX2, SY2 > &m, unsigned iSrc, unsigned jSrc, unsigned iDst, unsigned jDst)
 Adds a block to this matrix from matrix m using the block size (BX,BY), from block indices (iSrc,jSrc) to block indices (iDst,jDst)
 
template<unsigned BX, unsigned BY, unsigned SX2, unsigned SY2>
void addGenBlock (const Matrix< T, SX2, SY2 > &m, unsigned iSrc, unsigned jSrc, unsigned iDst, unsigned jDst)
 Adds a block to this matrix from matrix m using the block size (BX,BY), from normal not block indices (iSrc,jSrc) to (iDst,jDst)
 
T maxNorm () const
 Returns the infinity norm of the matrix, or the maximum absolute magnitude of any element.
 
Matrix< T, SY, SX > transpose () const
 Return the transpose of the matrix.
 
T trace () const
 Return the trace of the matrix or the sum of the diagonal components. Works also if the matrix is not square.
 
constexpr void set (const T &t=T())
 Set all entries in the matrix to t.
 
constexpr T minEntry () const
 
constexpr T maxEntry () const
 

Static Public Member Functions

static constexpr Matrix< T, SX, SY > identity ()
 Returns an identity matrix (or as close as you can get if not diagonal).
 

Public Attributes

T t_ [SX][SY]
 

Related Symbols

(Note that these are not member symbols.)

template<class T >
Matrix< T, 3, 3 > outerProduct (const Vector3< T > &v1, const Vector3< T > &v2)
 Creates a 3X3 Matrix from the outer product of two Vector3 types.
 
template<class T >
Matrix< T, 2, 2 > outerProduct (const Vector2< T > &v1, const Vector2< T > &v2)
 Creates a 2X2 Matrix from the outer product of two Vector2 types.
 
template<class T >
constexpr T determinant (const Matrix< T, 3, 3 > &mat)
 Returns the determinant of a 3X3 Matrix.
 
template<class T >
constexpr T determinant (const Matrix< T, 2, 2 > &mat)
 Returns the determinant of a 2X2 Matrix.
 
template<class T >
constexpr Matrix< T, 3, 3 > inverse (const Matrix< T, 3, 3 > &mat)
 Returns the inverse of a 3X3 Matrix.
 
template<class T >
constexpr Matrix< T, 2, 2 > inverse (const Matrix< T, 2, 2 > &mat)
 Returns the inverse of a 2X2 Matrix.
 
template<class T >
constexpr Vector2< T > operator* (const Matrix< T, 2, 2 > &m, const Vector2< T > &v)
 
template<class T >
constexpr Vector3< T > operator* (const Matrix< T, 3, 3 > &m, const Vector3< T > &v)
 
template<class T >
Vector3< T > operator* (const SymMatrix< T, 3 > &m, const Vector3< T > &v)
 

Detailed Description

template<class T, unsigned SX, unsigned SY = SX>
class Matrix< T, SX, SY >

A template-based matrix class, size fixed at compile time. Defaults to symmetric sized matrix.

This primitive template-based matrix class should be used where the matrix size is fixed at compile time. May use m(x,y) to access members, or m[x][y] as well.


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