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

A template-based symmetric matrix class, size fixed at compile time. This primitive template-based matrix class should be used where the matrix size is fixed at compile time. More...

#include <matrix.h>

Public Member Functions

 SymMatrix ()
 Default constructor, does nothing and no initialization.
 
 SymMatrix (const T &t)
 Explicit constructor, initializes all elements to value t.
 
 SymMatrix (const SymMatrix< T, SX > &m)
 Copy constructor.
 
const SymMatrix< T, SX > & operator= (const SymMatrix< T, SX > &m)
 Equality operator.
 
const T & get (unsigned x, unsigned y) const
 Retrieve value at row x column y. Bounds checking is done in a debug compile.
 
T & get (unsigned x, unsigned y)
 Retrieve value at row x column y. Bounds checking is done in a debug compile.
 
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.
 
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.
 
const T & operator() (unsigned x, unsigned y) const
 () operator access to get(x,y)
 
T & operator() (unsigned x, unsigned y)
 () operator access to get(x,y)
 
constexpr UVect2 size () const
 
const SymMatrix< T, SX > & operator+= (const SymMatrix< T, SX > &m)
 In-place matrix addition.
 
const SymMatrix< T, SX > & operator-= (const SymMatrix< T, SX > &m)
 In-place matrix subtraction.
 
const SymMatrix< T, SX > & operator*= (const T &t)
 In-place multiplication by a scalar.
 
const SymMatrix< T, SX > & operator/= (const T &t)
 In-place division by a scalar.
 
SymMatrix< T, SX > operator+ (const SymMatrix< T, SX > &m) const
 Binary addition operator for a symetric matris.
 
Matrix< T, SX, SX > operator+ (const Matrix< T, SX, SX > &m) const
 Binary addition operator.
 
SymMatrix< T, SX > operator- (const SymMatrix< T, SX > &m) const
 Binary subtraction operator for a symetric matrix.
 
Matrix< T, SX, SX > operator- (const Matrix< T, SX, SX > &m) const
 Binary subtraction operator.
 
SymMatrix< T, SX > operator* (const T &t) const
 Binary scalar multiplication operator for a symetric matrix.
 
SymMatrix< T, SX > operator/ (const T &t) const
 Binary scalar division operator for a symetric matrix.
 
Matrix< T, SX, SX > operator* (const SymMatrix< T, SX > &m) const
 Binary matrix multiplication operator – simplest naive approach.
 
template<unsigned SZ>
Matrix< T, SX, SZ > operator* (const Matrix< T, SX, 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>
void addBlock (const SymMatrix< T, SX2 > &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)
 
template<unsigned BX, unsigned BY, unsigned SX2>
void addGenBlock (const SymMatrix< T, SX2 > &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)
 
maxNorm () const
 Returns the infinity norm of the matrix, or the maximum absolute magnitude of any element.
 
SymMatrix< T, SX > transpose () const
 Return the transpose of the matrix.
 
trace () const
 Return the trace of the matrix or the sum of the diagonal components. Works also if the matrix is not square.
 
void set (const T &t=T())
 Sets all matrix elements to t.
 
constexpr T minEntry () const
 
constexpr T maxEntry () const
 
Matrix< T, SX, SX > toMatrix () const
 Returns its copy.
 

Static Public Member Functions

static SymMatrix< T, SX > identity ()
 Returns an identity matrix (or as close as you can get if not diagonal).
 
static SymMatrix< T, SX > fromMatrix (const Matrix< T, SX, SX > &m)
 Assign from full matrix.
 
static constexpr unsigned index (unsigned x, unsigned y)
 

Public Attributes

t_ [len_]
 

Static Public Attributes

static constexpr unsigned len_ = (SX*SX + SX) / 2
 
static constexpr unsigned indexConst_ = 1 + 2*SX
 

Related Symbols

(Note that these are not member symbols.)

template<class T >
constexpr Vector2< T > operator* (const SymMatrix< T, 2 > &m, const Vector2< T > &v)
 

Detailed Description

template<class T, unsigned SX>
class SymMatrix< T, SX >

A template-based symmetric matrix class, size fixed at compile time. This primitive template-based matrix class should be used where the matrix size is fixed at compile time.


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