Simbody  3.6
SimTK::Matrix_< ELT > Class Template Reference

This is the matrix class intended to appear in user code for large, variable size matrices. More...

Public Member Functions

 Matrix_ ()
 
 Matrix_ (const MatrixCommitment &mc)
 
 Matrix_ (const Matrix_ &src)
 
Matrix_operator= (const Matrix_ &src)
 
 Matrix_ (const Base &v)
 
 Matrix_ (const BaseNeg &v)
 
 Matrix_ (int m, int n)
 
 Matrix_ (int m, int n, const ELT *cppInitialValuesByRow)
 
 Matrix_ (int m, int n, const ELT &initialValue)
 
 Matrix_ (int m, int n, int leadingDim, const S *data)
 
 Matrix_ (int m, int n, int leadingDim, S *data)
 
template<int M, int N, int CS, int RS>
 Matrix_ (const Mat< M, N, ELT, CS, RS > &mat)
 Convert a Mat to a Matrix_. More...
 
Matrix_operator= (const ELT &v)
 
template<class EE >
Matrix_operator= (const MatrixBase< EE > &m)
 
template<class EE >
Matrix_operator+= (const MatrixBase< EE > &m)
 
template<class EE >
Matrix_operator-= (const MatrixBase< EE > &m)
 
Matrix_operator*= (const StdNumber &t)
 
Matrix_operator/= (const StdNumber &t)
 
Matrix_operator+= (const ELT &r)
 
Matrix_operator-= (const ELT &r)
 
const TNegnegate () const
 
TNegupdNegate ()
 
const TNegoperator- () const
 
TNegoperator- ()
 
std::string toString () const
 toString() returns a string representation of the Matrix_. 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...
 

Related Functions

(Note that these are not member functions.)

Matrix_<T> serialization and I/O

These methods are at namespace scope but are logically part of the Vector classes.

These deal with reading and writing Vectors from and to streams, which places an additional requirement on the element type T: the element must support the same operation you are trying to do on the Vector as a whole.

template<class E >
void writeUnformatted (std::ostream &o, const Matrix_< E > &v)
 Raw serialization of Vector_<E>; same as VectorBase<E>. More...
 
template<class E >
bool fillUnformatted (std::istream &in, Matrix_< E > &v)
 Read in new values for a Matrix without changing its size, from a stream of whitespace-separated tokens with no other formatting recognized. More...
 
template<class E >
bool readUnformatted (std::istream &in, Matrix_< E > &v)
 NOT IMPLEMENTED: read variable-size Matrix recognizing newlines as end of row; use fillUnformatted() instead. More...
 
template<class T >
std::ostream & operator<< (std::ostream &o, const MatrixBase< T > &m)
 Output a human readable representation of a Matrix to an std::ostream (like std::cout). More...
 

Detailed Description

template<class ELT>
class SimTK::Matrix_< ELT >

This is the matrix class intended to appear in user code for large, variable size matrices.

More commonly, the typedef Matrix is used instead; that is just an abbreviation for Matrix_<Real>.

A Matrix_ can be a fixed-size view of someone else's data, or can be a resizable data owner itself.

See also
Mat for handling of small, fixed-size matrices with no runtime overhead.
Vector_ for variable size, one-dimensional column vector.
MatrixView_, MatrixBase

Constructor & Destructor Documentation

◆ Matrix_() [1/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( )
inline

◆ Matrix_() [2/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( const MatrixCommitment mc)
inlineexplicit

◆ Matrix_() [3/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( const Matrix_< ELT > &  src)
inline

◆ Matrix_() [4/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( const Base v)
inline

◆ Matrix_() [5/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( const BaseNeg v)
inline

◆ Matrix_() [6/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( int  m,
int  n 
)
inline

◆ Matrix_() [7/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( int  m,
int  n,
const ELT *  cppInitialValuesByRow 
)
inline

◆ Matrix_() [8/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( int  m,
int  n,
const ELT &  initialValue 
)
inline

◆ Matrix_() [9/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( int  m,
int  n,
int  leadingDim,
const S *  data 
)
inline

◆ Matrix_() [10/11]

template<class ELT >
SimTK::Matrix_< ELT >::Matrix_ ( int  m,
int  n,
int  leadingDim,
S *  data 
)
inline

◆ Matrix_() [11/11]

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

Convert a Mat to a Matrix_.

Member Function Documentation

◆ operator=() [1/3]

template<class ELT >
Matrix_& SimTK::Matrix_< ELT >::operator= ( const Matrix_< ELT > &  src)
inline

◆ operator=() [2/3]

template<class ELT >
Matrix_& SimTK::Matrix_< ELT >::operator= ( const ELT &  v)
inline

◆ operator=() [3/3]

template<class ELT >
template<class EE >
Matrix_& SimTK::Matrix_< ELT >::operator= ( const MatrixBase< EE > &  m)
inline

◆ operator+=() [1/2]

template<class ELT >
template<class EE >
Matrix_& SimTK::Matrix_< ELT >::operator+= ( const MatrixBase< EE > &  m)
inline

◆ operator-=() [1/2]

template<class ELT >
template<class EE >
Matrix_& SimTK::Matrix_< ELT >::operator-= ( const MatrixBase< EE > &  m)
inline

◆ operator*=()

template<class ELT >
Matrix_& SimTK::Matrix_< ELT >::operator*= ( const StdNumber &  t)
inline

◆ operator/=()

template<class ELT >
Matrix_& SimTK::Matrix_< ELT >::operator/= ( const StdNumber &  t)
inline

◆ operator+=() [2/2]

template<class ELT >
Matrix_& SimTK::Matrix_< ELT >::operator+= ( const ELT &  r)
inline

◆ operator-=() [2/2]

template<class ELT >
Matrix_& SimTK::Matrix_< ELT >::operator-= ( const ELT &  r)
inline

◆ negate()

template<class ELT >
const TNeg& SimTK::Matrix_< ELT >::negate ( ) const
inline

◆ updNegate()

template<class ELT >
TNeg& SimTK::Matrix_< ELT >::updNegate ( )
inline

◆ operator-() [1/2]

template<class ELT >
const TNeg& SimTK::Matrix_< ELT >::operator- ( ) const
inline

◆ operator-() [2/2]

template<class ELT >
TNeg& SimTK::Matrix_< ELT >::operator- ( )
inline

◆ toString()

template<class ELT >
std::string SimTK::Matrix_< ELT >::toString ( ) const
inline

toString() returns a string representation of the Matrix_.

Please refer to operator<< for details.

◆ get()

template<class ELT >
const ELT& SimTK::Matrix_< ELT >::get ( int  i,
int  j 
) const
inline

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

◆ set()

template<class ELT >
void SimTK::Matrix_< ELT >::set ( int  i,
int  j,
const ELT &  value 
)
inline

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

Friends And Related Function Documentation

◆ writeUnformatted()

template<class E >
void writeUnformatted ( std::ostream &  o,
const Matrix_< E > &  v 
)
related

Raw serialization of Vector_<E>; same as VectorBase<E>.

◆ fillUnformatted()

template<class E >
bool fillUnformatted ( std::istream &  in,
Matrix_< E > &  v 
)
related

Read in new values for a Matrix without changing its size, from a stream of whitespace-separated tokens with no other formatting recognized.

Newlines in the input have no special meaning – we'll read them as whitespace. It is an error if there aren't enough elements.

◆ readUnformatted()

template<class E >
bool readUnformatted ( std::istream &  in,
Matrix_< E > &  v 
)
related

NOT IMPLEMENTED: read variable-size Matrix recognizing newlines as end of row; use fillUnformatted() instead.


◆ operator<<()

template<class T >
std::ostream & operator<< ( std::ostream &  o,
const MatrixBase< T > &  m 
)
related

Output a human readable representation of a Matrix to an std::ostream (like std::cout).

The format is one row per line, with each row output as [ elements ] where elements is a space-separated list of the row's contents output by invoking the "<<" operator on the elements. This function will not compile if the element type does not support the "<<" operator. A newline is issued before each row and at the end.


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