1 #ifndef SimTK_SIMMATRIX_MATRIXBASE_H_ 2 #define SimTK_SIMMATRIX_MATRIXBASE_H_ 68 template <
class ELT>
class MatrixBase {
136 int nrow()
const {
return helper.nrow();}
138 int ncol()
const {
return helper.ncol();}
147 ptrdiff_t
nelt()
const {
return helper.nelt();}
186 b.helper, typename
MatrixHelper<Scalar>::DeepCopy()) { }
192 b.helper, typename
MatrixHelper<Scalar>::DeepCopy()) { }
226 { helper.fillWith(reinterpret_cast<const Scalar*>(&initialValue)); }
239 const ELT* cppInitialValuesByRow)
241 { helper.copyInByRowsFromCpp(reinterpret_cast<const Scalar*>(cppInitialValuesByRow)); }
258 int spacing,
const Scalar* data)
260 commitment, character, spacing, data) {}
265 int spacing, Scalar* data)
267 commitment, character, spacing, data) {}
274 : helper(commitment, source, shallow) {}
278 : helper(commitment, source, shallow) {}
282 : helper(commitment, source, deep) {}
298 { helper = b.helper;
return *
this; }
300 { helper.addIn(b.helper);
return *
this; }
302 { helper.subIn(b.helper);
return *
this; }
335 updDiag().elementwiseAddScalarInPlace(s);
344 updDiag().elementwiseSubtractScalarInPlace(s);
352 updDiag().elementwiseAddScalarInPlace(s);
393 template <
class EE>
inline void 406 template <
class EE>
inline void 419 template <
class ER,
class EC>
inline MatrixBase&
422 template <
class ER,
class EC>
inline void 426 template <
class ER,
class EC>
inline typename EltResult<typename VectorBase<ER>::template
EltResult<EC>::Mul>
::Mul 445 {
return elementwiseAssign<Real>(
Real(s)); }
468 template <
class S>
inline void 488 template <
class S>
inline void 509 template <
class S>
inline void 517 elementwiseSubtractFromScalar<S>(s,out);
525 template <
class EE>
inline void 531 elementwiseMultiply<EE>(m,out);
539 template <
class EE>
inline void 547 elementwiseMultiplyFromLeft<EE>(m,out);
555 template <
class EE>
inline void 561 elementwiseDivide<EE>(m,out);
569 template <
class EE>
inline void 577 elementwiseDivideFromLeft<EE>(m,out);
582 MatrixBase&
setTo(
const ELT& t) {helper.fillWith(reinterpret_cast<const Scalar*>(&t));
return *
this;}
602 {
return block(i,j,m,n); }
643 void dump(
const char* msg=0)
const {
655 const ELT&
getElt(
int i,
int j)
const {
return *
reinterpret_cast<const ELT*
>(helper.getElt(i,j)); }
656 ELT&
updElt(
int i,
int j) {
return *
reinterpret_cast< ELT*
>(helper.updElt(i,j)); }
666 { helper.getAnyElt(i,j,reinterpret_cast<Scalar*>(&value)); }
676 for(
int j=0;j<nc;++j)
677 for (
int i=0; i<nr; ++i)
687 void abs(TAbs& mabs)
const {
690 for(
int j=0;j<nc;++j)
691 for (
int i=0; i<nr; ++i)
698 TAbs
abs()
const { TAbs mabs;
abs(mabs);
return mabs; }
712 TStandard mstd(nr, nc);
713 for(
int j=0;j<nc;++j)
714 for (
int i=0; i<nr; ++i)
741 const int cols =
ncol();
743 for (
int j = 0; j < cols; ++j)
744 helper.colSum(j, reinterpret_cast<Scalar*>(&row[j]));
752 const int rows =
nrow();
754 for (
int i = 0; i < rows; ++i)
755 helper.rowSum(i, reinterpret_cast<Scalar*>(&col[i]));
761 const TNeg&
negate()
const {
return *
reinterpret_cast<const TNeg*
>(
this); }
762 TNeg&
updNegate() {
return *
reinterpret_cast<TNeg*
>(
this); }
839 return helper.getContiguousDataLength();
842 return helper.getContiguousData();
845 return helper.updContiguousData();
848 helper.replaceContiguousData(newData,length,takeOwnership);
851 helper.replaceContiguousData(newData,length);
854 helper.swapOwnedContiguousData(newData,length,oldData);
889 template <
class ELT_A,
class ELT_B>
893 helper.matmul(beta,alpha,A.helper,B.helper);
901 #endif // SimTK_SIMMATRIX_MATRIXBASE_H_ EltResult< EE >::Mul elementwiseMultiply(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:529
Here we define class MatrixHelper<S>, the scalar-type templatized helper class for the more general...
Definition: MatrixHelper.h:79
ScalarNormSq scalarNormSqr() const
Scalar norm square is sum( squares of all scalars ).
Definition: MatrixBase.h:673
void unlockShape()
Definition: MatrixBase.h:789
CNT< E >::Precision EPrecision
Definition: MatrixBase.h:94
MatrixBase & setToNaN()
Definition: MatrixBase.h:583
ELT getAnyElt(int i, int j) const
Definition: MatrixBase.h:667
MatrixView_< ELT > operator()(int i, int j, int m, int n)
Definition: MatrixBase.h:603
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
Vector_< ELT > & updAsVector()
Definition: MatrixBase.h:803
const MatrixCommitment & getCharacterCommitment() const
MatrixBase< ESqTHerm > TSqTHerm
Definition: MatrixBase.h:116
MatrixBase(const MatrixCommitment &commitment, int m, int n, const ELT *cppInitialValuesByRow)
Initializing constructor with the initially-allocated elements initialized from a C++ array of elemen...
Definition: MatrixBase.h:238
EScalarNormSq ScalarNormSq
Definition: MatrixBase.h:101
const RowVectorView_< ELT > & getAsRowVectorView() const
Definition: MatrixBase.h:810
ptrdiff_t getContiguousScalarDataLength() const
Definition: MatrixBase.h:838
K::TReal TReal
Definition: CompositeNumericalTypes.h:141
MatrixBase & copyAssign(const MatrixBase &b)
Copy assignment is a deep copy but behavior depends on type of lhs: if view, rhs must match...
Definition: MatrixBase.h:196
MatrixBase< EStandard > TStandard
Definition: MatrixBase.h:112
CNT< E >::TNormalize ENormalize
Definition: MatrixBase.h:87
This is the vector class intended to appear in user code for large, variable size column vectors...
Definition: BigMatrix.h:171
void elementwiseSubtractScalar(const S &s, typename EltResult< S >::Sub &) const
This is a dataless rehash of the MatrixBase class to specialize it for RowVectors.
Definition: BigMatrix.h:165
CNT< E >::TImag EImag
Definition: MatrixBase.h:79
void elementwiseSubtractFromScalar(const S &, typename MatrixBase< S >::template EltResult< E >::Sub &) const
Definition: BigMatrix.h:435
int getNScalarsPerElement() const
This is the number of consecutive scalars used to represent one element of type ELT.
Definition: MatrixBase.h:830
const ELT & operator()(int i, int j) const
Definition: MatrixBase.h:658
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
ptrdiff_t nelt() const
Return the number of elements in the logical shape of this matrix.
Definition: MatrixBase.h:147
CNT< ScalarNormSq >::TSqrt norm() const
Definition: MatrixBase.h:725
CNT< E >::TNeg ENeg
Definition: MatrixBase.h:76
K::TSqrt TSqrt
Definition: CompositeNumericalTypes.h:154
VectorBase< ELT > & updAsVectorBase()
Definition: MatrixBase.h:807
ScalarNormSq normSqr() const
This is the scalar Frobenius norm, and its square.
Definition: MatrixBase.h:722
MatrixHelper< Scalar > & updHelper()
Definition: MatrixBase.h:865
MatrixBase & elementwiseSubtractScalarInPlace(const S &s)
Set M(i,j)-=s for every element of M and some value s.
CNT< E >::TStandard EStandard
Definition: MatrixBase.h:85
Definition: MatrixBase.h:128
static TSqrt sqrt(const K &t)
Definition: CompositeNumericalTypes.h:239
void commitTo(const MatrixCommitment &mc)
Change the handle commitment for this matrix handle; only allowed if the handle is currently clear...
Definition: MatrixBase.h:123
CNT< E >::THerm EHerm
Definition: MatrixBase.h:81
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
A MatrixCharacter is a set containing a value for each of the matrix characteristics except element t...
Definition: MatrixCharacteristics.h:597
K::TNormalize TNormalize
Definition: CompositeNumericalTypes.h:158
MatrixBase()
The default constructor builds a 0x0 matrix managed by a helper that understands how many scalars the...
Definition: MatrixBase.h:160
CNT< E >::TComplex EComplex
Definition: MatrixBase.h:80
MatrixBase & elementwiseDivideFromLeftInPlace(const MatrixBase< EE > &)
M(i,j) = R(i,j) / M(i,j); R must have same dimensions as this.
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.
void rowAndColScale(const VectorBase< ER > &r, const VectorBase< EC > &c, typename EltResult< typename VectorBase< ER >::template EltResult< EC >::Mul >::Mul &out) const
Definition: BigMatrix.h:337
MatrixBase & elementwiseMultiplyFromLeftInPlace(const MatrixBase< EE > &)
M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this.
void elementwiseDivideFromLeft(const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Dvd &) const
Definition: BigMatrix.h:533
MatrixBase & elementwiseAssign(const S &s)
Set M(i,j)=s for every element of M and some value s.
MatrixView_< EHerm > operator~()
Definition: MatrixBase.h:611
void replaceContiguousScalarData(const Scalar *newData, ptrdiff_t length)
Definition: MatrixBase.h:850
VectorView_< ELT > updCol(int j)
Definition: BigMatrix.h:261
MatrixBase & operator/=(const StdNumber &t)
Definition: MatrixBase.h:290
void replaceContiguousScalarData(Scalar *newData, ptrdiff_t length, bool takeOwnership)
Definition: MatrixBase.h:847
MatrixBase & resizeKeep(int m, int n)
Change the size of this matrix, retaining as much of the old data as will fit.
Definition: MatrixBase.h:779
const TNeg & operator-() const
Definition: MatrixBase.h:764
const Matrix_< ELT > & getAsMatrix() const
Definition: MatrixBase.h:794
Scalar * updContiguousScalarData()
Definition: MatrixBase.h:844
MatrixBase< EHerm > THerm
Definition: MatrixBase.h:108
K::TImag TImag
Definition: CompositeNumericalTypes.h:142
CNT< E >::Number ENumber
Definition: MatrixBase.h:92
Definition: Exception.h:298
RowVectorView_< ELT > updRow(int i)
Definition: BigMatrix.h:279
ELT & updElt(int i, int j)
Definition: MatrixBase.h:656
ELT E
Definition: MatrixBase.h:75
MatrixBase & viewAssign(const MatrixBase &src)
View assignment is a shallow copy, meaning that we disconnect the MatrixBase from whatever it used to...
Definition: MatrixBase.h:211
TNeg & operator-()
Definition: MatrixBase.h:765
VectorView_< ELT > col(int j) const
Definition: BigMatrix.h:252
const VectorView_< ELT > & getAsVectorView() const
Definition: MatrixBase.h:797
MatrixBase(const MatrixCommitment &commitment, const MatrixCharacter &character, int spacing, const Scalar *data)
Construct a read-only view of pre-existing data.
Definition: MatrixBase.h:256
MatrixBase(const MatrixCommitment &commitment, MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::ShallowCopy &shallow)
Definition: MatrixBase.h:271
TStandard standardize() const
Return a Matrix of the same shape and contents as this one but with the element type converted to one...
Definition: MatrixBase.h:710
VectorView_< ELT > operator()(int j)
Definition: MatrixBase.h:595
MatrixBase(const MatrixCommitment &commitment, int m, int n)
This constructor takes a handle commitment and allocates the default matrix for that kind of commitme...
Definition: MatrixBase.h:180
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
MatrixBase & scalarMultiplyInPlace(const S &)
Set M(i,j) = M(i,j)*S for some "scalar" S.
CNT< E >::TWithoutNegator EWithoutNegator
Definition: MatrixBase.h:77
MatrixBase & operator-=(const MatrixBase &r)
Definition: MatrixBase.h:292
MatrixBase & operator*=(const StdNumber &t)
Definition: MatrixBase.h:289
MatrixView_< ELT > operator()(int i, int j, int m, int n) const
Definition: MatrixBase.h:601
Matrix_< ELT > & updAsMatrix()
Definition: MatrixBase.h:795
static TStandard standardize(const K &t)
Definition: CompositeNumericalTypes.h:241
const RowVectorBase< ELT > & getAsRowVectorBase() const
Definition: MatrixBase.h:818
RowVector_< ELT > colSum() const
Form the column sums of this matrix, returned as a RowVector.
Definition: MatrixBase.h:740
(Advanced) This class is identical to RowVector_ except that it has shallow (reference) copy and assi...
Definition: BigMatrix.h:173
EltResult< EE >::Mul rowScale(const VectorBase< EE > &r) const
Definition: MatrixBase.h:397
CNT< E >::TInvert EInvert
Definition: MatrixBase.h:86
RowVectorView_< ELT > operator[](int i)
Definition: MatrixBase.h:593
MatrixBase< EE >::template EltResult< EE >::Dvd elementwiseDivideFromLeft(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:575
MatrixBase< typename CNT< E >::template Result< P >::Sub > Sub
Definition: MatrixBase.h:132
bool isResizeable() const
Return true if either dimension of this Matrix is resizable.
Definition: MatrixBase.h:150
RowVector_< ELT > & updAsRowVector()
Definition: MatrixBase.h:816
bool hasContiguousData() const
Definition: MatrixBase.h:837
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
MatrixBase< EComplex > TComplex
Definition: MatrixBase.h:107
CNT< E >::StdNumber EStdNumber
Definition: MatrixBase.h:93
MatrixView_< ELT > updBlock(int i, int j, int m, int n)
Definition: BigMatrix.h:211
MatrixBase< typename CNT< E >::TInvert > elementwiseInvert() const
Definition: MatrixBase.h:452
EltResult< S >::Sub elementwiseSubtractScalar(const S &s) const
Definition: MatrixBase.h:492
VectorView_< ELT > diag()
This non-const version of diag() is an alternate name for updDiag() available for historical reasons...
Definition: MatrixBase.h:621
MatrixBase< EImag > TImag
Definition: MatrixBase.h:106
K::Precision Precision
Definition: CompositeNumericalTypes.h:164
int getPackedSizeofElement() const
This is like sizeof(ELT), but returning the number of bytes we use to store the element which may be ...
Definition: MatrixBase.h:835
EltResult< EE >::Dvd elementwiseDivide(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:559
TNeg & updNegate()
Definition: MatrixBase.h:762
MatrixBase< E > TPosTrans
Definition: MatrixBase.h:109
void colScale(const VectorBase< EE > &c, typename EltResult< EE >::Mul &out) const
Vector_< ELT > rowSum() const
Form the row sums of this matrix, returned as a Vector.
Definition: MatrixBase.h:751
(Advanced) This class is identical to Matrix_ except that it has shallow (reference) copy and assignm...
Definition: BigMatrix.h:167
MatrixBase & elementwiseAssign(int s)
Overloaded to allow an integer argument, which is converted to Real.
Definition: MatrixBase.h:444
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
MatrixBase & scalarAddInPlace(const S &s)
Add a scalar to M's diagonal.
Definition: MatrixBase.h:334
CNT< E >::TSqHermT ESqHermT
Definition: MatrixBase.h:88
MatrixView_< EHerm > updTranspose()
Definition: BigMatrix.h:230
CNT< E >::TReal EReal
Definition: MatrixBase.h:78
VectorView_< ELT > updDiag()
Select main diagonal (of largest leading square if rectangular) and return it as a writable view of t...
Definition: BigMatrix.h:245
MatrixBase(const MatrixCommitment &commitment, const MatrixCharacter &character, int spacing, Scalar *data)
Construct a writable view of pre-existing data.
Definition: MatrixBase.h:263
ENumber Number
Definition: MatrixBase.h:98
MatrixBase & scalarSubtractFromLeftInPlace(const S &s)
Set M(i,i) = S - M(i,i), M(i,j) = -M(i,j) for i!=j.
Definition: MatrixBase.h:350
MatrixBase< typename CNT< E >::template Result< P >::Add > Add
Definition: MatrixBase.h:131
RowVectorBase< ELT > & updAsRowVectorBase()
Definition: MatrixBase.h:820
CNT< ScalarNormSq >::TSqrt normRMS() const
We only allow RMS norm if the elements are scalars.
Definition: MatrixBase.h:731
void elementwiseMultiplyFromLeft(const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Mul &) const
Definition: BigMatrix.h:484
MatrixBase(const TNeg &b)
Implicit conversion from matrix with negated elements (otherwise this is just like the copy construct...
Definition: MatrixBase.h:190
MatrixBase< typename CNT< E >::template Result< P >::Dvd > Dvd
Definition: MatrixBase.h:130
int ncol() const
Return the number of columns n in the logical shape of this matrix.
Definition: MatrixBase.h:138
#define SimTK_THROW1(exc, a1)
Definition: Exception.h:316
VectorView_< ELT > diag() const
Select main diagonal (of largest leading square if rectangular) and return it as a read-only view of ...
Definition: BigMatrix.h:238
MatrixBase< EInvert > TInvert
Definition: MatrixBase.h:113
const MatrixCharacter & getMatrixCharacter() const
Definition: MatrixBase.h:119
MatrixBase< ENormalize > TNormalize
Definition: MatrixBase.h:114
CNT< E >::TPosTrans EPosTrans
Definition: MatrixBase.h:82
MatrixBase< EAbs > TAbs
Definition: MatrixBase.h:111
void lockShape()
Definition: MatrixBase.h:783
bool isResizeable() const
Definition: MatrixCharacteristics.h:925
K::TPosTrans TPosTrans
Definition: CompositeNumericalTypes.h:145
EStdNumber StdNumber
Definition: MatrixBase.h:99
const MatrixView_< ELT > & getAsMatrixView() const
Definition: MatrixBase.h:792
MatrixBase< EWithoutNegator > TWithoutNegator
Definition: MatrixBase.h:104
Definition: MatrixBase.h:154
MatrixBase< EReal > TReal
Definition: MatrixBase.h:105
MatrixBase & elementwiseInvertInPlace()
Set M(i,j) = M(i,j)^-1.
Definition: BigMatrix.h:361
MatrixBase & rowScaleInPlace(const VectorBase< EE > &)
M = diag(r) * M; r must have nrow() elements.
EltResult< S >::Add elementwiseAddScalar(const S &s) const
Definition: MatrixBase.h:472
This is the matrix class intended to appear in user code for large, variable size matrices...
Definition: BigMatrix.h:168
CNT< E >::TSqTHerm ESqTHerm
Definition: MatrixBase.h:89
MatrixBase & elementwiseAddScalarInPlace(const S &s)
Set M(i,j)+=s for every element of M and some value s.
MatrixBase & operator+=(const MatrixBase &r)
Definition: MatrixBase.h:291
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
MatrixBase< S >::template EltResult< E >::Sub elementwiseSubtractFromScalar(const S &s) const
Definition: MatrixBase.h:515
MatrixBase & operator=(const MatrixBase< EE > &b)
Definition: MatrixBase.h:297
MatrixBase & setToZero()
Definition: MatrixBase.h:584
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...
Definition: MatrixBase.h:224
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
MatrixBase & operator-=(const MatrixBase< EE > &b)
Definition: MatrixBase.h:301
const ELT & getElt(int i, int j) const
Element selection for stored elements.
Definition: MatrixBase.h:655
void invertInPlace()
Definition: MatrixBase.h:640
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 whethe...
Definition: MatrixBase.h:665
MatrixBase(const MatrixCommitment &commitment)
This constructor takes a handle commitment and allocates the default matrix for that kind of commitme...
Definition: MatrixBase.h:172
EltResult< EE >::Mul colScale(const VectorBase< EE > &c) const
Definition: MatrixBase.h:410
CNT< E >::ScalarNormSq EScalarNormSq
Definition: MatrixBase.h:95
MatrixBase & scalarDivideInPlace(const S &)
Set M(i,j) = M(i,j)/S for some "scalar" S.
MatrixBase & operator=(const MatrixBase &b)
Definition: MatrixBase.h:200
MatrixBase(int m, int n)
This constructor allocates the default matrix a completely uncommitted matrix commitment, given particular initial dimensions.
Definition: MatrixBase.h:164
const MatrixHelper< Scalar > & getHelper() const
Definition: MatrixBase.h:864
MatrixView_< EHerm > transpose() const
Definition: BigMatrix.h:222
CNT< E >::TAbs EAbs
Definition: MatrixBase.h:84
const Vector_< ELT > & getAsVector() const
Definition: MatrixBase.h:801
void elementwiseAddScalar(const S &s, typename EltResult< S >::Add &) const
void dump(const char *msg=0) const
Matlab-compatible debug output.
Definition: MatrixBase.h:643
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
const VectorBase< ELT > & getAsVectorBase() const
Definition: MatrixBase.h:805
This is a dataless rehash of the MatrixBase class to specialize it for Vectors.
Definition: BigMatrix.h:164
MatrixBase & scalarDivideFromLeftInPlace(const S &)
Set M(i,j) = S/M(i,j) for some "scalar" S.
const MatrixCharacter & getMatrixCharacter() const
MatrixView_< EHerm > operator~() const
Definition: MatrixBase.h:610
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
Definition: MatrixBase.h:153
K::TWithoutNegator TWithoutNegator
Definition: CompositeNumericalTypes.h:140
CNT< E >::Scalar EScalar
Definition: MatrixBase.h:91
Represents a variable size row vector; much less common than the column vector type Vector_...
Definition: BigMatrix.h:174
void commitTo(const MatrixCommitment &)
A MatrixCommitment provides a set of acceptable matrix characteristics.
Definition: MatrixCharacteristics.h:832
VectorView_< ELT > & updAsVectorView()
Definition: MatrixBase.h:799
void swapOwnedContiguousScalarData(Scalar *newData, ptrdiff_t length, Scalar *&oldData)
Definition: MatrixBase.h:853
void elementwiseDivide(const MatrixBase< EE > &, typename EltResult< EE >::Dvd &) const
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...
MatrixBase< EE >::template EltResult< E >::Mul elementwiseMultiplyFromLeft(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:545
MatrixBase(MatrixHelperRep< Scalar > *hrep)
Helper rep-stealing constructor.
Definition: MatrixBase.h:861
MatrixView_< ELT > block(int i, int j, int m, int n) const
Definition: BigMatrix.h:200
EltResult< typename VectorBase< ER >::template EltResult< EC >::Mul >::Mul rowAndColScale(const VectorBase< ER > &r, const VectorBase< EC > &c) const
Definition: MatrixBase.h:427
const MatrixCommitment & getCharacterCommitment() const
Definition: MatrixBase.h:118
MatrixBase & elementwiseDivideInPlace(const MatrixBase< EE > &)
M(i,j) /= R(i,j); R must have same dimensions as this.
MatrixBase(const MatrixCommitment &commitment, const MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::ShallowCopy &shallow)
Definition: MatrixBase.h:275
const Scalar * getContiguousScalarData() const
Definition: MatrixBase.h:841
K::TComplex TComplex
Definition: CompositeNumericalTypes.h:143
This is the common base class for Simbody's Vector_ and Matrix_ classes for handling large...
Definition: BigMatrix.h:163
void elementwiseMultiply(const MatrixBase< EE > &, typename EltResult< EE >::Mul &) const
K::Number Number
Definition: CompositeNumericalTypes.h:162
const MatrixBase & operator+() const
Definition: MatrixBase.h:760
MatrixBase & operator=(const ELT &t)
Matrix assignment to an element sets only the diagonal elements to the indicated value; everything el...
Definition: MatrixBase.h:314
static TAbs abs(const K &t)
Definition: CompositeNumericalTypes.h:240
MatrixBase & scalarAssign(const S &s)
Set M's diagonal elements to a "scalar" value S, and all off-diagonal elements to zero...
Definition: MatrixBase.h:325
void abs(TAbs &mabs) const
abs() is elementwise absolute value; that is, the return value has the same dimension as this Matrix ...
Definition: MatrixBase.h:687
MatrixBase(const MatrixBase< EE > &b)
Definition: MatrixBase.h:294
MatrixBase & elementwiseMultiplyInPlace(const MatrixBase< EE > &)
M(i,j) *= R(i,j); R must have same dimensions as this.
MatrixBase & colScaleInPlace(const VectorBase< EE > &)
M = M * diag(c); c must have ncol() elements.
void clear()
This restores the MatrixBase to the state it would be in had it been constructed specifying only its ...
Definition: MatrixBase.h:287
MatrixBase< ENeg > TNeg
Definition: MatrixBase.h:103
MatrixBase & setTo(const ELT &t)
Fill every element in current allocation with given element (or NaN or 0).
Definition: MatrixBase.h:582
RowVectorView_< ELT > operator[](int i) const
Definition: MatrixBase.h:592
RowVectorView_< ELT > & updAsRowVectorView()
Definition: MatrixBase.h:812
RowVector_< ELT > sum() const
Alternate name for colSum(); behaves like the Matlab function sum().
Definition: MatrixBase.h:748
MatrixBase & operator+=(const MatrixBase< EE > &b)
Definition: MatrixBase.h:299
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
MatrixBase & resize(int m, int n)
Change the size of this matrix.
Definition: MatrixBase.h:773
const TNeg & negate() const
Definition: MatrixBase.h:761
MatrixBase & scalarMultiplyFromLeftInPlace(const S &)
Set M(i,j) = S * M(i,j) for some "scalar" S.
MatrixBase< typename CNT< E >::template Result< P >::Mul > Mul
Definition: MatrixBase.h:129
MatrixBase & negateInPlace()
Definition: MatrixBase.h:767
MatrixBase(const MatrixCommitment &commitment, const MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::DeepCopy &deep)
Definition: MatrixBase.h:279
(Advanced) This class is identical to Vector_ except that it has shallow (reference) copy and assignm...
Definition: BigMatrix.h:170
ELT & operator()(int i, int j)
Definition: MatrixBase.h:659
MatrixBase & elementwiseSubtractFromScalarInPlace(const S &s)
Set M(i,j) = s - M(i,j) for every element of M and some value s.
const RowVector_< ELT > & getAsRowVector() const
Definition: MatrixBase.h:814
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
MatrixView_< ELT > & updAsMatrixView()
Definition: MatrixBase.h:793
VectorView_< ELT > operator()(int j) const
Definition: MatrixBase.h:594
TAbs abs() const
abs() with the result as a function return.
Definition: MatrixBase.h:698
int nrow() const
Return the number of rows m in the logical shape of this matrix.
Definition: MatrixBase.h:136
MatrixBase & scalarSubtractInPlace(const S &s)
Subtract a scalar from M's diagonal.
Definition: MatrixBase.h:343
MatrixBase(const MatrixBase &b)
Copy constructor is a deep copy (not appropriate for views!).
Definition: MatrixBase.h:184
TInvert invert() const
Definition: MatrixBase.h:634
EPrecision Precision
Definition: MatrixBase.h:100
EScalar Scalar
Definition: MatrixBase.h:97
MatrixBase< ESqHermT > TSqHermT
Definition: MatrixBase.h:115
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
RowVectorView_< ELT > row(int i) const
Definition: BigMatrix.h:270