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. | |
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 | lockNRows () |
void | lockNCols () |
void | lockShape () |
void | unlockNRows () |
void | unlockNCols () |
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 |
long | getContiguousScalarDataLength () const |
const Scalar * | getContiguousScalarData () const |
Scalar * | updContiguousScalarData () |
void | replaceContiguousScalarData (Scalar *newData, long length, bool takeOwnership) |
void | replaceContiguousScalarData (const Scalar *newData, long length) |
void | swapOwnedContiguousScalarData (Scalar *newData, int 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 E |
typedef CNT<E>::TNormalize ENormalize |
typedef CNT<E>::Precision EPrecision |
typedef CNT<E>::ScalarNormSq EScalarNormSq |
typedef CNT<E>::StdNumber EStdNumber |
typedef CNT<E>::TWithoutNegator EWithoutNegator |
typedef EPrecision Precision |
typedef EScalarNormSq ScalarNormSq |
typedef EStdNumber StdNumber |
typedef MatrixBase<E> T |
typedef MatrixBase<EAbs> TAbs |
typedef MatrixBase<EComplex> TComplex |
typedef MatrixBase<EHerm> THerm |
typedef MatrixBase<EImag> TImag |
typedef MatrixBase<EInvert> TInvert |
typedef MatrixBase<ENeg> TNeg |
typedef MatrixBase<ENormalize> TNormalize |
typedef MatrixBase<E> TPosTrans |
typedef MatrixBase<EReal> TReal |
typedef MatrixBase<ESqHermT> TSqHermT |
typedef MatrixBase<ESqTHerm> TSqTHerm |
typedef MatrixBase<EStandard> TStandard |
typedef MatrixBase<EWithoutNegator> TWithoutNegator |
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.
MatrixBase | ( | int | m, | |
int | n | |||
) | [inline] |
This constructor allocates the default matrix a completely uncommitted matrix commitment, given particular initial dimensions.
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.
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.
MatrixBase | ( | const MatrixBase< ELT > & | b | ) | [inline] |
Copy constructor is a deep copy (not appropriate for views!).
MatrixBase | ( | const TNeg & | b | ) | [inline] |
Implicit conversion from matrix with negated elements (otherwise this is just like the copy constructor.
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.
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.
MatrixBase | ( | const MatrixCommitment & | commitment, | |
const MatrixCharacter & | character, | |||
int | spacing, | |||
const Scalar * | data | |||
) | [inline] |
Construct a read-only view of pre-existing data.
MatrixBase | ( | const MatrixCommitment & | commitment, | |
const MatrixCharacter & | character, | |||
int | spacing, | |||
Scalar * | data | |||
) | [inline] |
Construct a writable view of pre-existing data.
MatrixBase | ( | const MatrixCommitment & | commitment, | |
MatrixHelper< Scalar > & | source, | |||
const typename MatrixHelper< Scalar >::ShallowCopy & | shallow | |||
) | [inline] |
MatrixBase | ( | const MatrixCommitment & | commitment, | |
const MatrixHelper< Scalar > & | source, | |||
const typename MatrixHelper< Scalar >::ShallowCopy & | shallow | |||
) | [inline] |
MatrixBase | ( | const MatrixCommitment & | commitment, | |
const MatrixHelper< Scalar > & | source, | |||
const typename MatrixHelper< Scalar >::DeepCopy & | deep | |||
) | [inline] |
MatrixBase | ( | const MatrixBase< EE > & | b | ) | [inline] |
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.
TAbs 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 VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by RowVectorBase< ELT >::abs(), VectorBase< Real >::abs(), and MatrixBase< Real >::abs().
void 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.
Referenced by SimTK::abs().
MatrixView_< ELT > block | ( | int | i, | |
int | j, | |||
int | m, | |||
int | n | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), SimTK_INDEXCHECK, SimTK_SIZECHECK, and MatrixHelper< S >::stealRep().
Referenced by MatrixBase< Real >::operator()().
void 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 VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by RowVectorBase< ELT >::clear(), and VectorBase< Real >::clear().
VectorView_< ELT > col | ( | int | j | ) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), SimTK_INDEXCHECK, and MatrixHelper< S >::stealRep().
Referenced by SimTK::median(), MatrixBase< Real >::operator()(), and SimTK::sort().
void colScale | ( | const VectorBase< EE > & | v, | |
typename MatrixBase< ELT >::template EltResult< EE >::Mul & | out | |||
) | const [inline] |
EltResult<EE>::Mul colScale | ( | const VectorBase< EE > & | c | ) | const [inline] |
Reimplemented in RowVectorBase< ELT >.
void colScale | ( | const VectorBase< EE > & | c, | |
typename EltResult< EE >::Mul & | out | |||
) | const [inline] |
Reimplemented in RowVectorBase< ELT >.
Referenced by MatrixBase< Real >::colScale().
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 RowVectorBase< ELT >.
References MatrixBase< ELT >::ncol(), and VectorBase< ELT >::nrow().
void commitTo | ( | const MatrixCommitment & | mc | ) | [inline] |
Change the handle commitment for this matrix handle; only allowed if the handle is currently clear.
MatrixBase& 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.
Referenced by MatrixBase< Real >::operator=().
VectorView_< E > diag | ( | ) | const [inline] |
References MatrixHelper< S >::stealRep().
void dump | ( | const char * | msg = 0 |
) | const [inline] |
Matlab-compatible debug output.
void elementwiseAddScalar | ( | const S & | s, | |
typename MatrixBase< ELT >::template EltResult< S >::Add & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::resize().
EltResult<S>::Add elementwiseAddScalar | ( | const S & | s | ) | const [inline] |
void elementwiseAddScalar | ( | const S & | s, | |
typename EltResult< S >::Add & | ||||
) | const [inline] |
Referenced by MatrixBase< Real >::elementwiseAddScalar().
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.
References MatrixBase< ELT >::ncol(), and MatrixBase< ELT >::nrow().
Referenced by RowVector_< ELT >::operator+=(), RowVectorView_< ELT >::operator+=(), Vector_< Real >::operator+=(), and VectorView_< ELT >::operator+=().
MatrixBase& 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.
void elementwiseDivide | ( | const MatrixBase< EE > & | r, | |
typename MatrixBase< ELT >::template EltResult< EE >::Dvd & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::resize().
EltResult<EE>::Dvd elementwiseDivide | ( | const MatrixBase< EE > & | m | ) | const [inline] |
void elementwiseDivide | ( | const MatrixBase< EE > & | , | |
typename EltResult< EE >::Dvd & | ||||
) | const [inline] |
MatrixBase<EE>::template EltResult<EE>::Dvd elementwiseDivideFromLeft | ( | const MatrixBase< EE > & | m | ) | const [inline] |
void elementwiseDivideFromLeft | ( | const MatrixBase< EE > & | r, | |
typename MatrixBase< EE >::template EltResult< E >::Dvd & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::resize().
MatrixBase< ELT > & elementwiseDivideFromLeftInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) = R(i,j) / M(i,j); R must have same dimensions as this.
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::updElt().
MatrixBase< ELT > & elementwiseDivideInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) /= R(i,j); R must have same dimensions as this.
References MatrixBase< ELT >::ncol(), and MatrixBase< ELT >::nrow().
MatrixBase<typename CNT<E>::TInvert> elementwiseInvert | ( | ) | const [inline] |
Reimplemented in VectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by VectorBase< Real >::elementwiseInvert(), and MatrixBase< Real >::elementwiseInvert().
void elementwiseInvert | ( | MatrixBase< typename CNT< E >::TInvert > & | out | ) | const [inline] |
References MatrixBase< ELT >::invert(), MatrixBase< ELT >::ncol(), and MatrixBase< ELT >::nrow().
MatrixBase< ELT > & elementwiseInvertInPlace | ( | ) | [inline] |
Set M(i,j) = M(i,j)^-1.
Reimplemented in VectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
References MatrixBase< ELT >::invert(), MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::updElt().
Referenced by VectorBase< Real >::elementwiseInvertInPlace().
void elementwiseMultiply | ( | const MatrixBase< EE > & | r, | |
typename MatrixBase< ELT >::template EltResult< EE >::Mul & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::resize().
EltResult<EE>::Mul elementwiseMultiply | ( | const MatrixBase< EE > & | m | ) | const [inline] |
void elementwiseMultiply | ( | const MatrixBase< EE > & | , | |
typename EltResult< EE >::Mul & | ||||
) | const [inline] |
MatrixBase<EE>::template EltResult<E>::Mul elementwiseMultiplyFromLeft | ( | const MatrixBase< EE > & | m | ) | const [inline] |
void elementwiseMultiplyFromLeft | ( | const MatrixBase< EE > & | r, | |
typename MatrixBase< EE >::template EltResult< E >::Mul & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::resize().
MatrixBase< ELT > & elementwiseMultiplyFromLeftInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this.
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::updElt().
MatrixBase< ELT > & elementwiseMultiplyInPlace | ( | const MatrixBase< EE > & | r | ) | [inline] |
M(i,j) *= R(i,j); R must have same dimensions as this.
References MatrixBase< ELT >::ncol(), and MatrixBase< ELT >::nrow().
MatrixBase<S>::template EltResult<E>::Sub elementwiseSubtractFromScalar | ( | const S & | s | ) | const [inline] |
void elementwiseSubtractFromScalar | ( | const S & | s, | |
typename MatrixBase< S >::template EltResult< E >::Sub & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::resize().
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.
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::updElt().
void elementwiseSubtractScalar | ( | const S & | s, | |
typename MatrixBase< ELT >::template EltResult< S >::Sub & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and MatrixBase< ELT >::resize().
EltResult<S>::Sub elementwiseSubtractScalar | ( | const S & | s | ) | const [inline] |
void elementwiseSubtractScalar | ( | const S & | s, | |
typename EltResult< S >::Sub & | ||||
) | const [inline] |
Referenced by MatrixBase< Real >::elementwiseSubtractScalar().
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.
References MatrixBase< ELT >::ncol(), and MatrixBase< ELT >::nrow().
Referenced by RowVector_< ELT >::operator-=(), RowVectorView_< ELT >::operator-=(), Vector_< Real >::operator-=(), and VectorView_< ELT >::operator-=().
ELT getAnyElt | ( | int | i, | |
int | j | |||
) | const [inline] |
Referenced by MatrixBase< Real >::getAnyElt().
void getAnyElt | ( | int | i, | |
int | j, | |||
ELT & | value | |||
) | const [inline] |
const Matrix_<ELT>& getAsMatrix | ( | ) | const [inline] |
const MatrixView_<ELT>& getAsMatrixView | ( | ) | const [inline] |
const RowVector_<ELT>& getAsRowVector | ( | ) | const [inline] |
const RowVectorBase<ELT>& getAsRowVectorBase | ( | ) | const [inline] |
const RowVectorView_<ELT>& getAsRowVectorView | ( | ) | const [inline] |
const Vector_<ELT>& getAsVector | ( | ) | const [inline] |
const VectorBase<ELT>& getAsVectorBase | ( | ) | const [inline] |
const VectorView_<ELT>& getAsVectorView | ( | ) | const [inline] |
const MatrixCommitment& getCharacterCommitment | ( | ) | const [inline] |
Referenced by VectorBase< Real >::index(), MatrixView_< ELT >::operator=(), and VectorBase< Real >::updIndex().
const Scalar* getContiguousScalarData | ( | ) | const [inline] |
long getContiguousScalarDataLength | ( | ) | const [inline] |
const 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.
Referenced by MatrixBase< Real >::operator()().
const MatrixHelper<Scalar>& getHelper | ( | ) | const [inline, protected] |
Referenced by RowVectorBase< ELT >::index(), VectorBase< Real >::index(), RowVectorBase< ELT >::operator()(), VectorBase< Real >::operator()(), MatrixView_< ELT >::operator=(), RowVectorBase< ELT >::operator[](), VectorBase< Real >::operator[](), RowVectorBase< ELT >::sum(), VectorBase< Real >::sum(), and VectorBase< Real >::updIndex().
const MatrixCharacter& getMatrixCharacter | ( | ) | const [inline] |
Referenced by MatrixView_< ELT >::operator=().
int 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 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 hasContiguousData | ( | ) | const [inline] |
Referenced by GCVSPLUtil::gcvspl(), and GCVSPLUtil::splder().
TInvert invert | ( | ) | const [inline] |
Referenced by MatrixBase< ELT >::elementwiseInvert(), and MatrixBase< ELT >::elementwiseInvertInPlace().
void invertInPlace | ( | ) | [inline] |
void lockNCols | ( | ) | [inline] |
void lockNRows | ( | ) | [inline] |
void lockShape | ( | ) | [inline] |
MatrixBase& matmul | ( | const StdNumber & | beta, | |
const StdNumber & | alpha, | |||
const MatrixBase< ELT_A > & | A, | |||
const MatrixBase< ELT_B > & | B | |||
) | [inline] |
int ncol | ( | ) | const [inline] |
Return the number of columns n in the logical shape of this matrix.
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by MatrixBase< Real >::abs(), MatrixBase< ELT >::block(), MatrixBase< ELT >::col(), MatrixBase< ELT >::colScale(), MatrixBase< Real >::colScale(), MatrixBase< ELT >::colScaleInPlace(), MatrixBase< ELT >::elementwiseAddScalar(), MatrixBase< Real >::elementwiseAddScalar(), MatrixBase< ELT >::elementwiseAddScalarInPlace(), MatrixBase< ELT >::elementwiseDivide(), MatrixBase< Real >::elementwiseDivide(), MatrixBase< ELT >::elementwiseDivideFromLeft(), MatrixBase< Real >::elementwiseDivideFromLeft(), MatrixBase< ELT >::elementwiseDivideFromLeftInPlace(), MatrixBase< ELT >::elementwiseDivideInPlace(), MatrixBase< ELT >::elementwiseInvert(), MatrixBase< Real >::elementwiseInvert(), MatrixBase< ELT >::elementwiseInvertInPlace(), MatrixBase< ELT >::elementwiseMultiply(), MatrixBase< Real >::elementwiseMultiply(), MatrixBase< ELT >::elementwiseMultiplyFromLeft(), MatrixBase< Real >::elementwiseMultiplyFromLeft(), MatrixBase< ELT >::elementwiseMultiplyFromLeftInPlace(), MatrixBase< ELT >::elementwiseMultiplyInPlace(), MatrixBase< ELT >::elementwiseSubtractFromScalar(), MatrixBase< Real >::elementwiseSubtractFromScalar(), MatrixBase< ELT >::elementwiseSubtractFromScalarInPlace(), MatrixBase< ELT >::elementwiseSubtractScalar(), MatrixBase< Real >::elementwiseSubtractScalar(), MatrixBase< ELT >::elementwiseSubtractScalarInPlace(), MatrixBase< Real >::getAsVector(), MatrixBase< Real >::getAsVectorBase(), MatrixBase< Real >::getAsVectorView(), SimTK::max(), SimTK::median(), SimTK::min(), RowVectorBase< ELT >::ncol(), VectorBase< Real >::ncol(), VectorBase< Real >::nelt(), VectorBase< Real >::nrow(), Test::numericallyEqual(), SimTK::operator*(), SimTK::operator-(), MatrixBase< ELT >::row(), MatrixBase< ELT >::rowAndColScale(), MatrixBase< Real >::rowAndColScale(), MatrixBase< ELT >::rowAndColScaleInPlace(), MatrixBase< ELT >::rowScale(), MatrixBase< Real >::rowScale(), MatrixBase< Real >::scalarNormSqr(), VectorBase< Real >::size(), SimTK::sort(), MatrixBase< Real >::standardize(), MatrixBase< Real >::sum(), MatrixBase< Real >::updAsVector(), MatrixBase< Real >::updAsVectorBase(), MatrixBase< Real >::updAsVectorView(), MatrixBase< ELT >::updBlock(), MatrixBase< ELT >::updCol(), and MatrixBase< ELT >::updRow().
const TNeg& negate | ( | ) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, Matrix_< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by MatrixBase< Real >::operator-().
MatrixBase& negateInPlace | ( | ) | [inline] |
Referenced by MatrixBase< Real >::scalarSubtractFromLeftInPlace().
ptrdiff_t 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 VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by RowVectorBase< ELT >::nelt(), VectorBase< Real >::nelt(), MatrixBase< Real >::normRMS(), RowVectorBase< ELT >::size(), and VectorBase< Real >::size().
CNT<ScalarNormSq>::TSqrt norm | ( | ) | const [inline] |
CNT<ScalarNormSq>::TSqrt 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.
ScalarNormSq 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.
int nrow | ( | ) | const [inline] |
Return the number of rows m in the logical shape of this matrix.
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by MatrixBase< Real >::abs(), MatrixBase< ELT >::block(), MatrixBase< ELT >::col(), MatrixBase< ELT >::colScale(), MatrixBase< Real >::colScale(), MatrixBase< ELT >::elementwiseAddScalar(), MatrixBase< Real >::elementwiseAddScalar(), MatrixBase< ELT >::elementwiseAddScalarInPlace(), MatrixBase< ELT >::elementwiseDivide(), MatrixBase< Real >::elementwiseDivide(), MatrixBase< ELT >::elementwiseDivideFromLeft(), MatrixBase< Real >::elementwiseDivideFromLeft(), MatrixBase< ELT >::elementwiseDivideFromLeftInPlace(), MatrixBase< ELT >::elementwiseDivideInPlace(), MatrixBase< ELT >::elementwiseInvert(), MatrixBase< Real >::elementwiseInvert(), MatrixBase< ELT >::elementwiseInvertInPlace(), MatrixBase< ELT >::elementwiseMultiply(), MatrixBase< Real >::elementwiseMultiply(), MatrixBase< ELT >::elementwiseMultiplyFromLeft(), MatrixBase< Real >::elementwiseMultiplyFromLeft(), MatrixBase< ELT >::elementwiseMultiplyFromLeftInPlace(), MatrixBase< ELT >::elementwiseMultiplyInPlace(), MatrixBase< ELT >::elementwiseSubtractFromScalar(), MatrixBase< Real >::elementwiseSubtractFromScalar(), MatrixBase< ELT >::elementwiseSubtractFromScalarInPlace(), MatrixBase< ELT >::elementwiseSubtractScalar(), MatrixBase< Real >::elementwiseSubtractScalar(), MatrixBase< ELT >::elementwiseSubtractScalarInPlace(), MatrixBase< Real >::getAsRowVector(), MatrixBase< Real >::getAsRowVectorBase(), MatrixBase< Real >::getAsRowVectorView(), SimTK::mean(), SimTK::median(), RowVectorBase< ELT >::ncol(), RowVectorBase< ELT >::nelt(), RowVectorBase< ELT >::nrow(), VectorBase< Real >::nrow(), Test::numericallyEqual(), SimTK::operator*(), SimTK::operator-(), MatrixBase< ELT >::row(), MatrixBase< ELT >::rowAndColScale(), MatrixBase< Real >::rowAndColScale(), MatrixBase< ELT >::rowAndColScaleInPlace(), MatrixBase< ELT >::rowScale(), MatrixBase< Real >::rowScale(), MatrixBase< ELT >::rowScaleInPlace(), MatrixBase< Real >::scalarNormSqr(), RowVectorBase< ELT >::size(), SimTK::sort(), MatrixBase< Real >::standardize(), MatrixBase< Real >::updAsRowVector(), MatrixBase< Real >::updAsRowVectorBase(), MatrixBase< Real >::updAsRowVectorView(), MatrixBase< ELT >::updBlock(), MatrixBase< ELT >::updCol(), and MatrixBase< ELT >::updRow().
ELT& operator() | ( | int | i, | |
int | j | |||
) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
const ELT& operator() | ( | int | i, | |
int | j | |||
) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
MatrixView_<ELT> operator() | ( | int | i, | |
int | j, | |||
int | m, | |||
int | n | |||
) | [inline] |
MatrixView_<ELT> operator() | ( | int | i, | |
int | j, | |||
int | m, | |||
int | n | |||
) | const [inline] |
VectorView_<ELT> operator() | ( | int | j | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
VectorView_<ELT> operator() | ( | int | j | ) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by RowVectorBase< ELT >::operator()(), and VectorBase< Real >::operator()().
MatrixBase& operator*= | ( | const StdNumber & | t | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, MatrixView_< ELT >, DeadMatrixView_< ELT >, Matrix_< ELT >, VectorView_< ELT >, Vector_< ELT >, RowVectorView_< ELT >, RowVector_< ELT >, VectorBase< T >, VectorBase< Real >, Vector_< T >, and Vector_< Real >.
Referenced by Matrix_< ELT >::operator*=(), MatrixView_< ELT >::operator*=(), RowVectorBase< ELT >::operator*=(), and VectorBase< Real >::operator*=().
const MatrixBase& operator+ | ( | ) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
MatrixBase& operator+= | ( | const MatrixBase< EE > & | b | ) | [inline] |
Reimplemented in MatrixView_< ELT >, DeadMatrixView_< ELT >, and Matrix_< ELT >.
MatrixBase& operator+= | ( | const MatrixBase< ELT > & | r | ) | [inline] |
TNeg& operator- | ( | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, Matrix_< ELT >, VectorBase< T >, and VectorBase< Real >.
const TNeg& operator- | ( | ) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, Matrix_< ELT >, VectorBase< T >, and VectorBase< Real >.
MatrixBase& operator-= | ( | const MatrixBase< EE > & | b | ) | [inline] |
Reimplemented in MatrixView_< ELT >, DeadMatrixView_< ELT >, and Matrix_< ELT >.
MatrixBase& operator-= | ( | const MatrixBase< ELT > & | r | ) | [inline] |
MatrixBase& operator/= | ( | const StdNumber & | t | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, MatrixView_< ELT >, DeadMatrixView_< ELT >, Matrix_< ELT >, VectorView_< ELT >, Vector_< ELT >, RowVectorView_< ELT >, RowVector_< ELT >, VectorBase< T >, VectorBase< Real >, Vector_< T >, and Vector_< Real >.
Referenced by Matrix_< ELT >::operator/=(), MatrixView_< ELT >::operator/=(), RowVectorBase< ELT >::operator/=(), and VectorBase< Real >::operator/=().
MatrixBase& 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 VectorBase< ELT >, RowVectorBase< ELT >, MatrixView_< ELT >, DeadMatrixView_< ELT >, Matrix_< ELT >, VectorView_< ELT >, Vector_< ELT >, RowVectorView_< ELT >, RowVector_< ELT >, VectorBase< T >, VectorBase< Real >, Vector_< T >, and Vector_< Real >.
MatrixBase& operator= | ( | const MatrixBase< EE > & | b | ) | [inline] |
Reimplemented in MatrixView_< ELT >, DeadMatrixView_< ELT >, and Matrix_< ELT >.
MatrixBase& operator= | ( | const MatrixBase< ELT > & | b | ) | [inline] |
RowVectorView_<ELT> operator[] | ( | int | i | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
RowVectorView_<ELT> operator[] | ( | int | i | ) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
MatrixView_<EHerm> operator~ | ( | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
MatrixView_<EHerm> operator~ | ( | ) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
void replaceContiguousScalarData | ( | const Scalar * | newData, | |
long | length | |||
) | [inline] |
void replaceContiguousScalarData | ( | Scalar * | newData, | |
long | length, | |||
bool | takeOwnership | |||
) | [inline] |
MatrixBase& 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().
Referenced by MatrixBase< Real >::abs(), RowVectorBase< ELT >::clear(), VectorBase< Real >::clear(), MatrixBase< ELT >::colScale(), MatrixBase< ELT >::elementwiseAddScalar(), MatrixBase< ELT >::elementwiseDivide(), MatrixBase< ELT >::elementwiseDivideFromLeft(), MatrixBase< ELT >::elementwiseMultiply(), MatrixBase< ELT >::elementwiseMultiplyFromLeft(), MatrixBase< ELT >::elementwiseSubtractFromScalar(), MatrixBase< ELT >::elementwiseSubtractScalar(), RowVectorBase< ELT >::resize(), VectorBase< Real >::resize(), and MatrixBase< ELT >::rowScale().
MatrixBase& 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.
Referenced by RowVectorBase< ELT >::resizeKeep(), and VectorBase< Real >::resizeKeep().
RowVectorView_< ELT > row | ( | int | i | ) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), SimTK_INDEXCHECK, and MatrixHelper< S >::stealRep().
Referenced by MatrixBase< Real >::operator[](), and MatrixBase< Real >::sum().
EltResult<typename VectorBase<ER>::template EltResult<EC>::Mul>::Mul rowAndColScale | ( | const VectorBase< ER > & | r, | |
const VectorBase< EC > & | c | |||
) | const [inline] |
void rowAndColScale | ( | const VectorBase< ER > & | r, | |
const VectorBase< EC > & | c, | |||
typename EltResult< typename VectorBase< ER >::template EltResult< EC >::Mul >::Mul & | out | |||
) | const [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and VectorBase< ELT >::nrow().
Referenced by MatrixBase< Real >::rowAndColScale().
MatrixBase< ELT > & rowAndColScaleInPlace | ( | const VectorBase< ER > & | r, | |
const VectorBase< EC > & | c | |||
) | [inline] |
M = diag(r) * M * diag(c); r must have nrow() elements; must have ncol() elements.
That is, M(i,j) *= r[i]*c[j]. Having a combined row & column scaling operator means we can go through the matrix memory once instead of twice.
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), and VectorBase< ELT >::nrow().
void rowScale | ( | const VectorBase< EE > & | v, | |
typename MatrixBase< ELT >::template EltResult< EE >::Mul & | out | |||
) | const [inline] |
EltResult<EE>::Mul rowScale | ( | const VectorBase< EE > & | r | ) | const [inline] |
Reimplemented in VectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
void 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 VectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by VectorBase< Real >::rowScale(), and MatrixBase< Real >::rowScale().
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 VectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
References MatrixBase< ELT >::nrow(), and VectorBase< ELT >::nrow().
MatrixBase& 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& 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& 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& 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& 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& 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.
ScalarNormSq 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.
Referenced by MatrixBase< Real >::norm(), MatrixBase< Real >::normRMS(), and MatrixBase< Real >::normSqr().
MatrixBase& 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& 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& setTo | ( | const ELT & | t | ) | [inline] |
Fill every element in current allocation with given element (or NaN or 0).
Referenced by RowVectorBase< ELT >::operator=(), and VectorBase< Real >::operator=().
MatrixBase& setToNaN | ( | ) | [inline] |
MatrixBase& setToZero | ( | ) | [inline] |
Referenced by MatrixBase< Real >::operator=(), and MatrixBase< Real >::scalarAssign().
TStandard 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.
Referenced by MatrixBase< Real >::standardize().
RowVectorBase<ELT> sum | ( | ) | const [inline] |
Form the column sums of this matrix, returned as a RowVector.
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by MatrixBase< Real >::scalarNormSqr(), and SimTK::sum().
MatrixView_< typename CNT< E >::THerm > transpose | ( | ) | const [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
References MatrixHelper< S >::stealRep().
Referenced by MatrixBase< Real >::operator~(), RowVectorBase< ELT >::transpose(), and VectorBase< Real >::transpose().
void unlockNCols | ( | ) | [inline] |
void unlockNRows | ( | ) | [inline] |
void unlockShape | ( | ) | [inline] |
Matrix_<ELT>& updAsMatrix | ( | ) | [inline] |
MatrixView_<ELT>& updAsMatrixView | ( | ) | [inline] |
RowVector_<ELT>& updAsRowVector | ( | ) | [inline] |
RowVectorBase<ELT>& updAsRowVectorBase | ( | ) | [inline] |
RowVectorView_<ELT>& updAsRowVectorView | ( | ) | [inline] |
Vector_<ELT>& updAsVector | ( | ) | [inline] |
VectorBase<ELT>& updAsVectorBase | ( | ) | [inline] |
VectorView_<ELT>& updAsVectorView | ( | ) | [inline] |
MatrixView_< ELT > updBlock | ( | int | i, | |
int | j, | |||
int | m, | |||
int | n | |||
) | [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), SimTK_INDEXCHECK, SimTK_SIZECHECK, and MatrixHelper< S >::stealRep().
Referenced by MatrixBase< Real >::operator()().
VectorView_< ELT > updCol | ( | int | j | ) | [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), SimTK_INDEXCHECK, and MatrixHelper< S >::stealRep().
Referenced by MatrixBase< Real >::operator()(), and SimTK::sort().
Scalar* updContiguousScalarData | ( | ) | [inline] |
VectorView_< E > updDiag | ( | ) | [inline] |
References MatrixHelper< S >::stealRep().
Referenced by Matrix_< ELT >::operator+=(), DeadMatrixView_< ELT >::operator+=(), MatrixView_< ELT >::operator+=(), Matrix_< ELT >::operator-=(), DeadMatrixView_< ELT >::operator-=(), MatrixView_< ELT >::operator-=(), MatrixBase< Real >::operator=(), MatrixBase< Real >::scalarAddInPlace(), MatrixBase< Real >::scalarAssign(), MatrixBase< Real >::scalarSubtractFromLeftInPlace(), and MatrixBase< Real >::scalarSubtractInPlace().
ELT& updElt | ( | int | i, | |
int | j | |||
) | [inline] |
Referenced by MatrixBase< ELT >::elementwiseDivideFromLeftInPlace(), MatrixBase< ELT >::elementwiseInvertInPlace(), MatrixBase< ELT >::elementwiseMultiplyFromLeftInPlace(), MatrixBase< ELT >::elementwiseSubtractFromScalarInPlace(), Matrix_< ELT >::Matrix_(), MatrixBase< Real >::operator()(), RowVector_< ELT >::RowVector_(), and Vector_< Real >::Vector_().
MatrixHelper<Scalar>& updHelper | ( | ) | [inline, protected] |
TNeg& updNegate | ( | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, Matrix_< ELT >, VectorBase< T >, and VectorBase< Real >.
Referenced by MatrixBase< Real >::operator-().
RowVectorView_< ELT > updRow | ( | int | i | ) | [inline] |
References MatrixBase< ELT >::ncol(), MatrixBase< ELT >::nrow(), SimTK_INDEXCHECK, and MatrixHelper< S >::stealRep().
Referenced by MatrixBase< Real >::operator[]().
MatrixView_< typename CNT< E >::THerm > updTranspose | ( | ) | [inline] |
Reimplemented in VectorBase< ELT >, RowVectorBase< ELT >, VectorBase< T >, and VectorBase< Real >.
References MatrixHelper< S >::stealRep().
Referenced by MatrixBase< Real >::operator~(), RowVectorBase< ELT >::updTranspose(), and VectorBase< Real >::updTranspose().
MatrixBase& 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.
friend class MatrixBase [friend] |