Simbody  3.7
SimTK::Mat< M, N, ELT, CS, RS > Class Template Reference

This class represents a small matrix whose size is known at compile time, containing elements of any Composite Numerical Type (CNT) and engineered to have no runtime overhead whatsoever. More...

+ Inheritance diagram for SimTK::Mat< M, N, ELT, CS, RS >:

Classes

struct  EltResult
 
struct  Result
 
struct  SubMat
 
struct  Substitute
 

Public Types

enum  {
  NRows = M,
  NCols = N,
  MinDim,
  RowSpacing = RS,
  ColSpacing = CS,
  NPackedElements = M * N,
  NActualElements = (N-1)*CS + (M-1)*RS + 1,
  NActualScalars = CNT<E>::NActualScalars * NActualElements,
  ImagOffset = NTraits<ENumber>::ImagOffset,
  RealStrideFactor = 1,
  ArgDepth,
  IsScalar = 0,
  IsULessScalar = 0,
  IsNumber = 0,
  IsStdNumber = 0,
  IsPrecision = 0,
  SignInterpretation = CNT<E>::SignInterpretation
}
 Every Composite Numerical Type (CNT) must define these values. More...
 
typedef ELT E
 
typedef CNT< E >::TNeg ENeg
 
typedef CNT< E >::TWithoutNegator EWithoutNegator
 
typedef CNT< E >::TReal EReal
 
typedef CNT< E >::TImag EImag
 
typedef CNT< E >::TComplex EComplex
 
typedef CNT< E >::THerm EHerm
 
typedef CNT< E >::TPosTrans EPosTrans
 
typedef CNT< E >::TSqHermT ESqHermT
 
typedef CNT< E >::TSqTHerm ESqTHerm
 
typedef CNT< E >::TSqrt ESqrt
 
typedef CNT< E >::TAbs EAbs
 
typedef CNT< E >::TStandard EStandard
 
typedef CNT< E >::TInvert EInvert
 
typedef CNT< E >::TNormalize ENormalize
 
typedef CNT< E >::Scalar EScalar
 
typedef CNT< E >::ULessScalar EULessScalar
 
typedef CNT< E >::Number ENumber
 
typedef CNT< E >::StdNumber EStdNumber
 
typedef CNT< E >::Precision EPrecision
 
typedef CNT< E >::ScalarNormSq EScalarNormSq
 
typedef Mat< M, N, E, CS, RS > T
 
typedef Mat< M, N, ENeg, CS, RS > TNeg
 
typedef Mat< M, N, EWithoutNegator, CS, RS > TWithoutNegator
 
typedef Mat< M, N, EReal, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactorTReal
 
typedef Mat< M, N, EImag, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactorTImag
 
typedef Mat< M, N, EComplex, CS, RS > TComplex
 
typedef Mat< N, M, EHerm, RS, CS > THerm
 
typedef Mat< N, M, E, RS, CS > TPosTrans
 
typedef E TElement
 
typedef Row< N, E, CS > TRow
 
typedef Vec< M, E, RS > TCol
 
typedef Vec< MinDim, E, RS+CS > TDiag
 
typedef Mat< M, N, ESqrt, M, 1 > TSqrt
 
typedef Mat< M, N, EAbs, M, 1 > TAbs
 
typedef Mat< M, N, EStandard, M, 1 > TStandard
 
typedef Mat< N, M, EInvert, N, 1 > TInvert
 
typedef Mat< M, N, ENormalize, M, 1 > TNormalize
 
typedef SymMat< N, ESqHermTTSqHermT
 
typedef SymMat< M, ESqTHermTSqTHerm
 
typedef Mat< M, N, E, M, 1 > TPacked
 
typedef Mat< M-1, N, E, M-1, 1 > TDropRow
 
typedef Mat< M, N-1, E, M, 1 > TDropCol
 
typedef Mat< M-1, N-1, E, M-1, 1 > TDropRowCol
 
typedef Mat< M+1, N, E, M+1, 1 > TAppendRow
 
typedef Mat< M, N+1, E, M, 1 > TAppendCol
 
typedef Mat< M+1, N+1, E, M+1, 1 > TAppendRowCol
 
typedef EScalar Scalar
 
typedef EULessScalar ULessScalar
 
typedef ENumber Number
 
typedef EStdNumber StdNumber
 
typedef EPrecision Precision
 
typedef EScalarNormSq ScalarNormSq
 
typedef THerm TransposeType
 

Public Member Functions

ScalarNormSq scalarNormSqr () const
 Scalar norm square is the sum of squares of all the scalars that comprise the value of this Mat. More...
 
TSqrt sqrt () const
 Elementwise square root; that is, the return value has the same dimensions as this Mat but with each element replaced by whatever it thinks its square root is. More...
 
TAbs abs () const
 Elementwise absolute value; that is, the return value has the same dimensions as this Mat but with each element replaced by whatever it thinks its absolute value is. More...
 
TStandard standardize () const
 
 Mat ()
 Default construction initializes to NaN when debugging but is left uninitialized otherwise to ensure that there is no overhead. More...
 
 Mat (const Mat &src)
 Copy constructor copies only the elements that are present and does not touch any unused memory space between them if they are not packed. More...
 
Matoperator= (const Mat &src)
 Copy assignment copies only the elements that are present and does not touch any unused memory space between them if they are not packed. More...
 
 Mat (const SymMat< M, ELT > &src)
 Explicit construction of a Mat from a SymMat (symmetric/Hermitian matrix). More...
 
template<int CSS, int RSS>
 Mat (const Mat< M, N, E, CSS, RSS > &src)
 This provides an implicit conversion from a Mat of the same dimensions and element type but with different element spacing. More...
 
template<int CSS, int RSS>
 Mat (const Mat< M, N, ENeg, CSS, RSS > &src)
 This provides an implicit conversion from a Mat of the same dimensions and negated element type, possibly with different element spacing. More...
 
template<class EE , int CSS, int RSS>
 Mat (const Mat< M, N, EE, CSS, RSS > &mm)
 Explicit construction of a Mat from a source Mat of the same dimensions and an assignment-compatible element type, with any element spacing allowed. More...
 
 Mat (const E &e)
 Explicit construction from a single element e of this Mat's element type E sets all the main diagonal elements to e but sets the rest of the elements to zero. More...
 
 Mat (const ENeg &e)
 Explicit construction from a single element e whose type is negator<E> (abbreviated ENeg here) where E is this Mat's element type sets all the main diagonal elements to e but sets the rest of the elements to zero. More...
 
 Mat (int i)
 Explicit construction from an int value means we convert the int into an object of this Mat's element type E, and then apply the single-element constructor above which sets the Mat to zero except for its main diagonal elements which will all be set to the given value. More...
 
 Mat (const E &e0, const E &e1)
 
 Mat (const E &e0, const E &e1, const E &e2)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12, const E &e13)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12, const E &e13, const E &e14)
 
 Mat (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12, const E &e13, const E &e14, const E &e15)
 
 Mat (const TRow &r0)
 
 Mat (const TRow &r0, const TRow &r1)
 
 Mat (const TRow &r0, const TRow &r1, const TRow &r2)
 
 Mat (const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3)
 
 Mat (const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4)
 
 Mat (const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4, const TRow &r5)
 
template<class EE , int SS>
 Mat (const Row< N, EE, SS > &r0)
 
template<class EE , int SS>
 Mat (const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1)
 
template<class EE , int SS>
 Mat (const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2)
 
template<class EE , int SS>
 Mat (const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2, const Row< N, EE, SS > &r3)
 
template<class EE , int SS>
 Mat (const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2, const Row< N, EE, SS > &r3, const Row< N, EE, SS > &r4)
 
template<class EE , int SS>
 Mat (const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2, const Row< N, EE, SS > &r3, const Row< N, EE, SS > &r4, const Row< N, EE, SS > &r5)
 
 Mat (const TCol &r0)
 
 Mat (const TCol &r0, const TCol &r1)
 
 Mat (const TCol &r0, const TCol &r1, const TCol &r2)
 
 Mat (const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3)
 
 Mat (const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4)
 
 Mat (const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4, const TCol &r5)
 
template<class EE , int SS>
 Mat (const Vec< M, EE, SS > &r0)
 
template<class EE , int SS>
 Mat (const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1)
 
template<class EE , int SS>
 Mat (const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2)
 
template<class EE , int SS>
 Mat (const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2, const Vec< M, EE, SS > &r3)
 
template<class EE , int SS>
 Mat (const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2, const Vec< M, EE, SS > &r3, const Vec< M, EE, SS > &r4)
 
template<class EE , int SS>
 Mat (const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2, const Vec< M, EE, SS > &r3, const Vec< M, EE, SS > &r4, const Vec< M, EE, SS > &r5)
 
template<class EE >
 Mat (const EE *p)
 
template<class EE , int CSS, int RSS>
Matoperator= (const Mat< M, N, EE, CSS, RSS > &mm)
 
template<class EE >
Matoperator= (const EE *p)
 
template<class EE , int CSS, int RSS>
Matoperator+= (const Mat< M, N, EE, CSS, RSS > &mm)
 
template<class EE , int CSS, int RSS>
Matoperator+= (const Mat< M, N, negator< EE >, CSS, RSS > &mm)
 
template<class EE , int CSS, int RSS>
Matoperator-= (const Mat< M, N, EE, CSS, RSS > &mm)
 
template<class EE , int CSS, int RSS>
Matoperator-= (const Mat< M, N, negator< EE >, CSS, RSS > &mm)
 
template<class EE , int CSS, int RSS>
Matoperator*= (const Mat< N, N, EE, CSS, RSS > &mm)
 
template<class E2 , int CS2, int RS2>
Result< Mat< M, N, E2, CS2, RS2 > >::Add conformingAdd (const Mat< M, N, E2, CS2, RS2 > &r) const
 
template<class E2 , int CS2, int RS2>
Result< Mat< M, N, E2, CS2, RS2 > >::Sub conformingSubtract (const Mat< M, N, E2, CS2, RS2 > &r) const
 
template<class E2 , int CS2, int RS2>
Mat< M, N, E2, CS2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft (const Mat< M, N, E2, CS2, RS2 > &l) const
 
template<class E2 , int CS2, int RS2>
EltResult< E2 >::Mul elementwiseMultiply (const Mat< M, N, E2, CS2, RS2 > &r) const
 
template<class E2 , int CS2, int RS2>
EltResult< E2 >::Dvd elementwiseDivide (const Mat< M, N, E2, CS2, RS2 > &r) const
 
template<class E2 , int RS2>
Result< SymMat< M, E2, RS2 > >::Add conformingAdd (const SymMat< M, E2, RS2 > &sy) const
 
template<class E2 , int RS2>
Result< SymMat< M, E2, RS2 > >::Sub conformingSubtract (const SymMat< M, E2, RS2 > &sy) const
 
template<class E2 , int RS2>
SymMat< M, E2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft (const SymMat< M, E2, RS2 > &sy) const
 
template<int N2, class E2 , int CS2, int RS2>
Result< Mat< N, N2, E2, CS2, RS2 > >::Mul conformingMultiply (const Mat< N, N2, E2, CS2, RS2 > &m) const
 
template<int M2, class E2 , int CS2, int RS2>
Mat< M2, M, E2, CS2, RS2 >::template Result< Mat >::Mul conformingMultiplyFromLeft (const Mat< M2, M, E2, CS2, RS2 > &m) const
 
template<int M2, class E2 , int CS2, int RS2>
Result< Mat< M2, N, E2, CS2, RS2 > >::Dvd conformingDivide (const Mat< M2, N, E2, CS2, RS2 > &m) const
 
template<int M2, class E2 , int CS2, int RS2>
Mat< M2, N, E2, CS2, RS2 >::template Result< Mat >::Dvd conformingDivideFromLeft (const Mat< M2, N, E2, CS2, RS2 > &m) const
 
const TRowoperator[] (int i) const
 
TRowoperator[] (int i)
 
const TColoperator() (int j) const
 
TColoperator() (int j)
 
const Eoperator() (int i, int j) const
 
Eoperator() (int i, int j)
 
ScalarNormSq normSqr () const
 
CNT< ScalarNormSq >::TSqrt norm () const
 
TNormalize normalize () const
 
TInvert invert () const
 
const Matoperator+ () const
 
const TNegoperator- () const
 
TNegoperator- ()
 
const THermoperator~ () const
 
THermoperator~ ()
 
const TNegnegate () const
 
TNegupdNegate ()
 
const THermtranspose () const
 
THermupdTranspose ()
 
const TPosTranspositionalTranspose () const
 
TPosTransupdPositionalTranspose ()
 
const TRealreal () const
 
TRealreal ()
 
const TImagimag () const
 
TImagimag ()
 
const TWithoutNegatorcastAwayNegatorIfAny () const
 
TWithoutNegatorupdCastAwayNegatorIfAny ()
 
const TRowrow (int i) const
 
TRowrow (int i)
 
const TColcol (int j) const
 
TColcol (int j)
 
const Eelt (int i, int j) const
 
Eelt (int i, int j)
 
const TDiagdiag () const
 Select main diagonal (of largest leading square if rectangular) and return it as a read-only view (as a Vec) of the diagonal elements of this Mat. More...
 
TDiagupdDiag ()
 Select main diagonal (of largest leading square if rectangular) and return it as a writable view (as a Vec) of the diagonal elements of this Mat. More...
 
TDiagdiag ()
 This non-const version of diag() is an alternate name for updDiag() available for historical reasons. More...
 
EStandard trace () const
 
template<class EE >
Mat< M, N, typename CNT< E >::template Result< EE >::Mul > scalarMultiply (const EE &e) const
 
template<class EE >
Mat< M, N, typename CNT< EE >::template Result< E >::Mul > scalarMultiplyFromLeft (const EE &e) const
 
template<class EE >
Mat< M, N, typename CNT< E >::template Result< EE >::Dvd > scalarDivide (const EE &e) const
 
template<class EE >
Mat< M, N, typename CNT< EE >::template Result< E >::Dvd > scalarDivideFromLeft (const EE &e) const
 
template<class EE >
Mat< M, N, typename CNT< E >::template Result< EE >::Add > scalarAdd (const EE &e) const
 
template<class EE >
Mat< M, N, typename CNT< E >::template Result< EE >::Sub > scalarSubtract (const EE &e) const
 
template<class EE >
Mat< M, N, typename CNT< EE >::template Result< E >::Sub > scalarSubtractFromLeft (const EE &e) const
 
template<class EE >
Matoperator= (const EE &e)
 
template<class EE >
Matoperator+= (const EE &e)
 
template<class EE >
Matoperator-= (const EE &e)
 
template<class EE >
Matoperator*= (const EE &e)
 
template<class EE >
Matoperator/= (const EE &e)
 
template<class EE >
MatscalarEq (const EE &ee)
 
template<class EE >
MatscalarPlusEq (const EE &ee)
 
template<class EE >
MatscalarMinusEq (const EE &ee)
 
template<class EE >
MatscalarMinusEqFromLeft (const EE &ee)
 
template<class EE >
MatscalarTimesEq (const EE &ee)
 
template<class EE >
MatscalarTimesEqFromLeft (const EE &ee)
 
template<class EE >
MatscalarDivideEq (const EE &ee)
 
template<class EE >
MatscalarDivideEqFromLeft (const EE &ee)
 
void setToNaN ()
 
void setToZero ()
 
template<int MM, int NN>
const SubMat< MM, NN >::Type & getSubMat (int i, int j) const
 
template<int MM, int NN>
SubMat< MM, NN >::Type & updSubMat (int i, int j)
 
template<int MM, int NN>
void setSubMat (int i, int j, const typename SubMat< MM, NN >::Type &value)
 
TDropRow dropRow (int i) const
 Return a matrix one row smaller than this one by dropping row i. More...
 
TDropCol dropCol (int j) const
 Return a matrix one column smaller than this one by dropping column j. More...
 
TDropRowCol dropRowCol (int i, int j) const
 Return a matrix one row and one column smaller than this one by dropping row i and column j. More...
 
template<class EE , int SS>
TAppendRow appendRow (const Row< N, EE, SS > &row) const
 Return a matrix one row larger than this one by adding a row to the end. More...
 
template<class EE , int SS>
TAppendCol appendCol (const Vec< M, EE, SS > &col) const
 Return a matrix one column larger than this one by adding a column to the end. More...
 
template<class ER , int SR, class EC , int SC>
TAppendRowCol appendRowCol (const Row< N+1, ER, SR > &row, const Vec< M+1, EC, SC > &col) const
 Return a matrix one row and one column larger than this one by adding a row to the bottom and a column to the right. More...
 
template<class EE , int SS>
TAppendRow insertRow (int i, const Row< N, EE, SS > &row) const
 Return a matrix one row larger than this one by inserting a row before row i. More...
 
template<class EE , int SS>
TAppendCol insertCol (int j, const Vec< M, EE, SS > &col) const
 Return a matrix one column larger than this one by inserting a column before column j. More...
 
template<class ER , int SR, class EC , int SC>
TAppendRowCol insertRowCol (int i, int j, const Row< N+1, ER, SR > &row, const Vec< M+1, EC, SC > &col) const
 Return a matrix one row and one column larger than this one by inserting a row before row i and a column before column j. More...
 
bool isNaN () const
 Return true if any element of this Mat contains a NaN anywhere. More...
 
bool isInf () const
 Return true if any element of this Mat contains a +Inf or -Inf somewhere but no element contains a NaN anywhere. More...
 
bool isFinite () const
 Return true if no element contains an Infinity or a NaN. More...
 
template<class E2 , int CS2, int RS2>
bool isNumericallyEqual (const Mat< M, N, E2, CS2, RS2 > &m, double tol) const
 Test whether this matrix is numerically equal to some other matrix with the same shape, using a specified tolerance. More...
 
template<class E2 , int CS2, int RS2>
bool isNumericallyEqual (const Mat< M, N, E2, CS2, RS2 > &m) const
 Test whether this matrix is numerically equal to some other matrix with the same shape, using a default tolerance which is the looser of the default tolerances of the two objects being compared. More...
 
bool isNumericallyEqual (const ELT &e, double tol=getDefaultTolerance()) const
 Test whether this is numerically a "scalar" matrix, meaning that it is a diagonal matrix in which each diagonal element is numerically equal to the same scalar, using either a specified tolerance or the matrix's default tolerance (which is always the same or looser than the default tolerance for one of its elements). More...
 
bool isNumericallySymmetric (double tol=getDefaultTolerance()) const
 A Matrix is symmetric (actually Hermitian) if it is square and each element (i,j) is the Hermitian transpose of element (j,i). More...
 
bool isExactlySymmetric () const
 A Matrix is symmetric (actually Hermitian) if it is square and each element (i,j) is the Hermitian (conjugate) transpose of element (j,i). More...
 
TRow colSum () const
 Returns a row vector (Row) containing the column sums of this matrix. More...
 
TRow sum () const
 This is an alternate name for colSum(); behaves like the Matlab function of the same name. More...
 
TCol rowSum () const
 Returns a column vector (Vec) containing the row sums of this matrix. More...
 
std::string toString () const
 toString() returns a string representation of the Mat. More...
 
const ELT & get (int i, int j) const
 Variant of indexing operator that's scripting friendly to get entry (i, j) More...
 
void set (int i, int j, const ELT &value)
 Variant of indexing operator that's scripting friendly to set entry (i, j) More...
 

Static Public Member Functions

static int size ()
 Return the total number of elements M*N contained in this Mat. More...
 
static int nrow ()
 Return the number of rows in this Mat, echoing the value supplied for the template parameter M. More...
 
static int ncol ()
 Return the number of columns in this Mat, echoing the value supplied for the template parameter N. More...
 
static const MatgetAs (const ELT *p)
 
static MatupdAs (ELT *p)
 
static Mat< M, N, ELT, M, 1 > getNaN ()
 
static double getDefaultTolerance ()
 For approximate comparisons, the default tolerance to use for a matrix is its shortest dimension times its elements' default tolerance. More...
 

Related Functions

(Note that these are not member functions.)

template<int M, int N, class E , int CS, int RS>
void writeUnformatted (std::ostream &o, const Mat< M, N, E, CS, RS > &v)
 Specialize for Mat<M,N,E,CS,RS> delegating to Row<N,E,RS> with newlines separating the rows, but no final newline. More...
 
template<int M, int N, class E , int CS, int RS>
bool readUnformatted (std::istream &in, Mat< M, N, E, CS, RS > &v)
 Specialize for Mat<M,N,E,CS,RS> delegating to Row<N,E,RS>. More...
 

Detailed Description

template<int M, int N, class ELT, int CS, int RS>
class SimTK::Mat< M, N, ELT, CS, RS >

This class represents a small matrix whose size is known at compile time, containing elements of any Composite Numerical Type (CNT) and engineered to have no runtime overhead whatsoever.

Memory layout defaults to packed, column-ordered storage but can be specified to have any regular row and column spacing. A Mat object is itself a Composite Numerical Type and can thus be the element type for other matrix and vector types. Some common use cases are provided below.

Template Parameters
MThe number of rows in this matrix (no default).
NThe number of columns in this matrix (no default).
ELTThe element type; default is Real.
CSColumn spacing in memory as a multiple of element size (default M).
RSRow spacing in memory as a multiple of element size (default 1).

Construction

A 3x3 identity matrix can be constructed in the following ways:

Mat<3,3,Real>(1,0,0, 0,1,0, 0,0,1); //row-major
Mat33(1,0,0,0,1,0,0,0,1);
Mat33(Vec3(1,0,0),Vec3(0,1,0),Vec3(0,0,1)); //column-by-column
Mat33(1);

Note that the default element type is Real, and that Mat33 is a typedef for Mat<3,3>; analogous typedefs exist for matrices of up to 9x9 elements.

Manipulation

Standard arithmetic operators can be used, as well as methods like trace() and transpose(). Here are some usage examples, each of which prints a 2x2 identity matrix:

Mat23 myMat(2,1,0, 3,0,1);
std::cout << myMat.getSubMat<2,2>(0,1) << std::endl;
std::cout << myMat.dropCol(0) << std::endl;
std::cout << Mat12(1,0).appendRow(~Vec2(0,1)) << std::endl;
std::cout << Mat21(0,1).insertCol(0,Vec2(1,0)) << std::endl;

Conversion

It may be necessary to convert between a Mat and a Matrix (to interface with FactorQTZ, for instance). In the example below, we print a Mat33 created from a 3x3 Matrix:

Matrix myMatrix(3,3);
for (int i=0; i<9; ++i) myMatrix[i/3][i%3] = i+1;
Mat33 myMat33 = Mat33(&myMatrix[0][0]).transpose();
std::cout << myMat33 << std::endl;

Converting from a Mat33 to a Matrix is straightforward:

Mat33 myMat33(1,2,3, 4,5,6, 7,8,9);
std::cout << Matrix(myMat33) << std::endl;
See also
Matrix_ for handling of large or variable-sized matrices.
SymMat, Vec, Row

Member Typedef Documentation

◆ E

template<int M, int N, class ELT, int CS, int RS>
typedef ELT SimTK::Mat< M, N, ELT, CS, RS >::E

◆ ENeg

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TNeg SimTK::Mat< M, N, ELT, CS, RS >::ENeg

◆ EWithoutNegator

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TWithoutNegator SimTK::Mat< M, N, ELT, CS, RS >::EWithoutNegator

◆ EReal

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TReal SimTK::Mat< M, N, ELT, CS, RS >::EReal

◆ EImag

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TImag SimTK::Mat< M, N, ELT, CS, RS >::EImag

◆ EComplex

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TComplex SimTK::Mat< M, N, ELT, CS, RS >::EComplex

◆ EHerm

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::THerm SimTK::Mat< M, N, ELT, CS, RS >::EHerm

◆ EPosTrans

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TPosTrans SimTK::Mat< M, N, ELT, CS, RS >::EPosTrans

◆ ESqHermT

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TSqHermT SimTK::Mat< M, N, ELT, CS, RS >::ESqHermT

◆ ESqTHerm

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TSqTHerm SimTK::Mat< M, N, ELT, CS, RS >::ESqTHerm

◆ ESqrt

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TSqrt SimTK::Mat< M, N, ELT, CS, RS >::ESqrt

◆ EAbs

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TAbs SimTK::Mat< M, N, ELT, CS, RS >::EAbs

◆ EStandard

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TStandard SimTK::Mat< M, N, ELT, CS, RS >::EStandard

◆ EInvert

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TInvert SimTK::Mat< M, N, ELT, CS, RS >::EInvert

◆ ENormalize

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::TNormalize SimTK::Mat< M, N, ELT, CS, RS >::ENormalize

◆ EScalar

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::Scalar SimTK::Mat< M, N, ELT, CS, RS >::EScalar

◆ EULessScalar

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::ULessScalar SimTK::Mat< M, N, ELT, CS, RS >::EULessScalar

◆ ENumber

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::Number SimTK::Mat< M, N, ELT, CS, RS >::ENumber

◆ EStdNumber

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::StdNumber SimTK::Mat< M, N, ELT, CS, RS >::EStdNumber

◆ EPrecision

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::Precision SimTK::Mat< M, N, ELT, CS, RS >::EPrecision

◆ EScalarNormSq

template<int M, int N, class ELT, int CS, int RS>
typedef CNT<E>::ScalarNormSq SimTK::Mat< M, N, ELT, CS, RS >::EScalarNormSq

◆ T

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,E,CS,RS> SimTK::Mat< M, N, ELT, CS, RS >::T

◆ TNeg

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,ENeg,CS,RS> SimTK::Mat< M, N, ELT, CS, RS >::TNeg

◆ TWithoutNegator

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,EWithoutNegator,CS,RS> SimTK::Mat< M, N, ELT, CS, RS >::TWithoutNegator

◆ TReal

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,EReal,CS*CNT<E>::RealStrideFactor,RS*CNT<E>::RealStrideFactor> SimTK::Mat< M, N, ELT, CS, RS >::TReal

◆ TImag

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,EImag,CS*CNT<E>::RealStrideFactor,RS*CNT<E>::RealStrideFactor> SimTK::Mat< M, N, ELT, CS, RS >::TImag

◆ TComplex

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,EComplex,CS,RS> SimTK::Mat< M, N, ELT, CS, RS >::TComplex

◆ THerm

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<N,M,EHerm,RS,CS> SimTK::Mat< M, N, ELT, CS, RS >::THerm

◆ TPosTrans

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<N,M,E,RS,CS> SimTK::Mat< M, N, ELT, CS, RS >::TPosTrans

◆ TElement

template<int M, int N, class ELT, int CS, int RS>
typedef E SimTK::Mat< M, N, ELT, CS, RS >::TElement

◆ TRow

template<int M, int N, class ELT, int CS, int RS>
typedef Row<N,E,CS> SimTK::Mat< M, N, ELT, CS, RS >::TRow

◆ TCol

template<int M, int N, class ELT, int CS, int RS>
typedef Vec<M,E,RS> SimTK::Mat< M, N, ELT, CS, RS >::TCol

◆ TDiag

template<int M, int N, class ELT, int CS, int RS>
typedef Vec<MinDim,E,RS+CS> SimTK::Mat< M, N, ELT, CS, RS >::TDiag

◆ TSqrt

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,ESqrt,M,1> SimTK::Mat< M, N, ELT, CS, RS >::TSqrt

◆ TAbs

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,EAbs,M,1> SimTK::Mat< M, N, ELT, CS, RS >::TAbs

◆ TStandard

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,EStandard,M,1> SimTK::Mat< M, N, ELT, CS, RS >::TStandard

◆ TInvert

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<N,M,EInvert,N,1> SimTK::Mat< M, N, ELT, CS, RS >::TInvert

◆ TNormalize

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,ENormalize,M,1> SimTK::Mat< M, N, ELT, CS, RS >::TNormalize

◆ TSqHermT

template<int M, int N, class ELT, int CS, int RS>
typedef SymMat<N,ESqHermT> SimTK::Mat< M, N, ELT, CS, RS >::TSqHermT

◆ TSqTHerm

template<int M, int N, class ELT, int CS, int RS>
typedef SymMat<M,ESqTHerm> SimTK::Mat< M, N, ELT, CS, RS >::TSqTHerm

◆ TPacked

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N,E,M,1> SimTK::Mat< M, N, ELT, CS, RS >::TPacked

◆ TDropRow

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M-1,N,E,M-1,1> SimTK::Mat< M, N, ELT, CS, RS >::TDropRow

◆ TDropCol

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N-1,E,M,1> SimTK::Mat< M, N, ELT, CS, RS >::TDropCol

◆ TDropRowCol

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M-1,N-1,E,M-1,1> SimTK::Mat< M, N, ELT, CS, RS >::TDropRowCol

◆ TAppendRow

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M+1,N,E,M+1,1> SimTK::Mat< M, N, ELT, CS, RS >::TAppendRow

◆ TAppendCol

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M,N+1,E,M,1> SimTK::Mat< M, N, ELT, CS, RS >::TAppendCol

◆ TAppendRowCol

template<int M, int N, class ELT, int CS, int RS>
typedef Mat<M+1,N+1,E,M+1,1> SimTK::Mat< M, N, ELT, CS, RS >::TAppendRowCol

◆ Scalar

template<int M, int N, class ELT, int CS, int RS>
typedef EScalar SimTK::Mat< M, N, ELT, CS, RS >::Scalar

◆ ULessScalar

template<int M, int N, class ELT, int CS, int RS>
typedef EULessScalar SimTK::Mat< M, N, ELT, CS, RS >::ULessScalar

◆ Number

template<int M, int N, class ELT, int CS, int RS>
typedef ENumber SimTK::Mat< M, N, ELT, CS, RS >::Number

◆ StdNumber

template<int M, int N, class ELT, int CS, int RS>
typedef EStdNumber SimTK::Mat< M, N, ELT, CS, RS >::StdNumber

◆ Precision

template<int M, int N, class ELT, int CS, int RS>
typedef EPrecision SimTK::Mat< M, N, ELT, CS, RS >::Precision

◆ ScalarNormSq

template<int M, int N, class ELT, int CS, int RS>
typedef EScalarNormSq SimTK::Mat< M, N, ELT, CS, RS >::ScalarNormSq

◆ TransposeType

template<int M, int N, class ELT, int CS, int RS>
typedef THerm SimTK::Mat< M, N, ELT, CS, RS >::TransposeType

Member Enumeration Documentation

◆ anonymous enum

template<int M, int N, class ELT, int CS, int RS>
anonymous enum

Every Composite Numerical Type (CNT) must define these values.

Enumerator
NRows 
NCols 
MinDim 
RowSpacing 
ColSpacing 
NPackedElements 
NActualElements 
NActualScalars 
ImagOffset 
RealStrideFactor 
ArgDepth 
IsScalar 
IsULessScalar 
IsNumber 
IsStdNumber 
IsPrecision 
SignInterpretation 

Constructor & Destructor Documentation

◆ Mat() [1/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( )
inline

Default construction initializes to NaN when debugging but is left uninitialized otherwise to ensure that there is no overhead.

◆ Mat() [2/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Mat< M, N, ELT, CS, RS > &  src)
inline

Copy constructor copies only the elements that are present and does not touch any unused memory space between them if they are not packed.

◆ Mat() [3/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const SymMat< M, ELT > &  src)
inlineexplicit

Explicit construction of a Mat from a SymMat (symmetric/Hermitian matrix).

Note that a SymMat is a Hermitian matrix when the elements are complex, so in that case the resulting Mat's upper triangle values are complex conjugates of the lower triangle ones.

◆ Mat() [4/49]

template<int M, int N, class ELT, int CS, int RS>
template<int CSS, int RSS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Mat< M, N, E, CSS, RSS > &  src)
inline

This provides an implicit conversion from a Mat of the same dimensions and element type but with different element spacing.

Template Parameters
CSSColumn spacing of the source Mat.
RSSRow spacing of the source Mat.

◆ Mat() [5/49]

template<int M, int N, class ELT, int CS, int RS>
template<int CSS, int RSS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Mat< M, N, ENeg, CSS, RSS > &  src)
inline

This provides an implicit conversion from a Mat of the same dimensions and negated element type, possibly with different element spacing.

Template Parameters
CSSColumn spacing of the source Mat.
RSSRow spacing of the source Mat.

◆ Mat() [6/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int CSS, int RSS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Mat< M, N, EE, CSS, RSS > &  mm)
inlineexplicit

Explicit construction of a Mat from a source Mat of the same dimensions and an assignment-compatible element type, with any element spacing allowed.

Template Parameters
EEThe element type of the source Mat; must be assignment compatible with element type E of this Mat.
CSSColumn spacing of the source Mat.
RSSRow spacing of the source Mat.

◆ Mat() [7/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e)
inlineexplicit

Explicit construction from a single element e of this Mat's element type E sets all the main diagonal elements to e but sets the rest of the elements to zero.

◆ Mat() [8/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const ENeg e)
inlineexplicit

Explicit construction from a single element e whose type is negator<E> (abbreviated ENeg here) where E is this Mat's element type sets all the main diagonal elements to e but sets the rest of the elements to zero.

◆ Mat() [9/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( int  i)
inlineexplicit

Explicit construction from an int value means we convert the int into an object of this Mat's element type E, and then apply the single-element constructor above which sets the Mat to zero except for its main diagonal elements which will all be set to the given value.

To convert an int to an element, we first turn it into the appropriate-precision floating point number, and then call E's constructor that takes a single scalar.

◆ Mat() [10/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1 
)
inline

◆ Mat() [11/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2 
)
inline

◆ Mat() [12/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3 
)
inline

◆ Mat() [13/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4 
)
inline

◆ Mat() [14/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5 
)
inline

◆ Mat() [15/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6 
)
inline

◆ Mat() [16/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7 
)
inline

◆ Mat() [17/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8 
)
inline

◆ Mat() [18/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8,
const E e9 
)
inline

◆ Mat() [19/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8,
const E e9,
const E e10 
)
inline

◆ Mat() [20/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8,
const E e9,
const E e10,
const E e11 
)
inline

◆ Mat() [21/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8,
const E e9,
const E e10,
const E e11,
const E e12 
)
inline

◆ Mat() [22/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8,
const E e9,
const E e10,
const E e11,
const E e12,
const E e13 
)
inline

◆ Mat() [23/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8,
const E e9,
const E e10,
const E e11,
const E e12,
const E e13,
const E e14 
)
inline

◆ Mat() [24/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const E e0,
const E e1,
const E e2,
const E e3,
const E e4,
const E e5,
const E e6,
const E e7,
const E e8,
const E e9,
const E e10,
const E e11,
const E e12,
const E e13,
const E e14,
const E e15 
)
inline

◆ Mat() [25/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TRow r0)
inlineexplicit

◆ Mat() [26/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TRow r0,
const TRow r1 
)
inline

◆ Mat() [27/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TRow r0,
const TRow r1,
const TRow r2 
)
inline

◆ Mat() [28/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TRow r0,
const TRow r1,
const TRow r2,
const TRow r3 
)
inline

◆ Mat() [29/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TRow r0,
const TRow r1,
const TRow r2,
const TRow r3,
const TRow r4 
)
inline

◆ Mat() [30/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TRow r0,
const TRow r1,
const TRow r2,
const TRow r3,
const TRow r4,
const TRow r5 
)
inline

◆ Mat() [31/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Row< N, EE, SS > &  r0)
inlineexplicit

◆ Mat() [32/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Row< N, EE, SS > &  r0,
const Row< N, EE, SS > &  r1 
)
inline

◆ Mat() [33/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Row< N, EE, SS > &  r0,
const Row< N, EE, SS > &  r1,
const Row< N, EE, SS > &  r2 
)
inline

◆ Mat() [34/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Row< N, EE, SS > &  r0,
const Row< N, EE, SS > &  r1,
const Row< N, EE, SS > &  r2,
const Row< N, EE, SS > &  r3 
)
inline

◆ Mat() [35/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Row< N, EE, SS > &  r0,
const Row< N, EE, SS > &  r1,
const Row< N, EE, SS > &  r2,
const Row< N, EE, SS > &  r3,
const Row< N, EE, SS > &  r4 
)
inline

◆ Mat() [36/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Row< N, EE, SS > &  r0,
const Row< N, EE, SS > &  r1,
const Row< N, EE, SS > &  r2,
const Row< N, EE, SS > &  r3,
const Row< N, EE, SS > &  r4,
const Row< N, EE, SS > &  r5 
)
inline

◆ Mat() [37/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TCol r0)
inlineexplicit

◆ Mat() [38/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TCol r0,
const TCol r1 
)
inline

◆ Mat() [39/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TCol r0,
const TCol r1,
const TCol r2 
)
inline

◆ Mat() [40/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TCol r0,
const TCol r1,
const TCol r2,
const TCol r3 
)
inline

◆ Mat() [41/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TCol r0,
const TCol r1,
const TCol r2,
const TCol r3,
const TCol r4 
)
inline

◆ Mat() [42/49]

template<int M, int N, class ELT, int CS, int RS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const TCol r0,
const TCol r1,
const TCol r2,
const TCol r3,
const TCol r4,
const TCol r5 
)
inline

◆ Mat() [43/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Vec< M, EE, SS > &  r0)
inlineexplicit

◆ Mat() [44/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Vec< M, EE, SS > &  r0,
const Vec< M, EE, SS > &  r1 
)
inline

◆ Mat() [45/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Vec< M, EE, SS > &  r0,
const Vec< M, EE, SS > &  r1,
const Vec< M, EE, SS > &  r2 
)
inline

◆ Mat() [46/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Vec< M, EE, SS > &  r0,
const Vec< M, EE, SS > &  r1,
const Vec< M, EE, SS > &  r2,
const Vec< M, EE, SS > &  r3 
)
inline

◆ Mat() [47/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Vec< M, EE, SS > &  r0,
const Vec< M, EE, SS > &  r1,
const Vec< M, EE, SS > &  r2,
const Vec< M, EE, SS > &  r3,
const Vec< M, EE, SS > &  r4 
)
inline

◆ Mat() [48/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const Vec< M, EE, SS > &  r0,
const Vec< M, EE, SS > &  r1,
const Vec< M, EE, SS > &  r2,
const Vec< M, EE, SS > &  r3,
const Vec< M, EE, SS > &  r4,
const Vec< M, EE, SS > &  r5 
)
inline

◆ Mat() [49/49]

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
SimTK::Mat< M, N, ELT, CS, RS >::Mat ( const EE *  p)
inlineexplicit

Member Function Documentation

◆ size()

template<int M, int N, class ELT, int CS, int RS>
static int SimTK::Mat< M, N, ELT, CS, RS >::size ( )
inlinestatic

Return the total number of elements M*N contained in this Mat.

◆ nrow()

template<int M, int N, class ELT, int CS, int RS>
static int SimTK::Mat< M, N, ELT, CS, RS >::nrow ( )
inlinestatic

Return the number of rows in this Mat, echoing the value supplied for the template parameter M.

◆ ncol()

template<int M, int N, class ELT, int CS, int RS>
static int SimTK::Mat< M, N, ELT, CS, RS >::ncol ( )
inlinestatic

Return the number of columns in this Mat, echoing the value supplied for the template parameter N.

◆ scalarNormSqr()

template<int M, int N, class ELT, int CS, int RS>
ScalarNormSq SimTK::Mat< M, N, ELT, CS, RS >::scalarNormSqr ( ) const
inline

Scalar norm square is the sum of squares of all the scalars that comprise the value of this Mat.

For Mat objects with composite element types, this is defined recursively as the sum of the scalar norm squares of all the elements, where the scalar norm square of a scalar is just that scalar squared.

◆ sqrt()

template<int M, int N, class ELT, int CS, int RS>
TSqrt SimTK::Mat< M, N, ELT, CS, RS >::sqrt ( ) const
inline

Elementwise square root; that is, the return value has the same dimensions as this Mat but with each element replaced by whatever it thinks its square root is.

◆ abs()

template<int M, int N, class ELT, int CS, int RS>
TAbs SimTK::Mat< M, N, ELT, CS, RS >::abs ( ) const
inline

Elementwise absolute value; that is, the return value has the same dimensions as this Mat but with each element replaced by whatever it thinks its absolute value is.

◆ standardize()

template<int M, int N, class ELT, int CS, int RS>
TStandard SimTK::Mat< M, N, ELT, CS, RS >::standardize ( ) const
inline

◆ operator=() [1/4]

template<int M, int N, class ELT, int CS, int RS>
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator= ( const Mat< M, N, ELT, CS, RS > &  src)
inline

Copy assignment copies only the elements that are present and does not touch any unused memory space between them if they are not packed.

Works correctly even if source and destination are the same object.

◆ operator=() [2/4]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int CSS, int RSS>
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator= ( const Mat< M, N, EE, CSS, RSS > &  mm)
inline

◆ operator=() [3/4]

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator= ( const EE *  p)
inline

◆ operator+=() [1/3]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int CSS, int RSS>
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator+= ( const Mat< M, N, EE, CSS, RSS > &  mm)
inline

◆ operator+=() [2/3]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int CSS, int RSS>
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator+= ( const Mat< M, N, negator< EE >, CSS, RSS > &  mm)
inline

◆ operator-=() [1/3]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int CSS, int RSS>
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator-= ( const Mat< M, N, EE, CSS, RSS > &  mm)
inline

◆ operator-=() [2/3]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int CSS, int RSS>
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator-= ( const Mat< M, N, negator< EE >, CSS, RSS > &  mm)
inline

◆ operator*=() [1/2]

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int CSS, int RSS>
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator*= ( const Mat< N, N, EE, CSS, RSS > &  mm)
inline

◆ conformingAdd() [1/2]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int CS2, int RS2>
Result<Mat<M,N,E2,CS2,RS2> >::Add SimTK::Mat< M, N, ELT, CS, RS >::conformingAdd ( const Mat< M, N, E2, CS2, RS2 > &  r) const
inline

◆ conformingSubtract() [1/2]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int CS2, int RS2>
Result<Mat<M,N,E2,CS2,RS2> >::Sub SimTK::Mat< M, N, ELT, CS, RS >::conformingSubtract ( const Mat< M, N, E2, CS2, RS2 > &  r) const
inline

◆ conformingSubtractFromLeft() [1/2]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int CS2, int RS2>
Mat<M,N,E2,CS2,RS2>::template Result<Mat>::Sub SimTK::Mat< M, N, ELT, CS, RS >::conformingSubtractFromLeft ( const Mat< M, N, E2, CS2, RS2 > &  l) const
inline

◆ elementwiseMultiply()

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int CS2, int RS2>
EltResult<E2>::Mul SimTK::Mat< M, N, ELT, CS, RS >::elementwiseMultiply ( const Mat< M, N, E2, CS2, RS2 > &  r) const
inline

◆ elementwiseDivide()

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int CS2, int RS2>
EltResult<E2>::Dvd SimTK::Mat< M, N, ELT, CS, RS >::elementwiseDivide ( const Mat< M, N, E2, CS2, RS2 > &  r) const
inline

◆ conformingAdd() [2/2]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int RS2>
Result<SymMat<M,E2,RS2> >::Add SimTK::Mat< M, N, ELT, CS, RS >::conformingAdd ( const SymMat< M, E2, RS2 > &  sy) const
inline

◆ conformingSubtract() [2/2]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int RS2>
Result<SymMat<M,E2,RS2> >::Sub SimTK::Mat< M, N, ELT, CS, RS >::conformingSubtract ( const SymMat< M, E2, RS2 > &  sy) const
inline

◆ conformingSubtractFromLeft() [2/2]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int RS2>
SymMat<M,E2,RS2>::template Result<Mat>::Sub SimTK::Mat< M, N, ELT, CS, RS >::conformingSubtractFromLeft ( const SymMat< M, E2, RS2 > &  sy) const
inline

◆ conformingMultiply()

template<int M, int N, class ELT, int CS, int RS>
template<int N2, class E2 , int CS2, int RS2>
Result<Mat<N,N2,E2,CS2,RS2> >::Mul SimTK::Mat< M, N, ELT, CS, RS >::conformingMultiply ( const Mat< N, N2, E2, CS2, RS2 > &  m) const
inline

◆ conformingMultiplyFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<int M2, class E2 , int CS2, int RS2>
Mat<M2,M,E2,CS2,RS2>::template Result<Mat>::Mul SimTK::Mat< M, N, ELT, CS, RS >::conformingMultiplyFromLeft ( const Mat< M2, M, E2, CS2, RS2 > &  m) const
inline

◆ conformingDivide()

template<int M, int N, class ELT, int CS, int RS>
template<int M2, class E2 , int CS2, int RS2>
Result<Mat<M2,N,E2,CS2,RS2> >::Dvd SimTK::Mat< M, N, ELT, CS, RS >::conformingDivide ( const Mat< M2, N, E2, CS2, RS2 > &  m) const
inline

◆ conformingDivideFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<int M2, class E2 , int CS2, int RS2>
Mat<M2,N,E2,CS2,RS2>::template Result<Mat>::Dvd SimTK::Mat< M, N, ELT, CS, RS >::conformingDivideFromLeft ( const Mat< M2, N, E2, CS2, RS2 > &  m) const
inline

◆ operator[]() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const TRow& SimTK::Mat< M, N, ELT, CS, RS >::operator[] ( int  i) const
inline

◆ operator[]() [2/2]

template<int M, int N, class ELT, int CS, int RS>
TRow& SimTK::Mat< M, N, ELT, CS, RS >::operator[] ( int  i)
inline

◆ operator()() [1/4]

template<int M, int N, class ELT, int CS, int RS>
const TCol& SimTK::Mat< M, N, ELT, CS, RS >::operator() ( int  j) const
inline

◆ operator()() [2/4]

template<int M, int N, class ELT, int CS, int RS>
TCol& SimTK::Mat< M, N, ELT, CS, RS >::operator() ( int  j)
inline

◆ operator()() [3/4]

template<int M, int N, class ELT, int CS, int RS>
const E& SimTK::Mat< M, N, ELT, CS, RS >::operator() ( int  i,
int  j 
) const
inline

◆ operator()() [4/4]

template<int M, int N, class ELT, int CS, int RS>
E& SimTK::Mat< M, N, ELT, CS, RS >::operator() ( int  i,
int  j 
)
inline

◆ normSqr()

template<int M, int N, class ELT, int CS, int RS>
ScalarNormSq SimTK::Mat< M, N, ELT, CS, RS >::normSqr ( ) const
inline

◆ norm()

template<int M, int N, class ELT, int CS, int RS>
CNT<ScalarNormSq>::TSqrt SimTK::Mat< M, N, ELT, CS, RS >::norm ( ) const
inline

◆ normalize()

template<int M, int N, class ELT, int CS, int RS>
TNormalize SimTK::Mat< M, N, ELT, CS, RS >::normalize ( ) const
inline

◆ invert()

template<int M, int N, class ELT , int CS, int RS>
Mat< M, N, ELT, CS, RS >::TInvert SimTK::Mat< M, N, ELT, CS, RS >::invert ( ) const
inline

◆ operator+()

template<int M, int N, class ELT, int CS, int RS>
const Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator+ ( ) const
inline

◆ operator-() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const TNeg& SimTK::Mat< M, N, ELT, CS, RS >::operator- ( ) const
inline

◆ operator-() [2/2]

template<int M, int N, class ELT, int CS, int RS>
TNeg& SimTK::Mat< M, N, ELT, CS, RS >::operator- ( )
inline

◆ operator~() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const THerm& SimTK::Mat< M, N, ELT, CS, RS >::operator~ ( ) const
inline

◆ operator~() [2/2]

template<int M, int N, class ELT, int CS, int RS>
THerm& SimTK::Mat< M, N, ELT, CS, RS >::operator~ ( )
inline

◆ negate()

template<int M, int N, class ELT, int CS, int RS>
const TNeg& SimTK::Mat< M, N, ELT, CS, RS >::negate ( ) const
inline

◆ updNegate()

template<int M, int N, class ELT, int CS, int RS>
TNeg& SimTK::Mat< M, N, ELT, CS, RS >::updNegate ( )
inline

◆ transpose()

template<int M, int N, class ELT, int CS, int RS>
const THerm& SimTK::Mat< M, N, ELT, CS, RS >::transpose ( ) const
inline

◆ updTranspose()

template<int M, int N, class ELT, int CS, int RS>
THerm& SimTK::Mat< M, N, ELT, CS, RS >::updTranspose ( )
inline

◆ positionalTranspose()

template<int M, int N, class ELT, int CS, int RS>
const TPosTrans& SimTK::Mat< M, N, ELT, CS, RS >::positionalTranspose ( ) const
inline

◆ updPositionalTranspose()

template<int M, int N, class ELT, int CS, int RS>
TPosTrans& SimTK::Mat< M, N, ELT, CS, RS >::updPositionalTranspose ( )
inline

◆ real() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const TReal& SimTK::Mat< M, N, ELT, CS, RS >::real ( ) const
inline

◆ real() [2/2]

template<int M, int N, class ELT, int CS, int RS>
TReal& SimTK::Mat< M, N, ELT, CS, RS >::real ( )
inline

◆ imag() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const TImag& SimTK::Mat< M, N, ELT, CS, RS >::imag ( ) const
inline

◆ imag() [2/2]

template<int M, int N, class ELT, int CS, int RS>
TImag& SimTK::Mat< M, N, ELT, CS, RS >::imag ( )
inline

◆ castAwayNegatorIfAny()

template<int M, int N, class ELT, int CS, int RS>
const TWithoutNegator& SimTK::Mat< M, N, ELT, CS, RS >::castAwayNegatorIfAny ( ) const
inline

◆ updCastAwayNegatorIfAny()

template<int M, int N, class ELT, int CS, int RS>
TWithoutNegator& SimTK::Mat< M, N, ELT, CS, RS >::updCastAwayNegatorIfAny ( )
inline

◆ row() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const TRow& SimTK::Mat< M, N, ELT, CS, RS >::row ( int  i) const
inline

◆ row() [2/2]

template<int M, int N, class ELT, int CS, int RS>
TRow& SimTK::Mat< M, N, ELT, CS, RS >::row ( int  i)
inline

◆ col() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const TCol& SimTK::Mat< M, N, ELT, CS, RS >::col ( int  j) const
inline

◆ col() [2/2]

template<int M, int N, class ELT, int CS, int RS>
TCol& SimTK::Mat< M, N, ELT, CS, RS >::col ( int  j)
inline

◆ elt() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const E& SimTK::Mat< M, N, ELT, CS, RS >::elt ( int  i,
int  j 
) const
inline

◆ elt() [2/2]

template<int M, int N, class ELT, int CS, int RS>
E& SimTK::Mat< M, N, ELT, CS, RS >::elt ( int  i,
int  j 
)
inline

◆ diag() [1/2]

template<int M, int N, class ELT, int CS, int RS>
const TDiag& SimTK::Mat< M, N, ELT, CS, RS >::diag ( ) const
inline

Select main diagonal (of largest leading square if rectangular) and return it as a read-only view (as a Vec) of the diagonal elements of this Mat.

◆ updDiag()

template<int M, int N, class ELT, int CS, int RS>
TDiag& SimTK::Mat< M, N, ELT, CS, RS >::updDiag ( )
inline

Select main diagonal (of largest leading square if rectangular) and return it as a writable view (as a Vec) of the diagonal elements of this Mat.

◆ diag() [2/2]

template<int M, int N, class ELT, int CS, int RS>
TDiag& SimTK::Mat< M, N, ELT, CS, RS >::diag ( )
inline

This non-const version of diag() is an alternate name for updDiag() available for historical reasons.

◆ trace()

template<int M, int N, class ELT, int CS, int RS>
EStandard SimTK::Mat< M, N, ELT, CS, RS >::trace ( ) const
inline

◆ scalarMultiply()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat<M,N, typename CNT<E>::template Result<EE>::Mul> SimTK::Mat< M, N, ELT, CS, RS >::scalarMultiply ( const EE &  e) const
inline

◆ scalarMultiplyFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat<M,N, typename CNT<EE>::template Result<E>::Mul> SimTK::Mat< M, N, ELT, CS, RS >::scalarMultiplyFromLeft ( const EE &  e) const
inline

◆ scalarDivide()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat<M,N, typename CNT<E>::template Result<EE>::Dvd> SimTK::Mat< M, N, ELT, CS, RS >::scalarDivide ( const EE &  e) const
inline

◆ scalarDivideFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat<M,N, typename CNT<EE>::template Result<E>::Dvd> SimTK::Mat< M, N, ELT, CS, RS >::scalarDivideFromLeft ( const EE &  e) const
inline

◆ scalarAdd()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat<M,N, typename CNT<E>::template Result<EE>::Add> SimTK::Mat< M, N, ELT, CS, RS >::scalarAdd ( const EE &  e) const
inline

◆ scalarSubtract()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat<M,N, typename CNT<E>::template Result<EE>::Sub> SimTK::Mat< M, N, ELT, CS, RS >::scalarSubtract ( const EE &  e) const
inline

◆ scalarSubtractFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat<M,N, typename CNT<EE>::template Result<E>::Sub> SimTK::Mat< M, N, ELT, CS, RS >::scalarSubtractFromLeft ( const EE &  e) const
inline

◆ operator=() [4/4]

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator= ( const EE &  e)
inline

◆ operator+=() [3/3]

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator+= ( const EE &  e)
inline

◆ operator-=() [3/3]

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator-= ( const EE &  e)
inline

◆ operator*=() [2/2]

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator*= ( const EE &  e)
inline

◆ operator/=()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::operator/= ( const EE &  e)
inline

◆ scalarEq()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarEq ( const EE &  ee)
inline

◆ scalarPlusEq()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarPlusEq ( const EE &  ee)
inline

◆ scalarMinusEq()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarMinusEq ( const EE &  ee)
inline

◆ scalarMinusEqFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarMinusEqFromLeft ( const EE &  ee)
inline

◆ scalarTimesEq()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarTimesEq ( const EE &  ee)
inline

◆ scalarTimesEqFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarTimesEqFromLeft ( const EE &  ee)
inline

◆ scalarDivideEq()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarDivideEq ( const EE &  ee)
inline

◆ scalarDivideEqFromLeft()

template<int M, int N, class ELT, int CS, int RS>
template<class EE >
Mat& SimTK::Mat< M, N, ELT, CS, RS >::scalarDivideEqFromLeft ( const EE &  ee)
inline

◆ setToNaN()

template<int M, int N, class ELT, int CS, int RS>
void SimTK::Mat< M, N, ELT, CS, RS >::setToNaN ( )
inline

◆ setToZero()

template<int M, int N, class ELT, int CS, int RS>
void SimTK::Mat< M, N, ELT, CS, RS >::setToZero ( )
inline

◆ getSubMat()

template<int M, int N, class ELT, int CS, int RS>
template<int MM, int NN>
const SubMat<MM,NN>::Type& SimTK::Mat< M, N, ELT, CS, RS >::getSubMat ( int  i,
int  j 
) const
inline

◆ updSubMat()

template<int M, int N, class ELT, int CS, int RS>
template<int MM, int NN>
SubMat<MM,NN>::Type& SimTK::Mat< M, N, ELT, CS, RS >::updSubMat ( int  i,
int  j 
)
inline

◆ setSubMat()

template<int M, int N, class ELT, int CS, int RS>
template<int MM, int NN>
void SimTK::Mat< M, N, ELT, CS, RS >::setSubMat ( int  i,
int  j,
const typename SubMat< MM, NN >::Type &  value 
)
inline

◆ dropRow()

template<int M, int N, class ELT, int CS, int RS>
TDropRow SimTK::Mat< M, N, ELT, CS, RS >::dropRow ( int  i) const
inline

Return a matrix one row smaller than this one by dropping row i.

The result is packed but has same element type as this one.

◆ dropCol()

template<int M, int N, class ELT, int CS, int RS>
TDropCol SimTK::Mat< M, N, ELT, CS, RS >::dropCol ( int  j) const
inline

Return a matrix one column smaller than this one by dropping column j.

The result is packed but has same element type as this one.

◆ dropRowCol()

template<int M, int N, class ELT, int CS, int RS>
TDropRowCol SimTK::Mat< M, N, ELT, CS, RS >::dropRowCol ( int  i,
int  j 
) const
inline

Return a matrix one row and one column smaller than this one by dropping row i and column j.

The result is packed but has same element type as this one.

◆ appendRow()

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
TAppendRow SimTK::Mat< M, N, ELT, CS, RS >::appendRow ( const Row< N, EE, SS > &  row) const
inline

Return a matrix one row larger than this one by adding a row to the end.

The result is packed but has same element type as this one. Works for any assignment compatible row.

◆ appendCol()

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
TAppendCol SimTK::Mat< M, N, ELT, CS, RS >::appendCol ( const Vec< M, EE, SS > &  col) const
inline

Return a matrix one column larger than this one by adding a column to the end.

The result is packed but has same element type as this one. Works for any assignment compatible column.

◆ appendRowCol()

template<int M, int N, class ELT, int CS, int RS>
template<class ER , int SR, class EC , int SC>
TAppendRowCol SimTK::Mat< M, N, ELT, CS, RS >::appendRowCol ( const Row< N+1, ER, SR > &  row,
const Vec< M+1, EC, SC > &  col 
) const
inline

Return a matrix one row and one column larger than this one by adding a row to the bottom and a column to the right.

The final element of the row is ignored; that value is taken from the final element of the column instead. The result is packed but has same element type as this one. Works for any assignment compatible row and column.

◆ insertRow()

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
TAppendRow SimTK::Mat< M, N, ELT, CS, RS >::insertRow ( int  i,
const Row< N, EE, SS > &  row 
) const
inline

Return a matrix one row larger than this one by inserting a row before row i.

The result is packed but has same element type as this one. Works for any assignment compatible row. The index can be one greater than normally allowed in which case the row is appended.

◆ insertCol()

template<int M, int N, class ELT, int CS, int RS>
template<class EE , int SS>
TAppendCol SimTK::Mat< M, N, ELT, CS, RS >::insertCol ( int  j,
const Vec< M, EE, SS > &  col 
) const
inline

Return a matrix one column larger than this one by inserting a column before column j.

The result is packed but has same element type as this one. Works for any assignment compatible column. The index can be one greater than normally allowed in which case the column is appended.

◆ insertRowCol()

template<int M, int N, class ELT, int CS, int RS>
template<class ER , int SR, class EC , int SC>
TAppendRowCol SimTK::Mat< M, N, ELT, CS, RS >::insertRowCol ( int  i,
int  j,
const Row< N+1, ER, SR > &  row,
const Vec< M+1, EC, SC > &  col 
) const
inline

Return a matrix one row and one column larger than this one by inserting a row before row i and a column before column j.

The intersecting element of the row is ignored; that element is taken from the column. The result is packed but has same element type as this one. Works for any assignment compatible row and column. The indices can be one greater than normally allowed in which case the row or column is appended.

◆ getAs()

template<int M, int N, class ELT, int CS, int RS>
static const Mat& SimTK::Mat< M, N, ELT, CS, RS >::getAs ( const ELT *  p)
inlinestatic

◆ updAs()

template<int M, int N, class ELT, int CS, int RS>
static Mat& SimTK::Mat< M, N, ELT, CS, RS >::updAs ( ELT *  p)
inlinestatic

◆ getNaN()

template<int M, int N, class ELT, int CS, int RS>
static Mat<M,N,ELT,M,1> SimTK::Mat< M, N, ELT, CS, RS >::getNaN ( )
inlinestatic

◆ isNaN()

template<int M, int N, class ELT, int CS, int RS>
bool SimTK::Mat< M, N, ELT, CS, RS >::isNaN ( ) const
inline

Return true if any element of this Mat contains a NaN anywhere.

◆ isInf()

template<int M, int N, class ELT, int CS, int RS>
bool SimTK::Mat< M, N, ELT, CS, RS >::isInf ( ) const
inline

Return true if any element of this Mat contains a +Inf or -Inf somewhere but no element contains a NaN anywhere.

◆ isFinite()

template<int M, int N, class ELT, int CS, int RS>
bool SimTK::Mat< M, N, ELT, CS, RS >::isFinite ( ) const
inline

Return true if no element contains an Infinity or a NaN.

◆ getDefaultTolerance()

template<int M, int N, class ELT, int CS, int RS>
static double SimTK::Mat< M, N, ELT, CS, RS >::getDefaultTolerance ( )
inlinestatic

For approximate comparisons, the default tolerance to use for a matrix is its shortest dimension times its elements' default tolerance.

◆ isNumericallyEqual() [1/3]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int CS2, int RS2>
bool SimTK::Mat< M, N, ELT, CS, RS >::isNumericallyEqual ( const Mat< M, N, E2, CS2, RS2 > &  m,
double  tol 
) const
inline

Test whether this matrix is numerically equal to some other matrix with the same shape, using a specified tolerance.

◆ isNumericallyEqual() [2/3]

template<int M, int N, class ELT, int CS, int RS>
template<class E2 , int CS2, int RS2>
bool SimTK::Mat< M, N, ELT, CS, RS >::isNumericallyEqual ( const Mat< M, N, E2, CS2, RS2 > &  m) const
inline

Test whether this matrix is numerically equal to some other matrix with the same shape, using a default tolerance which is the looser of the default tolerances of the two objects being compared.

◆ isNumericallyEqual() [3/3]

template<int M, int N, class ELT, int CS, int RS>
bool SimTK::Mat< M, N, ELT, CS, RS >::isNumericallyEqual ( const ELT &  e,
double  tol = getDefaultTolerance() 
) const
inline

Test whether this is numerically a "scalar" matrix, meaning that it is a diagonal matrix in which each diagonal element is numerically equal to the same scalar, using either a specified tolerance or the matrix's default tolerance (which is always the same or looser than the default tolerance for one of its elements).

◆ isNumericallySymmetric()

template<int M, int N, class ELT, int CS, int RS>
bool SimTK::Mat< M, N, ELT, CS, RS >::isNumericallySymmetric ( double  tol = getDefaultTolerance()) const
inline

A Matrix is symmetric (actually Hermitian) if it is square and each element (i,j) is the Hermitian transpose of element (j,i).

Here we are testing for numerical symmetry, meaning that the symmetry condition is satisified to within a tolerance (supplied or default). This is a relatively expensive test since all elements must be examined but can be very useful in Debug mode to check assumptions.

See also
isExactlySymmetric() for a rarely-used exact equality test

◆ isExactlySymmetric()

template<int M, int N, class ELT, int CS, int RS>
bool SimTK::Mat< M, N, ELT, CS, RS >::isExactlySymmetric ( ) const
inline

A Matrix is symmetric (actually Hermitian) if it is square and each element (i,j) is the Hermitian (conjugate) transpose of element (j,i).

This method tests for exact (bitwise) equality and is too stringent for most purposes; don't use it unless you know that the corresponding elements should be bitwise conjugates, typically because you put them there directly.

See also
isNumericallySymmetric() for a more useful method

◆ colSum()

template<int M, int N, class ELT, int CS, int RS>
TRow SimTK::Mat< M, N, ELT, CS, RS >::colSum ( ) const
inline

Returns a row vector (Row) containing the column sums of this matrix.

◆ sum()

template<int M, int N, class ELT, int CS, int RS>
TRow SimTK::Mat< M, N, ELT, CS, RS >::sum ( ) const
inline

This is an alternate name for colSum(); behaves like the Matlab function of the same name.

◆ rowSum()

template<int M, int N, class ELT, int CS, int RS>
TCol SimTK::Mat< M, N, ELT, CS, RS >::rowSum ( ) const
inline

Returns a column vector (Vec) containing the row sums of this matrix.

◆ toString()

template<int M, int N, class ELT, int CS, int RS>
std::string SimTK::Mat< M, N, ELT, CS, RS >::toString ( ) const
inline

toString() returns a string representation of the Mat.

Please refer to operator<< for details.

◆ get()

template<int M, int N, class ELT, int CS, int RS>
const ELT& SimTK::Mat< M, N, ELT, CS, RS >::get ( int  i,
int  j 
) const
inline

Variant of indexing operator that's scripting friendly to get entry (i, j)

◆ set()

template<int M, int N, class ELT, int CS, int RS>
void SimTK::Mat< M, N, ELT, CS, RS >::set ( int  i,
int  j,
const ELT &  value 
)
inline

Variant of indexing operator that's scripting friendly to set entry (i, j)


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