1 #ifndef SimTK_SIMMATRIX_MATRIXBASE_H_ 2 #define SimTK_SIMMATRIX_MATRIXBASE_H_ 68 template <
class ELT>
class MatrixBase {
137 int nrow()
const {
return helper.nrow();}
139 int ncol()
const {
return helper.ncol();}
148 ptrdiff_t
nelt()
const {
return helper.nelt();}
187 b.helper, typename
MatrixHelper<Scalar>::DeepCopy()) { }
193 b.helper, typename
MatrixHelper<Scalar>::DeepCopy()) { }
227 { helper.fillWith(reinterpret_cast<const Scalar*>(&initialValue)); }
240 const ELT* cppInitialValuesByRow)
242 { helper.copyInByRowsFromCpp(reinterpret_cast<const Scalar*>(cppInitialValuesByRow)); }
259 int spacing,
const Scalar* data)
261 commitment, character, spacing, data) {}
266 int spacing, Scalar* data)
268 commitment, character, spacing, data) {}
275 : helper(commitment, source, shallow) {}
279 : helper(commitment, source, shallow) {}
283 : helper(commitment, source, deep) {}
299 { helper = b.helper;
return *
this; }
301 { helper.addIn(b.helper);
return *
this; }
303 { helper.subIn(b.helper);
return *
this; }
336 updDiag().elementwiseAddScalarInPlace(s);
345 updDiag().elementwiseSubtractScalarInPlace(s);
353 updDiag().elementwiseAddScalarInPlace(s);
394 template <
class EE>
inline void 407 template <
class EE>
inline void 420 template <
class ER,
class EC>
inline MatrixBase&
423 template <
class ER,
class EC>
inline void 427 template <
class ER,
class EC>
inline typename EltResult<typename VectorBase<ER>::template
EltResult<EC>::Mul>
::Mul 446 {
return elementwiseAssign<Real>(
Real(s)); }
469 template <
class S>
inline void 489 template <
class S>
inline void 510 template <
class S>
inline void 518 elementwiseSubtractFromScalar<S>(
s,out);
526 template <
class EE>
inline void 532 elementwiseMultiply<EE>(
m,out);
540 template <
class EE>
inline void 548 elementwiseMultiplyFromLeft<EE>(
m,out);
556 template <
class EE>
inline void 562 elementwiseDivide<EE>(
m,out);
570 template <
class EE>
inline void 578 elementwiseDivideFromLeft<EE>(
m,out);
583 MatrixBase&
setTo(
const ELT& t) {helper.fillWith(reinterpret_cast<const Scalar*>(&t));
return *
this;}
603 {
return block(i,j,m,n); }
644 void dump(
const char* msg=0)
const {
656 const ELT&
getElt(
int i,
int j)
const {
return *
reinterpret_cast<const ELT*
>(helper.getElt(i,j)); }
657 ELT&
updElt(
int i,
int j) {
return *
reinterpret_cast< ELT*
>(helper.updElt(i,j)); }
667 { helper.getAnyElt(i,j,reinterpret_cast<Scalar*>(&value)); }
677 for(
int j=0;j<nc;++j)
678 for (
int i=0; i<nr; ++i)
688 void abs(TAbs& mabs)
const {
691 for(
int j=0;j<nc;++j)
692 for (
int i=0; i<nr; ++i)
699 TAbs
abs()
const { TAbs mabs;
abs(mabs);
return mabs; }
713 TStandard mstd(nr, nc);
714 for(
int j=0;j<nc;++j)
715 for (
int i=0; i<nr; ++i)
742 const int cols =
ncol();
744 for (
int j = 0; j < cols; ++j)
745 helper.colSum(j, reinterpret_cast<Scalar*>(&row[j]));
753 const int rows =
nrow();
755 for (
int i = 0; i < rows; ++i)
756 helper.rowSum(i, reinterpret_cast<Scalar*>(&col[i]));
762 const TNeg&
negate()
const {
return *
reinterpret_cast<const TNeg*
>(
this); }
763 TNeg&
updNegate() {
return *
reinterpret_cast<TNeg*
>(
this); }
840 return helper.getContiguousDataLength();
843 return helper.getContiguousData();
846 return helper.updContiguousData();
849 helper.replaceContiguousData(newData,length,takeOwnership);
852 helper.replaceContiguousData(newData,length);
855 helper.swapOwnedContiguousData(newData,length,oldData);
890 template <
class ELT_A,
class ELT_B>
894 helper.matmul(beta,alpha,A.helper,B.helper);
902 #endif // SimTK_SIMMATRIX_MATRIXBASE_H_ Here we define class MatrixHelper<S>, the scalar-type templatized helper class for the more general...
Definition: MatrixHelper.h:79
VectorView_< ELT > operator()(int j) const
Definition: MatrixBase.h:595
void unlockShape()
Definition: MatrixBase.h:790
CNT< E >::Precision EPrecision
Definition: MatrixBase.h:94
MatrixBase & setToNaN()
Definition: MatrixBase.h:584
MatrixView_< ELT > operator()(int i, int j, int m, int n)
Definition: MatrixBase.h:604
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
Vector_< ELT > & updAsVector()
Definition: MatrixBase.h:804
const VectorView_< ELT > & getAsVectorView() const
Definition: MatrixBase.h:798
const MatrixCharacter & getMatrixCharacter() const
Definition: MatrixBase.h:120
MatrixBase< ESqTHerm > TSqTHerm
Definition: MatrixBase.h:117
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:239
EScalarNormSq ScalarNormSq
Definition: MatrixBase.h:101
const TNeg & negate() const
Definition: MatrixBase.h:762
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:197
MatrixBase< EStandard > TStandard
Definition: MatrixBase.h:113
CNT< E >::TNormalize ENormalize
Definition: MatrixBase.h:87
Definition: MatrixHelper.h:48
const VectorBase< ELT > & getAsVectorBase() const
Definition: MatrixBase.h:806
This is the vector class intended to appear in user code for large, variable size column vectors...
Definition: BigMatrix.h:171
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation source
Definition: LICENSE.txt:26
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
const MatrixCommitment & getCharacterCommitment() const
Definition: MatrixBase.h:119
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
EltResult< EE >::Mul colScale(const VectorBase< EE > &c) const
Definition: MatrixBase.h:411
CNT< E >::TNeg ENeg
Definition: MatrixBase.h:76
K::TSqrt TSqrt
Definition: CompositeNumericalTypes.h:154
VectorBase< ELT > & updAsVectorBase()
Definition: MatrixBase.h:808
MatrixHelper< Scalar > & updHelper()
Definition: MatrixBase.h:866
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:129
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:124
CNT< E >::THerm EHerm
Definition: MatrixBase.h:81
ScalarNormSq normSqr() const
This is the scalar Frobenius norm, and its square.
Definition: MatrixBase.h:723
RowVectorView_< ELT > row(int i) const
Definition: BigMatrix.h:270
const MatrixCharacter & getMatrixCharacter() const
MatrixBase< typename CNT< E >::TInvert > elementwiseInvert() const
Definition: MatrixBase.h:453
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
void elementwiseDivide(const MatrixBase< EE > &, typename EltResult< EE >::Dvd &) const
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
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:711
MatrixBase()
The default constructor builds a 0x0 matrix managed by a helper that understands how many scalars the...
Definition: MatrixBase.h:161
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.
MatrixBase & elementwiseMultiplyFromLeftInPlace(const MatrixBase< EE > &)
M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this.
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:612
void replaceContiguousScalarData(const Scalar *newData, ptrdiff_t length)
Definition: MatrixBase.h:851
VectorView_< ELT > updCol(int j)
Definition: BigMatrix.h:261
MatrixBase & operator/=(const StdNumber &t)
Definition: MatrixBase.h:291
CNT< ScalarNormSq >::TSqrt normRMS() const
We only allow RMS norm if the elements are scalars.
Definition: MatrixBase.h:732
void replaceContiguousScalarData(Scalar *newData, ptrdiff_t length, bool takeOwnership)
Definition: MatrixBase.h:848
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:780
Scalar * updContiguousScalarData()
Definition: MatrixBase.h:845
MatrixBase< EHerm > THerm
Definition: MatrixBase.h:109
K::TImag TImag
Definition: CompositeNumericalTypes.h:142
CNT< E >::Number ENumber
Definition: MatrixBase.h:92
Definition: Exception.h:297
RowVectorView_< ELT > updRow(int i)
Definition: BigMatrix.h:279
ELT & updElt(int i, int j)
Definition: MatrixBase.h:657
ELT E
Definition: MatrixBase.h:75
int getNScalarsPerElement() const
This is the number of consecutive scalars used to represent one element of type ELT.
Definition: MatrixBase.h:831
ptrdiff_t getContiguousScalarDataLength() const
Definition: MatrixBase.h:839
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:212
TNeg & operator-()
Definition: MatrixBase.h:766
EltResult< S >::Sub elementwiseSubtractScalar(const S &s) const
Definition: MatrixBase.h:493
EltResult< typename VectorBase< ER >::template EltResult< EC >::Mul >::Mul rowAndColScale(const VectorBase< ER > &r, const VectorBase< EC > &c) const
Definition: MatrixBase.h:428
MatrixBase(const MatrixCommitment &commitment, const MatrixCharacter &character, int spacing, const Scalar *data)
Construct a read-only view of pre-existing data.
Definition: MatrixBase.h:257
MatrixBase(const MatrixCommitment &commitment, MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::ShallowCopy &shallow)
Definition: MatrixBase.h:272
void elementwiseMultiplyFromLeft(const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Mul &) const
Definition: BigMatrix.h:484
void elementwiseDivideFromLeft(const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Dvd &) const
Definition: BigMatrix.h:533
VectorView_< ELT > operator()(int j)
Definition: MatrixBase.h:596
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:181
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:593
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:293
MatrixBase & operator*=(const StdNumber &t)
Definition: MatrixBase.h:290
Matrix_< ELT > & updAsMatrix()
Definition: MatrixBase.h:796
static TStandard standardize(const K &t)
Definition: CompositeNumericalTypes.h:241
CNT< ScalarNormSq >::TSqrt norm() const
Definition: MatrixBase.h:726
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:666
m
Definition: CMakeCache.txt:469
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:688
const Matrix_< ELT > & getAsMatrix() const
Definition: MatrixBase.h:795
const RowVector_< ELT > & getAsRowVector() const
Definition: MatrixBase.h:815
(Advanced) This class is identical to RowVector_ except that it has shallow (reference) copy and assi...
Definition: BigMatrix.h:173
CNT< E >::TInvert EInvert
Definition: MatrixBase.h:86
RowVectorView_< ELT > operator[](int i)
Definition: MatrixBase.h:594
MatrixBase< typename CNT< E >::template Result< P >::Sub > Sub
Definition: MatrixBase.h:133
RowVector_< ELT > & updAsRowVector()
Definition: MatrixBase.h:817
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
MatrixBase< EComplex > TComplex
Definition: MatrixBase.h:108
CNT< E >::StdNumber EStdNumber
Definition: MatrixBase.h:93
MatrixView_< EHerm > transpose() const
Definition: BigMatrix.h:222
MatrixView_< ELT > updBlock(int i, int j, int m, int n)
Definition: BigMatrix.h:211
EltResult< S >::Add elementwiseAddScalar(const S &s) const
Definition: MatrixBase.h:473
VectorView_< ELT > diag()
This non-const version of diag() is an alternate name for updDiag() available for historical reasons...
Definition: MatrixBase.h:622
int nrow() const
Return the number of rows m in the logical shape of this matrix.
Definition: MatrixBase.h:137
RowVector_< ELT > colSum() const
Form the column sums of this matrix, returned as a RowVector.
Definition: MatrixBase.h:741
MatrixBase< EImag > TImag
Definition: MatrixBase.h:107
void elementwiseSubtractScalar(const S &s, typename EltResult< S >::Sub &) const
K::Precision Precision
Definition: CompositeNumericalTypes.h:164
TNeg & updNegate()
Definition: MatrixBase.h:763
Vector_< ELT > rowSum() const
Form the row sums of this matrix, returned as a Vector.
Definition: MatrixBase.h:752
MatrixBase< E > TPosTrans
Definition: MatrixBase.h:110
(Advanced) This class is identical to Matrix_ except that it has shallow (reference) copy and assignm...
Definition: BigMatrix.h:167
void dump(const char *msg=0) const
Matlab-compatible debug output.
Definition: MatrixBase.h:644
ScalarNormSq scalarNormSqr() const
Scalar norm square is sum( squares of all scalars ).
Definition: MatrixBase.h:674
RowVector_< ELT > sum() const
Alternate name for colSum(); behaves like the Matlab function sum().
Definition: MatrixBase.h:749
EltResult< EE >::Mul elementwiseMultiply(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:530
MatrixBase & elementwiseAssign(int s)
Overloaded to allow an integer argument, which is converted to Real.
Definition: MatrixBase.h:445
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
MatrixBase & scalarAddInPlace(const S &s)
Add a scalar to M's diagonal.
Definition: MatrixBase.h:335
const RowVectorBase< ELT > & getAsRowVectorBase() const
Definition: MatrixBase.h:819
MatrixView_< ELT > block(int i, int j, int m, int n) const
Definition: BigMatrix.h:200
CNT< E >::TSqHermT ESqHermT
Definition: MatrixBase.h:88
MatrixView_< EHerm > updTranspose()
Definition: BigMatrix.h:230
аЯ рЁБ с ўџ З Й ўџџџ Г Д Е Ж џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџьЅС ј П ч bjbjcTcT кй Г У Л t џџ џџ џџ З С K K K D џџџџ 2 ZЦ j J a n u a r A b s t r a c t W e d e s c r i b e t h e g o a l s a n d d e s i g n d e c i s i o n b e h i n d S i m m a t r i t h e S i m T K m a t r i x a n d l i n e a r a l g e b r a l i b r a r a n d p r o v i d e r e f e r e n c e i n f o r m a t i o n f o r u s i n g i t T h e i d e a i s t o p r o v i d e t h e p o w e r
Definition: Simmatrix.doc:7
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:264
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:351
MatrixBase< typename CNT< E >::template Result< P >::Add > Add
Definition: MatrixBase.h:132
RowVectorBase< ELT > & updAsRowVectorBase()
Definition: MatrixBase.h:821
MatrixBase(const TNeg &b)
Implicit conversion from matrix with negated elements (otherwise this is just like the copy construct...
Definition: MatrixBase.h:191
MatrixBase< typename CNT< E >::template Result< P >::Dvd > Dvd
Definition: MatrixBase.h:131
MatrixBase< E > T
Definition: MatrixBase.h:103
#define SimTK_THROW1(exc, a1)
Definition: Exception.h:311
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...
аЯ рЁБ с ўџ З Й ўџџџ Г Д Е Ж џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџьЅС ј П ч bjbjcTcT кй Г У Л t џџ џџ џџ З С K K K D џџџџ 2 ZЦ j J a n u a r A b s t r a c t W e d e s c r i b e t h e g o a l s a n d d e s i g n d e c i s i o n b e h i n d S i m m a t r i t h e S i m T K m a t r i x a n d l i n e a r a l g e b r a l i b r a r a n d p r o v i d e r e f e r e n c e i n f o r m a t i o n f o r u s i n g i t T h e i d e a i s t o p r o v i d e t h e p o w e n a t u r a l n e s s
Definition: Simmatrix.doc:7
MatrixBase< EInvert > TInvert
Definition: MatrixBase.h:114
const ELT & getElt(int i, int j) const
Element selection for stored elements.
Definition: MatrixBase.h:656
MatrixBase< ENormalize > TNormalize
Definition: MatrixBase.h:115
CNT< E >::TPosTrans EPosTrans
Definition: MatrixBase.h:82
MatrixBase< EAbs > TAbs
Definition: MatrixBase.h:112
void lockShape()
Definition: MatrixBase.h:784
K::TPosTrans TPosTrans
Definition: CompositeNumericalTypes.h:145
EStdNumber StdNumber
Definition: MatrixBase.h:99
TInvert invert() const
Definition: MatrixBase.h:635
MatrixBase< EWithoutNegator > TWithoutNegator
Definition: MatrixBase.h:105
Definition: MatrixBase.h:155
MatrixBase< EReal > TReal
Definition: MatrixBase.h:106
bool isResizeable() const
Return true if either dimension of this Matrix is resizable.
Definition: MatrixBase.h:151
EltResult< EE >::Mul rowScale(const VectorBase< EE > &r) const
Definition: MatrixBase.h:398
const TNeg & operator-() const
Definition: MatrixBase.h:765
const MatrixView_< ELT > & getAsMatrixView() const
Definition: MatrixBase.h:793
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.
const Vector_< ELT > & getAsVector() const
Definition: MatrixBase.h:802
This is the matrix class intended to appear in user code for large, variable size matrices...
Definition: BigMatrix.h:168
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:836
CNT< E >::TSqTHerm ESqTHerm
Definition: MatrixBase.h:89
MatrixView_< EHerm > operator~() const
Definition: MatrixBase.h:611
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:292
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
ELT getAnyElt(int i, int j) const
Definition: MatrixBase.h:668
void colScale(const VectorBase< EE > &c, typename EltResult< EE >::Mul &out) const
MatrixBase & operator=(const MatrixBase< EE > &b)
Definition: MatrixBase.h:298
void elementwiseMultiply(const MatrixBase< EE > &, typename EltResult< EE >::Mul &) const
MatrixBase & setToZero()
Definition: MatrixBase.h:585
MatrixBase< S >::template EltResult< E >::Sub elementwiseSubtractFromScalar(const S &s) const
Definition: MatrixBase.h:516
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:225
gјiЌтkDdёMV wfлaIJуtюц ЩAАйЉtџ1Л JљcA nrш S qо isІ3 уЏ ЇжЇ Ы ТгVфЦKф C д9Z У ЉD Ўq FxnЙцТ n єT ЉY Н< щ['ЖjdЛ< K JvTMЯH"ЋяОsђЫw>}љіo_Йљ
ЗoЖЃ?Ї zџШЎ'z:mЄІуЧV$ќКРyЁnаgЭџiлИJ{и хЩїTaК*АдdКВE|lєzbXс@!^РклѕгOЌoi_г=ўінOП}&кХВQUV
ЅWTshЃ!ГљPЌ_ЊЕС7ЅDRAVъfЎвЪПЈЛЅbOждЙЩЋtЎ0оY!О|л'ђЉx'ўУГ§нЅК:/ўќПќ V[ц,тЇо}-Bж§Ъ/ПјиџіЌм;у:х;яОй;IюЫПЇой[nK4Ћ#ІЁ-Б='ЈGf\lЙчѕb41лЉ> ѓйOчsчЂ7x f p§ъZzB рI рЮ gЊБЁ Њ n
Definition: SimmathUserGuide.doc:2262
void elementwiseAddScalar(const S &s, typename EltResult< S >::Add &) const
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
const RowVectorView_< ELT > & getAsRowVectorView() const
Definition: MatrixBase.h:811
MatrixBase & operator-=(const MatrixBase< EE > &b)
Definition: MatrixBase.h:302
void invertInPlace()
Definition: MatrixBase.h:641
MatrixBase(const MatrixCommitment &commitment)
This constructor takes a handle commitment and allocates the default matrix for that kind of commitme...
Definition: MatrixBase.h:173
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< EE >::template EltResult< EE >::Dvd elementwiseDivideFromLeft(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:576
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 & operator=(const MatrixBase &b)
Definition: MatrixBase.h:201
MatrixBase(int m, int n)
This constructor allocates the default matrix a completely uncommitted matrix commitment, given particular initial dimensions.
Definition: MatrixBase.h:165
const MatrixHelper< Scalar > & getHelper() const
Definition: MatrixBase.h:865
CNT< E >::TAbs EAbs
Definition: MatrixBase.h:84
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
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.
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
Definition: MatrixBase.h:154
K::TWithoutNegator TWithoutNegator
Definition: CompositeNumericalTypes.h:140
CNT< E >::Scalar EScalar
Definition: MatrixBase.h:91
const Scalar * getContiguousScalarData() const
Definition: MatrixBase.h:842
RowVectorView_< ELT > operator[](int i) const
Definition: MatrixBase.h:593
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:800
void swapOwnedContiguousScalarData(Scalar *newData, ptrdiff_t length, Scalar *&oldData)
Definition: MatrixBase.h:854
MatrixBase< EE >::template EltResult< E >::Mul elementwiseMultiplyFromLeft(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:546
MatrixBase(MatrixHelperRep< Scalar > *hrep)
Helper rep-stealing constructor.
Definition: MatrixBase.h:862
ptrdiff_t nelt() const
Return the number of elements in the logical shape of this matrix.
Definition: MatrixBase.h:148
void elementwiseSubtractFromScalar(const S &, typename MatrixBase< S >::template EltResult< E >::Sub &) const
Definition: BigMatrix.h:435
TAbs abs() const
abs() with the result as a function return.
Definition: MatrixBase.h:699
bool isResizeable() const
Definition: MatrixCharacteristics.h:925
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:276
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
K::Number Number
Definition: CompositeNumericalTypes.h:162
MatrixBase & operator=(const ELT &t)
Matrix assignment to an element sets only the *diagonal* elements to the indicated value; everything ...
Definition: MatrixBase.h:315
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:326
MatrixBase(const MatrixBase< EE > &b)
Definition: MatrixBase.h:295
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:288
MatrixBase< ENeg > TNeg
Definition: MatrixBase.h:104
int ncol() const
Return the number of columns n in the logical shape of this matrix.
Definition: MatrixBase.h:139
MatrixBase & setTo(const ELT &t)
Fill every element in current allocation with given element (or NaN or 0).
Definition: MatrixBase.h:583
RowVectorView_< ELT > & updAsRowVectorView()
Definition: MatrixBase.h:813
MatrixBase & operator+=(const MatrixBase< EE > &b)
Definition: MatrixBase.h:300
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
EltResult< EE >::Dvd elementwiseDivide(const MatrixBase< EE > &m) const
Definition: MatrixBase.h:560
MatrixBase & resize(int m, int n)
Change the size of this matrix.
Definition: MatrixBase.h:774
bool hasContiguousData() const
Definition: MatrixBase.h:838
MatrixBase & scalarMultiplyFromLeftInPlace(const S &)
Set M(i,j) = S * M(i,j) for some "scalar" S.
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< typename CNT< E >::template Result< P >::Mul > Mul
Definition: MatrixBase.h:130
MatrixBase & negateInPlace()
Definition: MatrixBase.h:768
MatrixBase(const MatrixCommitment &commitment, const MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::DeepCopy &deep)
Definition: MatrixBase.h:280
(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:660
MatrixBase & elementwiseSubtractFromScalarInPlace(const S &s)
Set M(i,j) = s - M(i,j) for every element of M and some value s.
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
MatrixView_< ELT > & updAsMatrixView()
Definition: MatrixBase.h:794
const MatrixCommitment & getCharacterCommitment() const
MatrixView_< ELT > operator()(int i, int j, int m, int n) const
Definition: MatrixBase.h:602
const ELT & operator()(int i, int j) const
Definition: MatrixBase.h:659
MatrixBase & scalarSubtractInPlace(const S &s)
Subtract a scalar from M's diagonal.
Definition: MatrixBase.h:344
MatrixBase(const MatrixBase &b)
Copy constructor is a deep copy (not appropriate for views!).
Definition: MatrixBase.h:185
EPrecision Precision
Definition: MatrixBase.h:100
EScalar Scalar
Definition: MatrixBase.h:97
MatrixBase< ESqHermT > TSqHermT
Definition: MatrixBase.h:116
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
VectorView_< ELT > col(int j) const
Definition: BigMatrix.h:252
const MatrixBase & operator+() const
Definition: MatrixBase.h:761