Simbody
|
Variable-size 2d matrix of Composite Numerical Type (ELT) elements. More...
#include <BigMatrix.h>
Classes | |
struct | EltResult |
Public Types | |
enum | { NScalarsPerElement = CNT<E>::NActualScalars, CppNScalarsPerElement = sizeof(E) / sizeof(Scalar) } |
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 >::TAbs | EAbs |
typedef CNT< E >::TStandard | EStandard |
typedef CNT< E >::TInvert | EInvert |
typedef CNT< E >::TNormalize | ENormalize |
typedef CNT< E >::TSqHermT | ESqHermT |
typedef CNT< E >::TSqTHerm | ESqTHerm |
typedef CNT< E >::Scalar | EScalar |
typedef CNT< E >::Number | ENumber |
typedef CNT< E >::StdNumber | EStdNumber |
typedef CNT< E >::Precision | EPrecision |
typedef CNT< E >::ScalarNormSq | EScalarNormSq |
typedef EScalar | Scalar |
typedef ENumber | Number |
typedef EStdNumber | StdNumber |
typedef EPrecision | Precision |
typedef EScalarNormSq | ScalarNormSq |
typedef MatrixBase< E > | T |
typedef MatrixBase< ENeg > | TNeg |
typedef MatrixBase < EWithoutNegator > | TWithoutNegator |
typedef MatrixBase< EReal > | TReal |
typedef MatrixBase< EImag > | TImag |
typedef MatrixBase< EComplex > | TComplex |
typedef MatrixBase< EHerm > | THerm |
typedef MatrixBase< E > | TPosTrans |
typedef MatrixBase< EAbs > | TAbs |
typedef MatrixBase< EStandard > | TStandard |
typedef MatrixBase< EInvert > | TInvert |
typedef MatrixBase< ENormalize > | TNormalize |
typedef MatrixBase< ESqHermT > | TSqHermT |
typedef MatrixBase< ESqTHerm > | TSqTHerm |
Public Member Functions | |
const MatrixCommitment & | getCharacterCommitment () const |
const MatrixCharacter & | getMatrixCharacter () const |
void | commitTo (const MatrixCommitment &mc) |
Change the handle commitment for this matrix handle; only allowed if the handle is currently clear. | |
int | nrow () const |
Return the number of rows m in the logical shape of this matrix. | |
int | ncol () const |
Return the number of columns n in the logical shape of this matrix. | |
ptrdiff_t | nelt () const |
Return the number of elements in the logical shape of this matrix. | |
bool | isResizeable () const |
Return true if either dimension of this Matrix is resizable. | |
MatrixBase () | |
The default constructor builds a 0x0 matrix managed by a helper that understands how many scalars there are in one of our elements but is otherwise uncommitted. | |
MatrixBase (int m, int n) | |
This constructor allocates the default matrix a completely uncommitted matrix commitment, given particular initial dimensions. | |
MatrixBase (const MatrixCommitment &commitment) | |
This constructor takes a handle commitment and allocates the default matrix for that kind of commitment. | |
MatrixBase (const MatrixCommitment &commitment, int m, int n) | |
This constructor takes a handle commitment and allocates the default matrix for that kind of commitment given particular initial minimum dimensions, which cannot be larger than those permitted by the commitment. | |
MatrixBase (const MatrixBase &b) | |
Copy constructor is a deep copy (not appropriate for views!). | |
MatrixBase (const TNeg &b) | |
Implicit conversion from matrix with negated elements (otherwise this is just like the copy constructor. | |
MatrixBase & | copyAssign (const MatrixBase &b) |
Copy assignment is a deep copy but behavior depends on type of lhs: if view, rhs must match. | |
MatrixBase & | operator= (const MatrixBase &b) |
MatrixBase & | viewAssign (const MatrixBase &src) |
View assignment is a shallow copy, meaning that we disconnect the MatrixBase from whatever it used to refer to (destructing as necessary), then make it a new view for the data descriptor referenced by the source. | |
MatrixBase (const MatrixCommitment &commitment, int m, int n, const ELT &initialValue) | |
Initializing constructor with all of the initially-allocated elements initialized to the same value. | |
MatrixBase (const MatrixCommitment &commitment, int m, int n, const ELT *cppInitialValuesByRow) | |
Initializing constructor with the initially-allocated elements initialized from a C++ array of elements, which is provided in row major order. | |
MatrixBase (const MatrixCommitment &commitment, MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::ShallowCopy &shallow) | |
MatrixBase (const MatrixCommitment &commitment, const MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::ShallowCopy &shallow) | |
MatrixBase (const MatrixCommitment &commitment, const MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::DeepCopy &deep) | |
void | clear () |
This restores the MatrixBase to the state it would be in had it been constructed specifying only its handle commitment. | |
MatrixBase & | operator*= (const StdNumber &t) |
MatrixBase & | operator/= (const StdNumber &t) |
MatrixBase & | operator+= (const MatrixBase &r) |
MatrixBase & | operator-= (const MatrixBase &r) |
template<class EE > | |
MatrixBase (const MatrixBase< EE > &b) | |
template<class EE > | |
MatrixBase & | operator= (const MatrixBase< EE > &b) |
template<class EE > | |
MatrixBase & | operator+= (const MatrixBase< EE > &b) |
template<class EE > | |
MatrixBase & | operator-= (const MatrixBase< EE > &b) |
MatrixBase & | operator= (const ELT &t) |
Matrix assignment to an element sets only the *diagonal* elements to the indicated value; everything else is set to zero. | |
template<class S > | |
MatrixBase & | scalarAssign (const S &s) |
Set M's diagonal elements to a "scalar" value S, and all off-diagonal elements to zero. | |
template<class S > | |
MatrixBase & | scalarAddInPlace (const S &s) |
Add a scalar to M's diagonal. | |
template<class S > | |
MatrixBase & | scalarSubtractInPlace (const S &s) |
Subtract a scalar from M's diagonal. | |
template<class S > | |
MatrixBase & | scalarSubtractFromLeftInPlace (const S &s) |
Set M(i,i) = S - M(i,i), M(i,j) = -M(i,j) for i!=j. | |
template<class S > | |
MatrixBase & | scalarMultiplyInPlace (const S &) |
Set M(i,j) = M(i,j)*S for some "scalar" S. | |
template<class S > | |
MatrixBase & | scalarMultiplyFromLeftInPlace (const S &) |
Set M(i,j) = S * M(i,j) for some "scalar" S. | |
template<class S > | |
MatrixBase & | scalarDivideInPlace (const S &) |
Set M(i,j) = M(i,j)/S for some "scalar" S. | |
template<class S > | |
MatrixBase & | scalarDivideFromLeftInPlace (const S &) |
Set M(i,j) = S/M(i,j) for some "scalar" S. | |
template<class EE > | |
MatrixBase & | rowScaleInPlace (const VectorBase< EE > &) |
M = diag(r) * M; r must have nrow() elements. | |
template<class EE > | |
void | rowScale (const VectorBase< EE > &r, typename EltResult< EE >::Mul &out) const |
Return type is a new matrix which will have the same dimensions as 'this' but will have element types appropriate for the elementwise multiply being performed. | |
template<class EE > | |
EltResult< EE >::Mul | rowScale (const VectorBase< EE > &r) const |
template<class EE > | |
MatrixBase & | colScaleInPlace (const VectorBase< EE > &) |
M = M * diag(c); c must have ncol() elements. | |
template<class EE > | |
void | colScale (const VectorBase< EE > &c, typename EltResult< EE >::Mul &out) const |
template<class EE > | |
EltResult< EE >::Mul | colScale (const VectorBase< EE > &c) const |
template<class ER , class EC > | |
MatrixBase & | rowAndColScaleInPlace (const VectorBase< ER > &r, const VectorBase< EC > &c) |
M = diag(r) * M * diag(c); r must have nrow() elements; must have ncol() elements. | |
template<class ER , class EC > | |
void | rowAndColScale (const VectorBase< ER > &r, const VectorBase< EC > &c, typename EltResult< typename VectorBase< ER >::template EltResult< EC >::Mul >::Mul &out) const |
template<class ER , class EC > | |
EltResult< typename VectorBase < ER >::template EltResult< EC > ::Mul >::Mul | rowAndColScale (const VectorBase< ER > &r, const VectorBase< EC > &c) const |
template<class S > | |
MatrixBase & | elementwiseAssign (const S &s) |
Set M(i,j)=s for every element of M and some value s. | |
MatrixBase & | elementwiseInvertInPlace () |
Set M(i,j) = M(i,j)^-1. | |
void | elementwiseInvert (MatrixBase< typename CNT< E >::TInvert > &out) const |
MatrixBase< typename CNT< E > ::TInvert > | elementwiseInvert () const |
template<class S > | |
MatrixBase & | elementwiseAddScalarInPlace (const S &s) |
Set M(i,j)+=s for every element of M and some value s. | |
template<class S > | |
void | elementwiseAddScalar (const S &s, typename EltResult< S >::Add &) const |
template<class S > | |
EltResult< S >::Add | elementwiseAddScalar (const S &s) const |
template<class S > | |
MatrixBase & | elementwiseSubtractScalarInPlace (const S &s) |
Set M(i,j)-=s for every element of M and some value s. | |
template<class S > | |
void | elementwiseSubtractScalar (const S &s, typename EltResult< S >::Sub &) const |
template<class S > | |
EltResult< S >::Sub | elementwiseSubtractScalar (const S &s) const |
template<class S > | |
MatrixBase & | elementwiseSubtractFromScalarInPlace (const S &s) |
Set M(i,j) = s - M(i,j) for every element of M and some value s. | |
template<class S > | |
void | elementwiseSubtractFromScalar (const S &, typename MatrixBase< S >::template EltResult< E >::Sub &) const |
template<class S > | |
MatrixBase< S >::template EltResult< E >::Sub | elementwiseSubtractFromScalar (const S &s) const |
template<class EE > | |
MatrixBase & | elementwiseMultiplyInPlace (const MatrixBase< EE > &) |
M(i,j) *= R(i,j); R must have same dimensions as this. | |
template<class EE > | |
void | elementwiseMultiply (const MatrixBase< EE > &, typename EltResult< EE >::Mul &) const |
template<class EE > | |
EltResult< EE >::Mul | elementwiseMultiply (const MatrixBase< EE > &m) const |
template<class EE > | |
MatrixBase & | elementwiseMultiplyFromLeftInPlace (const MatrixBase< EE > &) |
M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this. | |
template<class EE > | |
void | elementwiseMultiplyFromLeft (const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Mul &) const |
template<class EE > | |
MatrixBase< EE >::template EltResult< E >::Mul | elementwiseMultiplyFromLeft (const MatrixBase< EE > &m) const |
template<class EE > | |
MatrixBase & | elementwiseDivideInPlace (const MatrixBase< EE > &) |
M(i,j) /= R(i,j); R must have same dimensions as this. | |
template<class EE > | |
void | elementwiseDivide (const MatrixBase< EE > &, typename EltResult< EE >::Dvd &) const |
template<class EE > | |
EltResult< EE >::Dvd | elementwiseDivide (const MatrixBase< EE > &m) const |
template<class EE > | |
MatrixBase & | elementwiseDivideFromLeftInPlace (const MatrixBase< EE > &) |
M(i,j) = R(i,j) / M(i,j); R must have same dimensions as this. | |
template<class EE > | |
void | elementwiseDivideFromLeft (const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Dvd &) const |
template<class EE > | |
MatrixBase< EE >::template EltResult< EE >::Dvd | elementwiseDivideFromLeft (const MatrixBase< EE > &m) const |
MatrixBase & | setTo (const ELT &t) |
Fill every element in current allocation with given element (or NaN or 0). | |
MatrixBase & | setToNaN () |
MatrixBase & | setToZero () |
RowVectorView_< ELT > | row (int i) const |
RowVectorView_< ELT > | updRow (int i) |
VectorView_< ELT > | col (int j) const |
VectorView_< ELT > | updCol (int j) |
RowVectorView_< ELT > | operator[] (int i) const |
RowVectorView_< ELT > | operator[] (int i) |
VectorView_< ELT > | operator() (int j) const |
VectorView_< ELT > | operator() (int j) |
MatrixView_< ELT > | block (int i, int j, int m, int n) const |
MatrixView_< ELT > | updBlock (int i, int j, int m, int n) |
MatrixView_< ELT > | operator() (int i, int j, int m, int n) const |
MatrixView_< ELT > | operator() (int i, int j, int m, int n) |
MatrixView_< EHerm > | transpose () const |
MatrixView_< EHerm > | updTranspose () |
MatrixView_< EHerm > | operator~ () const |
MatrixView_< EHerm > | operator~ () |
VectorView_< ELT > | diag () const |
VectorView_< ELT > | updDiag () |
TInvert | invert () const |
void | invertInPlace () |
void | dump (const char *msg=0) const |
Matlab-compatible debug output. | |
template<class ELT_A , class ELT_B > | |
MatrixBase & | matmul (const StdNumber &beta, const StdNumber &alpha, const MatrixBase< ELT_A > &A, const MatrixBase< ELT_B > &B) |
const ELT & | getElt (int i, int j) const |
Element selection for stored elements. | |
ELT & | updElt (int i, int j) |
const ELT & | operator() (int i, int j) const |
ELT & | operator() (int i, int j) |
void | getAnyElt (int i, int j, ELT &value) const |
This returns a copy of the element value for any position in the logical matrix, regardless of whether it is stored in memory. | |
ELT | getAnyElt (int i, int j) const |
ScalarNormSq | scalarNormSqr () const |
Scalar norm square is sum( squares of all scalars ). | |
void | abs (TAbs &mabs) const |
abs() is elementwise absolute value; that is, the return value has the same dimension as this Matrix but with each element replaced by whatever it thinks its absolute value is. | |
TAbs | abs () const |
abs() with the result as a function return. | |
TStandard | standardize () const |
Return a Matrix of the same shape and contents as this one but with the element type converted to one based on the standard C++ scalar types: float, double, complex<float>, complex<double>. | |
ScalarNormSq | normSqr () const |
This is the scalar Frobenius norm, and its square. | |
CNT< ScalarNormSq >::TSqrt | norm () const |
CNT< ScalarNormSq >::TSqrt | normRMS () const |
We only allow RMS norm if the elements are scalars. | |
RowVectorBase< ELT > | sum () const |
Form the column sums of this matrix, returned as a RowVector. | |
const MatrixBase & | operator+ () const |
const TNeg & | negate () const |
TNeg & | updNegate () |
const TNeg & | operator- () const |
TNeg & | operator- () |
MatrixBase & | negateInPlace () |
MatrixBase & | resize (int m, int n) |
Change the size of this matrix. | |
MatrixBase & | resizeKeep (int m, int n) |
Change the size of this matrix, retaining as much of the old data as will fit. | |
void | lockShape () |
void | unlockShape () |
const MatrixView_< ELT > & | getAsMatrixView () const |
MatrixView_< ELT > & | updAsMatrixView () |
const Matrix_< ELT > & | getAsMatrix () const |
Matrix_< ELT > & | updAsMatrix () |
const VectorView_< ELT > & | getAsVectorView () const |
VectorView_< ELT > & | updAsVectorView () |
const Vector_< ELT > & | getAsVector () const |
Vector_< ELT > & | updAsVector () |
const VectorBase< ELT > & | getAsVectorBase () const |
VectorBase< ELT > & | updAsVectorBase () |
const RowVectorView_< ELT > & | getAsRowVectorView () const |
RowVectorView_< ELT > & | updAsRowVectorView () |
const RowVector_< ELT > & | getAsRowVector () const |
RowVector_< ELT > & | updAsRowVector () |
const RowVectorBase< ELT > & | getAsRowVectorBase () const |
RowVectorBase< ELT > & | updAsRowVectorBase () |
int | getNScalarsPerElement () const |
This is the number of consecutive scalars used to represent one element of type ELT. | |
int | getPackedSizeofElement () const |
This is like sizeof(ELT), but returning the number of bytes we use to store the element which may be fewer than what C++ would use. | |
bool | hasContiguousData () const |
ptrdiff_t | getContiguousScalarDataLength () const |
const Scalar * | getContiguousScalarData () const |
Scalar * | updContiguousScalarData () |
void | replaceContiguousScalarData (Scalar *newData, ptrdiff_t length, bool takeOwnership) |
void | replaceContiguousScalarData (const Scalar *newData, ptrdiff_t length) |
void | swapOwnedContiguousScalarData (Scalar *newData, ptrdiff_t length, Scalar *&oldData) |
MatrixBase (MatrixHelperRep< Scalar > *hrep) | |
Helper rep-stealing constructor. | |
template<class EE > | |
void | rowScale (const VectorBase< EE > &v, typename MatrixBase< ELT >::template EltResult< EE >::Mul &out) const |
template<class EE > | |
void | colScale (const VectorBase< EE > &v, typename MatrixBase< ELT >::template EltResult< EE >::Mul &out) const |
template<class S > | |
void | elementwiseAddScalar (const S &s, typename MatrixBase< ELT >::template EltResult< S >::Add &out) const |
template<class S > | |
void | elementwiseSubtractScalar (const S &s, typename MatrixBase< ELT >::template EltResult< S >::Sub &out) const |
template<class EE > | |
void | elementwiseMultiply (const MatrixBase< EE > &r, typename MatrixBase< ELT >::template EltResult< EE >::Mul &out) const |
template<class EE > | |
void | elementwiseDivide (const MatrixBase< EE > &r, typename MatrixBase< ELT >::template EltResult< EE >::Dvd &out) const |
Matrix view of pre-exising data | |
Non-resizeable view of someone else's already-allocated memory of a size and storage type indicated by the supplied MatrixCharacter. The spacing argument has different interpretations depending on the storage format. Typically it is the leading dimension for Lapack-style full storage or stride for a vector. Spacing is in units like "number of scalars between elements" or "number of scalars between columns" so it can be used to deal with C++ packing vs. Simmatrix packing if necessary. | |
MatrixBase (const MatrixCommitment &commitment, const MatrixCharacter &character, int spacing, const Scalar *data) | |
Construct a read-only view of pre-existing data. | |
MatrixBase (const MatrixCommitment &commitment, const MatrixCharacter &character, int spacing, Scalar *data) | |
Construct a writable view of pre-existing data. | |
Protected Member Functions | |
const MatrixHelper< Scalar > & | getHelper () const |
MatrixHelper< Scalar > & | updHelper () |
Friends | |
class | MatrixBase |
Variable-size 2d matrix of Composite Numerical Type (ELT) elements.
This is a container of such elements, it is NOT a Composite Numerical Type itself. MatrixBase<ELT> uses MatrixHelper<S> for implementation, where S is ELT::Scalar, that is, the underlying float, double, long double, complex<float>, negator<conjugate<double>>, etc. from which ELT is constructed. This is a finite set of which all members are explicitly instantiated in the implementation code, so clients don't have to know how anything is implemented.
MatrixBase is the only class in the Matrix/Vector family which has any data members (it has exactly one MatrixHelper, which itself consists only of a single pointer to an opaque class). Thus all other objects in this family (that is, derived from MatrixBase) are exactly the same size in memory and may be "reinterpreted" as appropriate. For example, a Vector may be reinterpreted as a Matrix or vice versa, provided runtime requirements are met (e.g., exactly 1 column).
Unlike the small matrix classes, very little is encoded in the type. Only the element type, and matrix vs. vector vs. row are in the type; everything else like shape, storage layout, and writability are handled at run time.
typedef ELT SimTK::MatrixBase< ELT >::E |
typedef CNT<E>::TNeg SimTK::MatrixBase< ELT >::ENeg |
typedef CNT<E>::TWithoutNegator SimTK::MatrixBase< ELT >::EWithoutNegator |
typedef CNT<E>::TReal SimTK::MatrixBase< ELT >::EReal |
typedef CNT<E>::TImag SimTK::MatrixBase< ELT >::EImag |
typedef CNT<E>::TComplex SimTK::MatrixBase< ELT >::EComplex |
typedef CNT<E>::THerm SimTK::MatrixBase< ELT >::EHerm |
typedef CNT<E>::TPosTrans SimTK::MatrixBase< ELT >::EPosTrans |
typedef CNT<E>::TAbs SimTK::MatrixBase< ELT >::EAbs |
typedef CNT<E>::TStandard SimTK::MatrixBase< ELT >::EStandard |
typedef CNT<E>::TInvert SimTK::MatrixBase< ELT >::EInvert |
typedef CNT<E>::TNormalize SimTK::MatrixBase< ELT >::ENormalize |
typedef CNT<E>::TSqHermT SimTK::MatrixBase< ELT >::ESqHermT |
typedef CNT<E>::TSqTHerm SimTK::MatrixBase< ELT >::ESqTHerm |
typedef CNT<E>::Scalar SimTK::MatrixBase< ELT >::EScalar |
typedef CNT<E>::Number SimTK::MatrixBase< ELT >::ENumber |
typedef CNT<E>::StdNumber SimTK::MatrixBase< ELT >::EStdNumber |
typedef CNT<E>::Precision SimTK::MatrixBase< ELT >::EPrecision |
typedef CNT<E>::ScalarNormSq SimTK::MatrixBase< ELT >::EScalarNormSq |
typedef EScalar SimTK::MatrixBase< ELT >::Scalar |
typedef ENumber SimTK::MatrixBase< ELT >::Number |
typedef EStdNumber SimTK::MatrixBase< ELT >::StdNumber |
typedef EPrecision SimTK::MatrixBase< ELT >::Precision |
typedef EScalarNormSq SimTK::MatrixBase< ELT >::ScalarNormSq |
typedef MatrixBase<E> SimTK::MatrixBase< ELT >::T |
typedef MatrixBase<ENeg> SimTK::MatrixBase< ELT >::TNeg |
typedef MatrixBase<EWithoutNegator> SimTK::MatrixBase< ELT >::TWithoutNegator |
typedef MatrixBase<EReal> SimTK::MatrixBase< ELT >::TReal |
typedef MatrixBase<EImag> SimTK::MatrixBase< ELT >::TImag |
typedef MatrixBase<EComplex> SimTK::MatrixBase< ELT >::TComplex |
typedef MatrixBase<EHerm> SimTK::MatrixBase< ELT >::THerm |
typedef MatrixBase<E> SimTK::MatrixBase< ELT >::TPosTrans |
typedef MatrixBase<EAbs> SimTK::MatrixBase< ELT >::TAbs |
typedef MatrixBase<EStandard> SimTK::MatrixBase< ELT >::TStandard |
typedef MatrixBase<EInvert> SimTK::MatrixBase< ELT >::TInvert |
typedef MatrixBase<ENormalize> SimTK::MatrixBase< ELT >::TNormalize |
typedef MatrixBase<ESqHermT> SimTK::MatrixBase< ELT >::TSqHermT |
typedef MatrixBase<ESqTHerm> SimTK::MatrixBase< ELT >::TSqTHerm |
SimTK::MatrixBase< ELT >::MatrixBase | ( | ) | [inline] |
The default constructor builds a 0x0 matrix managed by a helper that understands how many scalars there are in one of our elements but is otherwise uncommitted.
SimTK::MatrixBase< ELT >::MatrixBase | ( | int | m, |
int | n | ||
) | [inline] |
This constructor allocates the default matrix a completely uncommitted matrix commitment, given particular initial dimensions.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment | ) | [inline, explicit] |
This constructor takes a handle commitment and allocates the default matrix for that kind of commitment.
If a dimension is set to a particular (unchangeable) value in the commitment then the initial allocation will use that value. Unlocked dimensions are given the smallest value consistent with other committed attributes, typically 0.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
int | m, | ||
int | n | ||
) | [inline] |
This constructor takes a handle commitment and allocates the default matrix for that kind of commitment given particular initial minimum dimensions, which cannot be larger than those permitted by the commitment.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixBase< ELT > & | b | ) | [inline] |
Copy constructor is a deep copy (not appropriate for views!).
SimTK::MatrixBase< ELT >::MatrixBase | ( | const TNeg & | b | ) | [inline] |
Implicit conversion from matrix with negated elements (otherwise this is just like the copy constructor.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
int | m, | ||
int | n, | ||
const ELT & | initialValue | ||
) | [inline] |
Initializing constructor with all of the initially-allocated elements initialized to the same value.
The given dimensions are treated as minimum dimensions in case the commitment requires more. So it is always permissible to set them both to 0 in which case you'll get the smallest matrix that satisfies the commitment, with each of its elements (if any) set to the given initial value.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
int | m, | ||
int | n, | ||
const ELT * | cppInitialValuesByRow | ||
) | [inline] |
Initializing constructor with the initially-allocated elements initialized from a C++ array of elements, which is provided in row major order.
The given dimensions are treated as minimum dimensions in case the commitment requires more. The array is presumed to be long enough to supply a value for each element. Note that C++ packing for elements may be different than Simmatrix packing of the same elements (Simmatrix packs them more tightly in some cases). So you should not use this constructor to copy elements from one Simmatrix matrix to another; this is exclusively for initializing a Simmatrix from a C++ array.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
const MatrixCharacter & | character, | ||
int | spacing, | ||
const Scalar * | data | ||
) | [inline] |
Construct a read-only view of pre-existing data.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
const MatrixCharacter & | character, | ||
int | spacing, | ||
Scalar * | data | ||
) | [inline] |
Construct a writable view of pre-existing data.
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
MatrixHelper< Scalar > & | source, | ||
const typename MatrixHelper< Scalar >::ShallowCopy & | shallow | ||
) | [inline] |
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
const MatrixHelper< Scalar > & | source, | ||
const typename MatrixHelper< Scalar >::ShallowCopy & | shallow | ||
) | [inline] |
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixCommitment & | commitment, |
const MatrixHelper< Scalar > & | source, | ||
const typename MatrixHelper< Scalar >::DeepCopy & | deep | ||
) | [inline] |
SimTK::MatrixBase< ELT >::MatrixBase | ( | const MatrixBase< EE > & | b | ) | [inline] |
SimTK::MatrixBase< ELT >::MatrixBase | ( | MatrixHelperRep< Scalar > * | hrep | ) | [inline, explicit] |
Helper rep-stealing constructor.
We take over ownership of this rep here. Note that this defines the handle commitment for this handle. This is intended for internal use only -- don't call this constructor unless you really know what you're doing.
const MatrixCommitment& SimTK::MatrixBase< ELT >::getCharacterCommitment | ( | ) | const [inline] |
const MatrixCharacter& SimTK::MatrixBase< ELT >::getMatrixCharacter | ( | ) | const [inline] |
void SimTK::MatrixBase< ELT >::commitTo | ( | const MatrixCommitment & | mc | ) | [inline] |
Change the handle commitment for this matrix handle; only allowed if the handle is currently clear.
int SimTK::MatrixBase< ELT >::nrow | ( | ) | const [inline] |
Return the number of rows m in the logical shape of this matrix.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
int SimTK::MatrixBase< ELT >::ncol | ( | ) | const [inline] |
Return the number of columns n in the logical shape of this matrix.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
ptrdiff_t SimTK::MatrixBase< ELT >::nelt | ( | ) | const [inline] |
Return the number of elements in the logical shape of this matrix.
This has nothing to do with how many elements are actually stored; it is simply the product of the logical number of rows and columns, that is, nrow()*ncol(). Note that although each dimension is limited to a 32 bit size, the product of those dimensions may be > 32 bits on a 64 bit machine so the return type may be larger than that of nrow() and ncol().
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
bool SimTK::MatrixBase< ELT >::isResizeable | ( | ) | const [inline] |
Return true if either dimension of this Matrix is resizable.
MatrixBase& SimTK::MatrixBase< ELT >::copyAssign | ( | const MatrixBase< ELT > & | b | ) | [inline] |
Copy assignment is a deep copy but behavior depends on type of lhs: if view, rhs must match.
If owner, we reallocate and copy rhs.
MatrixBase& SimTK::MatrixBase< ELT >::operator= | ( | const MatrixBase< ELT > & | b | ) | [inline] |
MatrixBase& SimTK::MatrixBase< ELT >::viewAssign | ( | const MatrixBase< ELT > & | src | ) | [inline] |
View assignment is a shallow copy, meaning that we disconnect the MatrixBase from whatever it used to refer to (destructing as necessary), then make it a new view for the data descriptor referenced by the source.
CAUTION: we always take the source as const, but that is ignored in determining whether the resulting view is writable. Instead, that is inherited from the writability status of the source. We have to do this in order to allow temporary view objects to be writable -- the compiler creates temporaries like m(i,j,m,n) as const.
void SimTK::MatrixBase< ELT >::clear | ( | ) | [inline] |
This restores the MatrixBase to the state it would be in had it been constructed specifying only its handle commitment.
The size will have been reduced to the smallest size consistent with the commitment.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixBase& SimTK::MatrixBase< ELT >::operator*= | ( | const StdNumber & | t | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::MatrixView_< ELT >, SimTK::DeadMatrixView_< ELT >, SimTK::Matrix_< ELT >, SimTK::VectorView_< ELT >, SimTK::Vector_< ELT >, SimTK::RowVectorView_< ELT >, SimTK::RowVector_< ELT >, SimTK::VectorBase< T >, SimTK::VectorBase< Real >, SimTK::Vector_< T >, and SimTK::Vector_< Real >.
MatrixBase& SimTK::MatrixBase< ELT >::operator/= | ( | const StdNumber & | t | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::MatrixView_< ELT >, SimTK::DeadMatrixView_< ELT >, SimTK::Matrix_< ELT >, SimTK::VectorView_< ELT >, SimTK::Vector_< ELT >, SimTK::RowVectorView_< ELT >, SimTK::RowVector_< ELT >, SimTK::VectorBase< T >, SimTK::VectorBase< Real >, SimTK::Vector_< T >, and SimTK::Vector_< Real >.
MatrixBase& SimTK::MatrixBase< ELT >::operator+= | ( | const MatrixBase< ELT > & | r | ) | [inline] |
MatrixBase& SimTK::MatrixBase< ELT >::operator-= | ( | const MatrixBase< ELT > & | r | ) | [inline] |
MatrixBase& SimTK::MatrixBase< ELT >::operator= | ( | const MatrixBase< EE > & | b | ) | [inline] |
Reimplemented in SimTK::MatrixView_< ELT >, SimTK::DeadMatrixView_< ELT >, and SimTK::Matrix_< ELT >.
MatrixBase& SimTK::MatrixBase< ELT >::operator+= | ( | const MatrixBase< EE > & | b | ) | [inline] |
Reimplemented in SimTK::MatrixView_< ELT >, SimTK::DeadMatrixView_< ELT >, and SimTK::Matrix_< ELT >.
MatrixBase& SimTK::MatrixBase< ELT >::operator-= | ( | const MatrixBase< EE > & | b | ) | [inline] |
Reimplemented in SimTK::MatrixView_< ELT >, SimTK::DeadMatrixView_< ELT >, and SimTK::Matrix_< ELT >.
MatrixBase& SimTK::MatrixBase< ELT >::operator= | ( | const ELT & | t | ) | [inline] |
Matrix assignment to an element sets only the *diagonal* elements to the indicated value; everything else is set to zero.
This is particularly useful for setting a Matrix to zero or to the identity; for other values it creates a Matrix which acts like the scalar. That is, if the scalar is s and we do M=s, then multiplying another Matrix B by the resulting diagonal matrix M gives the same result as multiplying B by s. That is (M=s)*B == s*B.
NOTE: this must be overridden for Vector and RowVector since then scalar assignment is defined to copy the scalar to every element.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::MatrixView_< ELT >, SimTK::DeadMatrixView_< ELT >, SimTK::Matrix_< ELT >, SimTK::VectorView_< ELT >, SimTK::Vector_< ELT >, SimTK::RowVectorView_< ELT >, SimTK::RowVector_< ELT >, SimTK::VectorBase< T >, SimTK::VectorBase< Real >, SimTK::Vector_< T >, and SimTK::Vector_< Real >.
MatrixBase& SimTK::MatrixBase< ELT >::scalarAssign | ( | const S & | s | ) | [inline] |
Set M's diagonal elements to a "scalar" value S, and all off-diagonal elements to zero.
S can be any type which is assignable to an element of type E. This is the same as the Matrix assignment operator M=S for a scalar type S. It is overriden for Vector and Row types to behave as elementwiseScalarAssign.
MatrixBase& SimTK::MatrixBase< ELT >::scalarAddInPlace | ( | const S & | s | ) | [inline] |
Add a scalar to M's diagonal.
This is the same as the Matrix += operator. This is overridden for Vector and Row types to behave as elementwiseAddScalarInPlace.
MatrixBase& SimTK::MatrixBase< ELT >::scalarSubtractInPlace | ( | const S & | s | ) | [inline] |
Subtract a scalar from M's diagonal.
This is the same as the Matrix -= operator. This is overridden for Vector and Row types to behave as elementwiseSubtractScalarInPlace.
MatrixBase& SimTK::MatrixBase< ELT >::scalarSubtractFromLeftInPlace | ( | const S & | s | ) | [inline] |
Set M(i,i) = S - M(i,i), M(i,j) = -M(i,j) for i!=j.
This is overridden for Vector and Row types to behave as elementwiseSubtractFromScalarInPlace.
MatrixBase& SimTK::MatrixBase< ELT >::scalarMultiplyInPlace | ( | const S & | ) | [inline] |
Set M(i,j) = M(i,j)*S for some "scalar" S.
Actually S can be any type for which E = E*S makes sense. That is, S must be conformant with E and it must be possible to store the result back in an E. This is the *= operator for M *= S and behaves the same way for Matrix, Vector, and RowVector: every element gets multiplied in place on the right by S.
MatrixBase& SimTK::MatrixBase< ELT >::scalarMultiplyFromLeftInPlace | ( | const S & | ) | [inline] |
Set M(i,j) = S * M(i,j) for some "scalar" S.
This is the same as the above routine if S really is a scalar, but for S a more complicated CNT it will be different.
MatrixBase& SimTK::MatrixBase< ELT >::scalarDivideInPlace | ( | const S & | ) | [inline] |
Set M(i,j) = M(i,j)/S for some "scalar" S.
Actually S can be any type for which E = E/S makes sense. That is, S^-1 must be conformant with E and it must be possible to store the result back in an E. This is the /= operator for M /= S and behaves the same way for Matrix, Vector, and RowVector: every element gets divided in place on the right by S.
MatrixBase& SimTK::MatrixBase< ELT >::scalarDivideFromLeftInPlace | ( | const S & | ) | [inline] |
Set M(i,j) = S/M(i,j) for some "scalar" S.
Actually S can be any type for which E = S/E makes sense. That is, S must be conformant with E^-1 and it must be possible to store the result back in an E.
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::rowScaleInPlace | ( | const VectorBase< EE > & | v | ) | [inline] |
M = diag(r) * M; r must have nrow() elements.
That is, M[i] *= r[i].
Reimplemented in SimTK::VectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
void SimTK::MatrixBase< ELT >::rowScale | ( | const VectorBase< EE > & | r, |
typename EltResult< EE >::Mul & | out | ||
) | const [inline] |
Return type is a new matrix which will have the same dimensions as 'this' but will have element types appropriate for the elementwise multiply being performed.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
EltResult<EE>::Mul SimTK::MatrixBase< ELT >::rowScale | ( | const VectorBase< EE > & | r | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::colScaleInPlace | ( | const VectorBase< EE > & | v | ) | [inline] |
M = M * diag(c); c must have ncol() elements.
That is, M(j) *= c[j].
Reimplemented in SimTK::RowVectorBase< ELT >.
void SimTK::MatrixBase< ELT >::colScale | ( | const VectorBase< EE > & | c, |
typename EltResult< EE >::Mul & | out | ||
) | const [inline] |
Reimplemented in SimTK::RowVectorBase< ELT >.
EltResult<EE>::Mul SimTK::MatrixBase< ELT >::colScale | ( | const VectorBase< EE > & | c | ) | const [inline] |
Reimplemented in SimTK::RowVectorBase< ELT >.
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::rowAndColScaleInPlace | ( | const VectorBase< ER > & | r, |
const VectorBase< EC > & | c | ||
) | [inline] |
void SimTK::MatrixBase< ELT >::rowAndColScale | ( | const VectorBase< ER > & | r, |
const VectorBase< EC > & | c, | ||
typename EltResult< typename VectorBase< ER >::template EltResult< EC >::Mul >::Mul & | out | ||
) | const [inline] |
EltResult<typename VectorBase<ER>::template EltResult<EC>::Mul>::Mul SimTK::MatrixBase< ELT >::rowAndColScale | ( | const VectorBase< ER > & | r, |
const VectorBase< EC > & | c | ||
) | const [inline] |
MatrixBase& SimTK::MatrixBase< ELT >::elementwiseAssign | ( | const S & | s | ) | [inline] |
Set M(i,j)=s for every element of M and some value s.
This requires only that s be assignment compatible with M's elements; s doesn't actually have to be a scalar. Note that for Matrix types this behavior is different than scalar assignment, which puts the scalar only on M's diagonal and sets the rest of M to zero. For Vector and RowVector types, this operator is identical to the normal assignment operator and scalarAssignInPlace() method which also assign the scalar to every element.
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseInvertInPlace | ( | ) | [inline] |
Set M(i,j) = M(i,j)^-1.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
void SimTK::MatrixBase< ELT >::elementwiseInvert | ( | MatrixBase< typename CNT< E >::TInvert > & | out | ) | const [inline] |
MatrixBase<typename CNT<E>::TInvert> SimTK::MatrixBase< ELT >::elementwiseInvert | ( | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseAddScalarInPlace | ( | const S & | s | ) | [inline] |
Set M(i,j)+=s for every element of M and some value s.
This requires that s be conformant with M's elements (of type E) and that the result can be stored in an E. For Matrix types this behavior is different than the normal += or scalarAddInPlace() operators, which add the scalar only to the Matrix diagonal. For Vector and RowVector, this operator is identical to += and scalarAddInPlace() which also add the scalar to every element.
void SimTK::MatrixBase< ELT >::elementwiseAddScalar | ( | const S & | s, |
typename EltResult< S >::Add & | |||
) | const [inline] |
EltResult<S>::Add SimTK::MatrixBase< ELT >::elementwiseAddScalar | ( | const S & | s | ) | const [inline] |
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseSubtractScalarInPlace | ( | const S & | s | ) | [inline] |
Set M(i,j)-=s for every element of M and some value s.
This requires that s be conformant with M's elements (of type E) and that the result can be stored in an E. For Matrix types this behavior is different than the normal -= or scalarSubtractInPlace() operators, which subtract the scalar only from the Matrix diagonal. For Vector and RowVector, this operator is identical to -= and scalarSubtractInPlace() which also subtract the scalar from every element.
void SimTK::MatrixBase< ELT >::elementwiseSubtractScalar | ( | const S & | s, |
typename EltResult< S >::Sub & | |||
) | const [inline] |
EltResult<S>::Sub SimTK::MatrixBase< ELT >::elementwiseSubtractScalar | ( | const S & | s | ) | const [inline] |
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseSubtractFromScalarInPlace | ( | const S & | s | ) | [inline] |
Set M(i,j) = s - M(i,j) for every element of M and some value s.
This requires that s be conformant with M's elements (of type E) and that the result can be stored in an E. For Matrix types this behavior is different than the scalarSubtractFromLeftInPlace() operator, which subtracts only the diagonal elements of M from s, while simply negating the off diagonal elements. For Vector and RowVector, this operator is identical to scalarSubtractFromLeftInPlace() which also subtracts every element of M from the scalar.
void SimTK::MatrixBase< ELT >::elementwiseSubtractFromScalar | ( | const S & | s, |
typename MatrixBase< S >::template EltResult< E >::Sub & | out | ||
) | const [inline] |
MatrixBase<S>::template EltResult<E>::Sub SimTK::MatrixBase< ELT >::elementwiseSubtractFromScalar | ( | const S & | s | ) | const [inline] |
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseMultiplyInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) *= R(i,j); R must have same dimensions as this.
void SimTK::MatrixBase< ELT >::elementwiseMultiply | ( | const MatrixBase< EE > & | , |
typename EltResult< EE >::Mul & | |||
) | const [inline] |
EltResult<EE>::Mul SimTK::MatrixBase< ELT >::elementwiseMultiply | ( | const MatrixBase< EE > & | m | ) | const [inline] |
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseMultiplyFromLeftInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this.
void SimTK::MatrixBase< ELT >::elementwiseMultiplyFromLeft | ( | const MatrixBase< EE > & | r, |
typename MatrixBase< EE >::template EltResult< E >::Mul & | out | ||
) | const [inline] |
MatrixBase<EE>::template EltResult<E>::Mul SimTK::MatrixBase< ELT >::elementwiseMultiplyFromLeft | ( | const MatrixBase< EE > & | m | ) | const [inline] |
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseDivideInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) /= R(i,j); R must have same dimensions as this.
void SimTK::MatrixBase< ELT >::elementwiseDivide | ( | const MatrixBase< EE > & | , |
typename EltResult< EE >::Dvd & | |||
) | const [inline] |
EltResult<EE>::Dvd SimTK::MatrixBase< ELT >::elementwiseDivide | ( | const MatrixBase< EE > & | m | ) | const [inline] |
MatrixBase< ELT > & SimTK::MatrixBase< ELT >::elementwiseDivideFromLeftInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) = R(i,j) / M(i,j); R must have same dimensions as this.
void SimTK::MatrixBase< ELT >::elementwiseDivideFromLeft | ( | const MatrixBase< EE > & | r, |
typename MatrixBase< EE >::template EltResult< E >::Dvd & | out | ||
) | const [inline] |
MatrixBase<EE>::template EltResult<EE>::Dvd SimTK::MatrixBase< ELT >::elementwiseDivideFromLeft | ( | const MatrixBase< EE > & | m | ) | const [inline] |
MatrixBase& SimTK::MatrixBase< ELT >::setTo | ( | const ELT & | t | ) | [inline] |
Fill every element in current allocation with given element (or NaN or 0).
MatrixBase& SimTK::MatrixBase< ELT >::setToNaN | ( | ) | [inline] |
MatrixBase& SimTK::MatrixBase< ELT >::setToZero | ( | ) | [inline] |
RowVectorView_< ELT > SimTK::MatrixBase< ELT >::row | ( | int | i | ) | const [inline] |
RowVectorView_< ELT > SimTK::MatrixBase< ELT >::updRow | ( | int | i | ) | [inline] |
VectorView_< ELT > SimTK::MatrixBase< ELT >::col | ( | int | j | ) | const [inline] |
VectorView_< ELT > SimTK::MatrixBase< ELT >::updCol | ( | int | j | ) | [inline] |
RowVectorView_<ELT> SimTK::MatrixBase< ELT >::operator[] | ( | int | i | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
RowVectorView_<ELT> SimTK::MatrixBase< ELT >::operator[] | ( | int | i | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
VectorView_<ELT> SimTK::MatrixBase< ELT >::operator() | ( | int | j | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
VectorView_<ELT> SimTK::MatrixBase< ELT >::operator() | ( | int | j | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixView_< ELT > SimTK::MatrixBase< ELT >::block | ( | int | i, |
int | j, | ||
int | m, | ||
int | n | ||
) | const [inline] |
MatrixView_< ELT > SimTK::MatrixBase< ELT >::updBlock | ( | int | i, |
int | j, | ||
int | m, | ||
int | n | ||
) | [inline] |
MatrixView_<ELT> SimTK::MatrixBase< ELT >::operator() | ( | int | i, |
int | j, | ||
int | m, | ||
int | n | ||
) | const [inline] |
MatrixView_<ELT> SimTK::MatrixBase< ELT >::operator() | ( | int | i, |
int | j, | ||
int | m, | ||
int | n | ||
) | [inline] |
MatrixView_< typename CNT< E >::THerm > SimTK::MatrixBase< E >::transpose | ( | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixView_< typename CNT< E >::THerm > SimTK::MatrixBase< E >::updTranspose | ( | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixView_<EHerm> SimTK::MatrixBase< ELT >::operator~ | ( | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixView_<EHerm> SimTK::MatrixBase< ELT >::operator~ | ( | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
VectorView_< E > SimTK::MatrixBase< E >::diag | ( | ) | const [inline] |
VectorView_< E > SimTK::MatrixBase< E >::updDiag | ( | ) | [inline] |
TInvert SimTK::MatrixBase< ELT >::invert | ( | ) | const [inline] |
void SimTK::MatrixBase< ELT >::invertInPlace | ( | ) | [inline] |
void SimTK::MatrixBase< ELT >::dump | ( | const char * | msg = 0 | ) | const [inline] |
Matlab-compatible debug output.
MatrixBase& SimTK::MatrixBase< ELT >::matmul | ( | const StdNumber & | beta, |
const StdNumber & | alpha, | ||
const MatrixBase< ELT_A > & | A, | ||
const MatrixBase< ELT_B > & | B | ||
) | [inline] |
const ELT& SimTK::MatrixBase< ELT >::getElt | ( | int | i, |
int | j | ||
) | const [inline] |
Element selection for stored elements.
These are the fastest element access methods but may not be able to access all elements of the logical matrix when some of its elements are not stored in memory. For example, a Hermitian matrix stores only half its elements and other ones have to be calculated by conjugation if they are to be returned as type ELT. (You can get them for free by recasting the matrix so that the elements are reinterpreted as conjugates.) If you want to guarantee that you can access the value of every element of a matrix, stored or not, use getAnyElt() instead.
ELT& SimTK::MatrixBase< ELT >::updElt | ( | int | i, |
int | j | ||
) | [inline] |
const ELT& SimTK::MatrixBase< ELT >::operator() | ( | int | i, |
int | j | ||
) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
ELT& SimTK::MatrixBase< ELT >::operator() | ( | int | i, |
int | j | ||
) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
void SimTK::MatrixBase< ELT >::getAnyElt | ( | int | i, |
int | j, | ||
ELT & | value | ||
) | const [inline] |
ELT SimTK::MatrixBase< ELT >::getAnyElt | ( | int | i, |
int | j | ||
) | const [inline] |
ScalarNormSq SimTK::MatrixBase< ELT >::scalarNormSqr | ( | ) | const [inline] |
Scalar norm square is sum( squares of all scalars ).
Note that this is not very useful unless the elements are themselves scalars.
void SimTK::MatrixBase< ELT >::abs | ( | TAbs & | mabs | ) | const [inline] |
abs() is elementwise absolute value; that is, the return value has the same dimension as this Matrix but with each element replaced by whatever it thinks its absolute value is.
TAbs SimTK::MatrixBase< ELT >::abs | ( | ) | const [inline] |
abs() with the result as a function return.
More convenient than the other abs() member function, but may involve an additional copy of the matrix.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
TStandard SimTK::MatrixBase< ELT >::standardize | ( | ) | const [inline] |
Return a Matrix of the same shape and contents as this one but with the element type converted to one based on the standard C++ scalar types: float, double, complex<float>, complex<double>.
That is, negator<> and conjugate<> are eliminated from the element type by performing any needed negations computationally. Note that this is actually producing a new matrix with new data; you can also do this for free by reinterpreting the current matrix as a different type, if you don't mind looking at shared data.
ScalarNormSq SimTK::MatrixBase< ELT >::normSqr | ( | ) | const [inline] |
This is the scalar Frobenius norm, and its square.
Note: if this is a Matrix then the Frobenius norm is NOT the same as the 2-norm, although they are equivalent for Vectors.
CNT<ScalarNormSq>::TSqrt SimTK::MatrixBase< ELT >::norm | ( | ) | const [inline] |
CNT<ScalarNormSq>::TSqrt SimTK::MatrixBase< ELT >::normRMS | ( | ) | const [inline] |
We only allow RMS norm if the elements are scalars.
If there are no elements in this Matrix, we'll define its RMS norm to be 0, although NaN might be a better choice.
RowVectorBase<ELT> SimTK::MatrixBase< ELT >::sum | ( | ) | const [inline] |
Form the column sums of this matrix, returned as a RowVector.
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
const MatrixBase& SimTK::MatrixBase< ELT >::operator+ | ( | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
const TNeg& SimTK::MatrixBase< ELT >::negate | ( | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::Matrix_< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
TNeg& SimTK::MatrixBase< ELT >::updNegate | ( | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::Matrix_< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
const TNeg& SimTK::MatrixBase< ELT >::operator- | ( | ) | const [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::Matrix_< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
TNeg& SimTK::MatrixBase< ELT >::operator- | ( | ) | [inline] |
Reimplemented in SimTK::VectorBase< ELT >, SimTK::RowVectorBase< ELT >, SimTK::Matrix_< ELT >, SimTK::VectorBase< T >, and SimTK::VectorBase< Real >.
MatrixBase& SimTK::MatrixBase< ELT >::negateInPlace | ( | ) | [inline] |
MatrixBase& SimTK::MatrixBase< ELT >::resize | ( | int | m, |
int | n | ||
) | [inline] |
Change the size of this matrix.
This is only allowed for owner matrices. The current storage format is retained, but all the data is lost. If you want to keep the old data, use resizeKeep().
MatrixBase& SimTK::MatrixBase< ELT >::resizeKeep | ( | int | m, |
int | n | ||
) | [inline] |
Change the size of this matrix, retaining as much of the old data as will fit.
This is only allowed for owner matrices. The current storage format is retained, and the existing data is copied into the new memory to the extent that it will fit.
void SimTK::MatrixBase< ELT >::lockShape | ( | ) | [inline] |
void SimTK::MatrixBase< ELT >::unlockShape | ( | ) | [inline] |
const MatrixView_<ELT>& SimTK::MatrixBase< ELT >::getAsMatrixView | ( | ) | const [inline] |
MatrixView_<ELT>& SimTK::MatrixBase< ELT >::updAsMatrixView | ( | ) | [inline] |
const Matrix_<ELT>& SimTK::MatrixBase< ELT >::getAsMatrix | ( | ) | const [inline] |
Matrix_<ELT>& SimTK::MatrixBase< ELT >::updAsMatrix | ( | ) | [inline] |
const VectorView_<ELT>& SimTK::MatrixBase< ELT >::getAsVectorView | ( | ) | const [inline] |
VectorView_<ELT>& SimTK::MatrixBase< ELT >::updAsVectorView | ( | ) | [inline] |
const Vector_<ELT>& SimTK::MatrixBase< ELT >::getAsVector | ( | ) | const [inline] |
Vector_<ELT>& SimTK::MatrixBase< ELT >::updAsVector | ( | ) | [inline] |
const VectorBase<ELT>& SimTK::MatrixBase< ELT >::getAsVectorBase | ( | ) | const [inline] |
VectorBase<ELT>& SimTK::MatrixBase< ELT >::updAsVectorBase | ( | ) | [inline] |
const RowVectorView_<ELT>& SimTK::MatrixBase< ELT >::getAsRowVectorView | ( | ) | const [inline] |
RowVectorView_<ELT>& SimTK::MatrixBase< ELT >::updAsRowVectorView | ( | ) | [inline] |
const RowVector_<ELT>& SimTK::MatrixBase< ELT >::getAsRowVector | ( | ) | const [inline] |
RowVector_<ELT>& SimTK::MatrixBase< ELT >::updAsRowVector | ( | ) | [inline] |
const RowVectorBase<ELT>& SimTK::MatrixBase< ELT >::getAsRowVectorBase | ( | ) | const [inline] |
RowVectorBase<ELT>& SimTK::MatrixBase< ELT >::updAsRowVectorBase | ( | ) | [inline] |
int SimTK::MatrixBase< ELT >::getNScalarsPerElement | ( | ) | const [inline] |
This is the number of consecutive scalars used to represent one element of type ELT.
This may be fewer than C++ would use for the element, since it may introduce some padding.
int SimTK::MatrixBase< ELT >::getPackedSizeofElement | ( | ) | const [inline] |
This is like sizeof(ELT), but returning the number of bytes we use to store the element which may be fewer than what C++ would use.
We store these packed elements adjacent to one another in memory.
bool SimTK::MatrixBase< ELT >::hasContiguousData | ( | ) | const [inline] |
ptrdiff_t SimTK::MatrixBase< ELT >::getContiguousScalarDataLength | ( | ) | const [inline] |
const Scalar* SimTK::MatrixBase< ELT >::getContiguousScalarData | ( | ) | const [inline] |
Scalar* SimTK::MatrixBase< ELT >::updContiguousScalarData | ( | ) | [inline] |
void SimTK::MatrixBase< ELT >::replaceContiguousScalarData | ( | Scalar * | newData, |
ptrdiff_t | length, | ||
bool | takeOwnership | ||
) | [inline] |
void SimTK::MatrixBase< ELT >::replaceContiguousScalarData | ( | const Scalar * | newData, |
ptrdiff_t | length | ||
) | [inline] |
void SimTK::MatrixBase< ELT >::swapOwnedContiguousScalarData | ( | Scalar * | newData, |
ptrdiff_t | length, | ||
Scalar *& | oldData | ||
) | [inline] |
const MatrixHelper<Scalar>& SimTK::MatrixBase< ELT >::getHelper | ( | ) | const [inline, protected] |
MatrixHelper<Scalar>& SimTK::MatrixBase< ELT >::updHelper | ( | ) | [inline, protected] |
void SimTK::MatrixBase< ELT >::rowScale | ( | const VectorBase< EE > & | v, |
typename MatrixBase< ELT >::template EltResult< EE >::Mul & | out | ||
) | const [inline] |
void SimTK::MatrixBase< ELT >::colScale | ( | const VectorBase< EE > & | v, |
typename MatrixBase< ELT >::template EltResult< EE >::Mul & | out | ||
) | const [inline] |
void SimTK::MatrixBase< ELT >::elementwiseAddScalar | ( | const S & | s, |
typename MatrixBase< ELT >::template EltResult< S >::Add & | out | ||
) | const [inline] |
void SimTK::MatrixBase< ELT >::elementwiseSubtractScalar | ( | const S & | s, |
typename MatrixBase< ELT >::template EltResult< S >::Sub & | out | ||
) | const [inline] |
void SimTK::MatrixBase< ELT >::elementwiseMultiply | ( | const MatrixBase< EE > & | r, |
typename MatrixBase< ELT >::template EltResult< EE >::Mul & | out | ||
) | const [inline] |
void SimTK::MatrixBase< ELT >::elementwiseDivide | ( | const MatrixBase< EE > & | r, |
typename MatrixBase< ELT >::template EltResult< EE >::Dvd & | out | ||
) | const [inline] |
friend class MatrixBase [friend] |