1 #ifndef SimTK_SIMMATRIX_BIGMATRIX_H_ 2 #define SimTK_SIMMATRIX_BIGMATRIX_H_ 256 helper,0,j,nrow(),1);
265 helper,0,j,nrow(),1);
274 helper,i,0,1,ncol());
283 helper,i,0,1,ncol());
291 assert(v.
nrow() == nrow());
292 for (
int i=0; i < nrow(); ++i)
297 template <
class ELT>
template <
class EE>
inline void 299 assert(v.
nrow() == nrow());
300 out.
resize(nrow(), ncol());
301 for (
int j=0; j<ncol(); ++j)
302 for (
int i=0; i<nrow(); ++i)
303 out(i,j) = (*this)(i,j) * v[i];
310 assert(v.
nrow() == ncol());
311 for (
int j=0; j < ncol(); ++j)
316 template <
class ELT>
template <
class EE>
inline void 318 assert(v.
nrow() == ncol());
319 out.
resize(nrow(), ncol());
320 for (
int j=0; j<ncol(); ++j)
321 for (
int i=0; i<nrow(); ++i)
322 out(i,j) = (*this)(i,j) * v[j];
327 template <
class ELT>
template <
class ER,
class EC>
inline MatrixBase<ELT>&
329 assert(r.
nrow()==nrow() && c.
nrow()==ncol());
330 for (
int j=0; j<ncol(); ++j)
331 for (
int i=0; i<nrow(); ++i)
332 (*
this)(i,j) *= (r[i]*c[j]);
336 template <
class ELT>
template <
class ER,
class EC>
inline void 343 assert(r.
nrow()==nrow() && c.
nrow()==ncol());
344 out.resize(nrow(), ncol());
345 for (
int j=0; j<ncol(); ++j)
346 for (
int i=0; i<nrow(); ++i)
347 out(i,j) = (*this)(i,j) * (r[i]*c[j]);
353 for (
int j=0; j<ncol(); ++j)
354 for (
int i=0; i<nrow(); ++i)
362 const int nr=nrow(), nc=ncol();
363 for (
int j=0; j<nc; ++j)
364 for (
int i=0; i<nr; ++i) {
365 ELT& e = updElt(i,j);
371 template <
class ELT>
inline void 373 const int nr=nrow(), nc=ncol();
375 for (
int j=0; j<nc; ++j)
376 for (
int i=0; i<nr; ++i)
383 for (
int j=0; j<ncol(); ++j)
384 for (
int i=0; i<nrow(); ++i)
389 template <
class ELT>
template <
class S>
inline void 394 const int nr=nrow(), nc=ncol();
396 for (
int j=0; j<nc; ++j)
397 for (
int i=0; i<nr; ++i)
398 out(i,j) = (*this)(i,j) + s;
404 for (
int j=0; j<ncol(); ++j)
405 for (
int i=0; i<nrow(); ++i)
410 template <
class ELT>
template <
class S>
inline void 415 const int nr=nrow(), nc=ncol();
417 for (
int j=0; j<nc; ++j)
418 for (
int i=0; i<nr; ++i)
419 out(i,j) = (*this)(i,j) - s;
425 const int nr=nrow(), nc=ncol();
426 for (
int j=0; j<nc; ++j)
427 for (
int i=0; i<nr; ++i) {
428 ELT& e = updElt(i,j);
434 template <
class ELT>
template <
class S>
inline void 439 const int nr=nrow(), nc=ncol();
441 for (
int j=0; j<nc; ++j)
442 for (
int i=0; i<nr; ++i)
443 out(i,j) = s - (*this)(i,j);
449 const int nr=nrow(), nc=ncol();
450 assert(r.
nrow()==nr && r.
ncol()==nc);
451 for (
int j=0; j<nc; ++j)
452 for (
int i=0; i<nr; ++i)
453 (*
this)(i,j) *= r(i,j);
457 template <
class ELT>
template <
class EE>
inline void 462 const int nr=nrow(), nc=ncol();
463 assert(r.
nrow()==nr && r.
ncol()==nc);
465 for (
int j=0; j<nc; ++j)
466 for (
int i=0; i<nr; ++i)
467 out(i,j) = (*this)(i,j) * r(i,j);
473 const int nr=nrow(), nc=ncol();
474 assert(r.
nrow()==nr && r.
ncol()==nc);
475 for (
int j=0; j<nc; ++j)
476 for (
int i=0; i<nr; ++i) {
477 ELT& e = updElt(i,j);
483 template <
class ELT>
template <
class EE>
inline void 488 const int nr=nrow(), nc=ncol();
489 assert(r.
nrow()==nr && r.
ncol()==nc);
491 for (
int j=0; j<nc; ++j)
492 for (
int i=0; i<nr; ++i)
493 out(i,j) = r(i,j) * (*this)(i,j);
499 const int nr=nrow(), nc=ncol();
500 assert(r.
nrow()==nr && r.
ncol()==nc);
501 for (
int j=0; j<nc; ++j)
502 for (
int i=0; i<nr; ++i)
503 (*
this)(i,j) /= r(i,j);
507 template <
class ELT>
template <
class EE>
inline void 512 const int nr=nrow(), nc=ncol();
513 assert(r.
nrow()==nr && r.
ncol()==nc);
515 for (
int j=0; j<nc; ++j)
516 for (
int i=0; i<nr; ++i)
517 out(i,j) = (*this)(i,j) / r(i,j);
522 const int nr=nrow(), nc=ncol();
523 assert(r.
nrow()==nr && r.
ncol()==nc);
524 for (
int j=0; j<nc; ++j)
525 for (
int i=0; i<nr; ++i) {
526 ELT& e = updElt(i,j);
532 template <
class ELT>
template <
class EE>
inline void 537 const int nr=nrow(), nc=ncol();
538 assert(r.
nrow()==nr && r.
ncol()==nc);
540 for (
int j=0; j<nc; ++j)
541 for (
int i=0; i<nr; ++i)
542 out(i,j) = r(i,j) / (*this)(i,j);
566 template <
class E1,
class E2>
582 template <
class E1,
class E2>
583 Matrix_<typename CNT<E1>::template Result<E2>::Sub>
604 template <
class E> Matrix_<E>
608 template <
class E> Matrix_<E>
612 template <
class E> Matrix_<E>
617 template <
class E> Matrix_<E>
621 template <
class E> Matrix_<E>
625 template <
class E> Matrix_<E>
635 template <
class E1,
class E2>
636 Vector_<typename CNT<E1>::template Result<E2>::Add>
648 template <
class E1,
class E2>
649 Vector_<typename CNT<E1>::template Result<E2>::Sub>
666 template <
class E> Vector_<E>
670 template <
class E> Vector_<E>
674 template <
class E> Vector_<E>
679 template <
class E> Vector_<E>
683 template <
class E> Vector_<E>
687 template <
class E> Vector_<E>
695 template <
class E1,
int M,
class E2,
int S>
696 Vector_<typename CNT<E1>::template Result< Vec<M,E2,S> >::Mul>
699 for (
int i=0; i < v.
nrow(); ++i)
705 template <
class E1,
int M,
class E2,
int S>
706 Vector_<typename Vec<M,E2,S>::template Result<E1>::Mul>
709 for (
int i=0; i < v.
nrow(); ++i)
715 template <
class E1,
int N,
class E2,
int S>
716 Vector_<typename CNT<E1>::template Result< Row<N,E2,S> >::Mul>
719 for (
int i=0; i < v.
nrow(); ++i)
725 template <
class E1,
int N,
class E2,
int S>
726 Vector_<typename Row<N,E2,S>::template Result<E1>::Mul>
729 for (
int i=0; i < v.
nrow(); ++i)
735 template <
class E1,
int M,
int N,
class E2,
int S1,
int S2>
736 Vector_<typename CNT<E1>::template Result< Mat<M,N,E2,S1,S2> >::Mul>
739 for (
int i=0; i < v.
nrow(); ++i)
745 template <
class E1,
int M,
int N,
class E2,
int S1,
int S2>
746 Vector_<typename Mat<M,N,E2,S1,S2>::template Result<E1>::Mul>
749 for (
int i=0; i < v.
nrow(); ++i)
755 template <
class E1,
int M,
class E2,
int S>
756 Vector_<typename CNT<E1>::template Result< SymMat<M,E2,S> >::Mul>
759 for (
int i=0; i < v.
nrow(); ++i)
765 template <
class E1,
int M,
class E2,
int S>
766 Vector_<typename SymMat<M,E2,S>::template Result<E1>::Mul>
769 for (
int i=0; i < v.
nrow(); ++i)
780 template <
class E1,
class E2>
781 RowVector_<typename CNT<E1>::template Result<E2>::Add>
793 template <
class E1,
class E2>
794 RowVector_<typename CNT<E1>::template Result<E2>::Sub>
811 template <
class E> RowVector_<E>
815 template <
class E> RowVector_<E>
819 template <
class E> RowVector_<E>
824 template <
class E> RowVector_<E>
828 template <
class E> RowVector_<E>
832 template <
class E> RowVector_<E>
841 template <
class E1,
int M,
class E2,
int S>
842 RowVector_<typename CNT<E1>::template Result< Vec<M,E2,S> >::Mul>
845 for (
int i=0; i < v.
ncol(); ++i)
851 template <
class E1,
int M,
class E2,
int S>
852 RowVector_<typename Vec<M,E2,S>::template Result<E1>::Mul>
855 for (
int i=0; i < v.
ncol(); ++i)
861 template <
class E1,
int N,
class E2,
int S>
862 RowVector_<typename CNT<E1>::template Result< Row<N,E2,S> >::Mul>
865 for (
int i=0; i < v.
ncol(); ++i)
871 template <
class E1,
int N,
class E2,
int S>
872 RowVector_<typename Row<N,E2,S>::template Result<E1>::Mul>
875 for (
int i=0; i < v.
ncol(); ++i)
881 template <
class E1,
int M,
int N,
class E2,
int S1,
int S2>
882 RowVector_<typename CNT<E1>::template Result< Mat<M,N,E2,S1,S2> >::Mul>
885 for (
int i=0; i < v.
ncol(); ++i)
891 template <
class E1,
int M,
int N,
class E2,
int S1,
int S2>
892 RowVector_<typename Mat<M,N,E2,S1,S2>::template Result<E1>::Mul>
895 for (
int i=0; i < v.
ncol(); ++i)
901 template <
class E1,
int M,
class E2,
int S>
902 RowVector_<typename CNT<E1>::template Result< SymMat<M,E2,S> >::Mul>
905 for (
int i=0; i < v.
ncol(); ++i)
911 template <
class E1,
int M,
class E2,
int S>
912 RowVector_<typename SymMat<M,E2,S>::template Result<E1>::Mul>
915 for (
int i=0; i < v.
ncol(); ++i)
931 template <
class E1,
class E2>
932 typename CNT<E1>::template Result<E2>::Mul
936 for (
int j=0; j < r.
ncol(); ++j)
941 template <
class E1,
class E2>
942 Vector_<typename CNT<E1>::template Result<E2>::Mul>
946 for (
int i=0; i< m.
nrow(); ++i)
951 template <
class E1,
class E2>
952 Matrix_<typename CNT<E1>::template Result<E2>::Mul>
958 for (
int j=0; j < res.ncol(); ++j)
959 for (
int i=0; i < res.nrow(); ++i)
960 res(i,j) = m1[i] * m2(j);
976 template <
class T>
static inline 982 if (!in.good()) {in.setstate(std::ios::failbit);
return in;}
991 const int numRequired = isFixedSize ? out.
size() : 0;
999 std::ws(in);
if (in.fail())
return in;
1001 if (isFixedSize && numRequired != 0)
1002 in.setstate(std::ios_base::failbit);
1010 typename std::iostream::int_type ch;
1012 const typename std::iostream::int_type EOFch =
1013 std::iostream::traits_type::eof();
1018 bool tildeFound =
false;
1019 ch = in.peek();
if (in.fail())
return in;
1020 assert(ch != EOFch);
1021 if ((
char)ch ==
'~') {
1025 if (in.good()) std::ws(in);
1027 if (!in.good()) {in.setstate(std::ios_base::failbit);
return in;}
1035 bool lookForCloser =
true;
1036 char openBracket, closeBracket;
1037 ch = in.peek();
if (in.fail())
return in;
1038 assert(ch != EOFch);
1040 openBracket = (char)ch;
1041 if (openBracket==
'(') {in.get(); closeBracket =
')';}
1042 else if (openBracket==
'[') {in.get(); closeBracket =
']';}
1043 else lookForCloser =
false;
1047 if (tildeFound && !lookForCloser)
1048 { in.setstate(std::ios_base::failbit);
return in;}
1054 if (in.good()) std::ws(in);
1060 assert(lookForCloser);
1061 in.setstate(std::ios::failbit);
1071 bool commaOK =
true, commaRequired =
false;
1072 bool terminatorSeen =
false;
1089 if (lookForCloser) {
1091 std::ws(in);
if (!in.good())
break;
1092 ch = in.peek(); assert(ch != EOFch);
1093 if (!in.good())
break;
1095 if (c == closeBracket) {
1097 terminatorSeen =
true;
1107 if (isFixedSize && (nextIndex == numRequired))
1111 if (commaOK && nextIndex != 0) {
1113 std::ws(in);
if (!in.good())
break;
1114 ch = in.peek(); assert(ch != EOFch);
1115 if (!in.good())
break;
1119 commaRequired =
true;
1122 { in.setstate(std::ios::failbit);
break; }
1123 else commaOK =
false;
1125 if (!in.good())
break;
1136 in >> out[nextIndex];
if (in.fail())
break;
1139 if (!in.good())
break;
1153 if (lookForCloser && !terminatorSeen)
1154 in.setstate(std::ios::failbit);
1156 if (isFixedSize && nextIndex != numRequired)
1157 in.setstate(std::ios::failbit);
1182 template <
class E>
inline void 1184 const int sz = v.
size();
1185 for (
int i=0; i < sz; ++i) {
1186 if (i != 0) o <<
" ";
1192 template <
class E>
inline void 1198 template <
class E>
inline void 1205 template <
class E>
inline void 1211 template <
class E>
inline void 1217 template <
class E>
inline void 1224 template <
class E>
inline void 1226 const int nr = v.
nrow();
1227 for (
int i=0; i < nr; ++i) {
1228 if (i != 0) o << std::endl;
1234 template <
class E>
inline void 1240 template <
class E>
inline void 1247 template <
class E>
inline bool 1249 for (
int i=0; i < v.
size(); ++i)
1256 template <
class E>
inline bool 1264 for (
int i=0; i<a.
size(); ++i)
1272 template <
class E>
inline bool 1275 return readUnformatted<E>(in, vt); }
1280 template <
class E>
inline bool 1283 return readUnformatted<E>(in, vt); }
1290 template <
class E>
inline bool 1292 for (
int row=0; row < v.
nrow(); ++row) {
1294 if (!readUnformatted<E>(in, oneRow))
return false;
1304 template <
class E>
inline bool 1312 template <
class E>
inline bool 1315 "SimTK::readUnformatted(istream, Matrix) is not implemented; try" 1316 " SimTK::fillUnformatted(istream, Matrix) instead.");
1326 template <
class T>
inline std::ostream&
1327 operator<<(std::ostream& o, const VectorBase<T>& v)
1331 for (
int i=1; i < v.size(); ++i) o <<
" " << v[i];
1342 template <
class T>
inline std::ostream&
1343 operator<<(std::ostream& o, const RowVectorBase<T>& v)
1347 for (
int i=1; i < v.size(); ++i) o <<
" " << v[i];
1359 template <
class T>
inline std::ostream&
1360 operator<<(std::ostream& o, const MatrixBase<T>& m) {
1361 for (
int i=0;i<m.nrow();++i)
1362 o << std::endl << m[i];
1363 if (m.nrow()) o << std::endl;
1399 template <
class T>
static inline 1401 {
return readVectorFromStreamHelper<T>(in,
false , out); }
1429 template <
class T>
static inline 1431 {
return readVectorFromStreamHelper<T>(in,
true , out); }
1437 template <
class T>
static inline 1439 {
return readVectorFromStreamHelper<T>(in,
true , out); }
1451 template <
class T>
inline 1453 {
return readVectorFromStream<T>(in, out); }
1462 template <
class T>
inline 1464 {
return fillVectorViewFromStream<T>(in, out); }
1566 #endif //SimTK_SIMMATRIX_BIGMATRIX_H_
Matrix_< E > operator/(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:613
VectorView_< dComplex > dComplexVectorView
Abbreviation for VectorView_<std::complex<double>>.
Definition: BigMatrix.h:1525
MatrixView_< Real > MatrixView
Non-owner matrix sharing Real elements.
Definition: BigMatrix.h:1498
MatrixView_< fComplex > fComplexMatrixView
Abbreviation for MatrixView_<std::complex<float>>.
Definition: BigMatrix.h:1559
#define SimTK_SIZECHECK(sz, maxsz, where)
Definition: ExceptionMacros.h:146
Vector_< fComplex > fComplexVector
Abbreviation for Vector_<std::complex<float>>.
Definition: BigMatrix.h:1514
Here we declare the detailed interface to the Simmatrix classes.
size_type size() const
Return the current number of elements stored in this array.
Definition: Array.h:2075
void writeUnformatted(std::ostream &o, const VectorBase< E > &v)
Specialize for VectorBase<E> to delegate to element type E, with spaces separating the elements...
Definition: BigMatrix.h:1183
Vector_< float > fVector
Abbreviation for Vector_<float>.
Definition: BigMatrix.h:1510
This is a small, fixed-size symmetric or Hermitian matrix designed for no-overhead inline computation...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:621
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
VectorView_< Complex > ComplexVectorView
Non-owner column vector sharing Complex (std::complex<Real>) elements.
Definition: BigMatrix.h:1503
void elementwiseSubtractFromScalar(const S &, typename MatrixBase< S >::template EltResult< E >::Sub &) const
Definition: BigMatrix.h:435
std::istream & operator>>(std::istream &in, VectorView_< T > &out)
Read a (fixed size n) VectorView_<T> from a stream as a sequence of space- or comma-separated values ...
Definition: BigMatrix.h:1463
bool readUnformatted(std::istream &in, T &v)
The default implementation of readUnformatted<T> reads in the next whitespace-separated token and the...
Definition: Serialize.h:176
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
MatrixBase & elementwiseSubtractScalarInPlace(const S &s)
Set M(i,j)-=s for every element of M and some value s.
VectorView_< Real > VectorView
Non-owner column vector sharing Real elements.
Definition: BigMatrix.h:1496
Defines an iterator that can be used to iterate over the elements of any kind of Simbody vector...
Define the SimTK::RowVectorBase class that is part of Simbody's BigMatrix toolset.
#define SimTK_ASSERT_ALWAYS(cond, msg)
Definition: ExceptionMacros.h:349
Matrix_< typename CNT< E1 >::template Result< E2 >::Sub > operator-(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:584
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
bool readUnformatted(std::istream &in, VectorView_< E > &v)
Read fixed-size VectorView from input stream.
Definition: BigMatrix.h:1248
MatrixBase & elementwiseAssign(const S &s)
Set M(i,j)=s for every element of M and some value s.
RowVectorView_< Complex > ComplexRowVectorView
Non-owner row vector sharing Complex (std::complex<Real>) elements.
Definition: BigMatrix.h:1507
VectorView_< ELT > updCol(int j)
Definition: BigMatrix.h:261
MatrixView_< double > dMatrixView
Abbreviation for MatrixView_<double>.
Definition: BigMatrix.h:1557
void writeUnformatted(std::ostream &o, const Vector_< E > &v)
Raw serialization of Vector_<E>; same as VectorBase<E>.
Definition: BigMatrix.h:1199
RowVectorView_< ELT > updRow(int i)
Definition: BigMatrix.h:279
VectorView_< double > dVectorView
Abbreviation for VectorView_<double>.
Definition: BigMatrix.h:1521
static TInvert invert(const K &t)
Definition: CompositeNumericalTypes.h:243
VectorView_< ELT > col(int j) const
Definition: BigMatrix.h:252
MatrixView_< float > fMatrixView
Abbreviation for MatrixView_<float>.
Definition: BigMatrix.h:1555
bool readUnformatted(std::istream &in, Vector_< E > &v)
Read variable-size Vector from input stream.
Definition: BigMatrix.h:1257
Define the SimTK::VectorView_ class that is part of Simbody's BigMatrix toolset.
Vector_< dComplex > dComplexVector
Abbreviation for Vector_<std::complex<double>>.
Definition: BigMatrix.h:1516
void writeUnformatted(std::ostream &o, const VectorView_< E > &v)
Raw serialization of VectorView_<E>; same as VectorBase<E>.
Definition: BigMatrix.h:1193
VectorView_< fComplex > fComplexVectorView
Abbreviation for VectorView_<std::complex<float>>.
Definition: BigMatrix.h:1523
std::istream & operator>>(std::istream &in, Vector_< T > &out)
Read Vector_<T> from a stream as a sequence of space- or comma-separated values of type T...
Definition: BigMatrix.h:1452
(Advanced) This class is identical to RowVector_ except that it has shallow (reference) copy and assi...
Definition: BigMatrix.h:173
void writeUnformatted(std::ostream &o, const RowVector_< E > &v)
Raw serialization of RowVector_<E>; same as Vector_<E>.
Definition: BigMatrix.h:1218
bool isResizeable() const
Return true if either dimension of this Matrix is resizable.
Definition: MatrixBase.h:150
Matrix_< float > fMatrix
Abbreviation for Matrix_<float>.
Definition: BigMatrix.h:1546
ELEM sum(const VectorBase< ELEM > &v)
Definition: VectorMath.h:147
Define the SimTK::VectorBase class that is part of Simbody's BigMatrix toolset.
MatrixView_< ELT > updBlock(int i, int j, int m, int n)
Definition: BigMatrix.h:211
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:618
MatrixBase< typename CNT< E >::TInvert > elementwiseInvert() const
Definition: MatrixBase.h:452
void writeUnformatted(std::ostream &o, const MatrixView_< E > &v)
Raw serialization of MatrixView_<E>; same as MatrixBase<E>.
Definition: BigMatrix.h:1235
This is an iterator for iterating over the elements of a Vector_ or Vec object.
Definition: BigMatrix.h:176
This is the default commitment for a row vector.
Definition: MatrixCharacteristics.h:1005
Matrix_< fComplex > fComplexMatrix
Abbreviation for Matrix_<std::complex<float>>.
Definition: BigMatrix.h:1550
Matrix_< E > operator*(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:605
The Array_<T> container class is a plug-compatible replacement for the C++ standard template library ...
Definition: Array.h:53
void writeUnformatted(std::ostream &o, const RowVectorView_< E > &v)
Raw serialization of RowVectorView_<E>; same as VectorView_<E>.
Definition: BigMatrix.h:1212
Define the SimTK::Matrix_ class that is part of Simbody's BigMatrix toolset.
void colScale(const VectorBase< EE > &c, typename EltResult< EE >::Mul &out) const
(Advanced) This class is identical to Matrix_ except that it has shallow (reference) copy and assignm...
Definition: BigMatrix.h:167
Matrix_< double > dMatrix
Abbreviation for Matrix_<double>.
Definition: BigMatrix.h:1548
bool readUnformatted(std::istream &in, RowVector_< E > &v)
Read variable-size RowVector from unformatted (whitespace-separated) input stream.
Definition: BigMatrix.h:1281
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
MatrixView_< EHerm > updTranspose()
Definition: BigMatrix.h:230
This is a user-includable header which includes everything needed to make use of SimMatrix Scalar cod...
Define the SimTK::MatrixView_ class that is part of Simbody's BigMatrix toolset.
VectorView_< float > fVectorView
Abbreviation for VectorView_<float>.
Definition: BigMatrix.h:1519
Matrix_< dComplex > dComplexMatrix
Abbreviation for Matrix_<std::complex<double>>.
Definition: BigMatrix.h:1552
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
VectorBase & resizeKeep(int m)
Definition: VectorBase.h:452
void elementwiseMultiplyFromLeft(const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Mul &) const
Definition: BigMatrix.h:484
int ncol() const
Return the number of columns n in the logical shape of this matrix.
Definition: MatrixBase.h:138
RowVector_< float > fRowVector
Abbreviation for RowVector_<float>.
Definition: BigMatrix.h:1528
MatrixView_< Complex > ComplexMatrixView
Non-owner matrix sharing Complex (std::complex<Real>) elements.
Definition: BigMatrix.h:1505
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
Matrix_< Real > Matrix
Variable-size 2D matrix of Real elements; abbreviation for Matrix_<Real>.
Definition: BigMatrix.h:1478
MatrixHelperRep< S > * stealRep()
Definition: MatrixHelper.h:336
void writeUnformatted(std::ostream &o, const Matrix_< E > &v)
Raw serialization of Vector_<E>; same as VectorBase<E>.
Definition: BigMatrix.h:1241
Here we declare the classes needed for managing the properties of matrices, which we call Matrix Char...
This file is the user-includeable header to be included in user programs to provide fixed-length Vec ...
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.
RowVector_< double > dRowVector
Abbreviation for RowVector_<double>.
Definition: BigMatrix.h:1530
bool readUnformatted(std::istream &in, Matrix_< E > &v)
NOT IMPLEMENTED: read variable-size Matrix recognizing newlines as end of row; use fillUnformatted() ...
Definition: BigMatrix.h:1313
RowVector_< dComplex > dComplexRowVector
Abbreviation for RowVector_<std::complex<double>>.
Definition: BigMatrix.h:1534
This is the matrix class intended to appear in user code for large, variable size matrices...
Definition: BigMatrix.h:168
RowVectorView_< double > dRowVectorView
Abbreviation for RowVectorView_<double>.
Definition: BigMatrix.h:1539
MatrixBase & elementwiseAddScalarInPlace(const S &s)
Set M(i,j)+=s for every element of M and some value s.
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
int nrow() const
Definition: VectorBase.h:401
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
bool readUnformatted(std::istream &in, RowVectorView_< E > &v)
Read fixed-size RowVectorView from input stream.
Definition: BigMatrix.h:1273
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:619
static std::istream & fillVectorViewFromStream(std::istream &in, VectorView_< T > &out)
Read in a fixed number of elements from a stream into an VectorView.
Definition: BigMatrix.h:1438
K T
Definition: CompositeNumericalTypes.h:138
RowVectorView_< fComplex > fComplexRowVectorView
Abbreviation for RowVectorView_<std::complex<float>>.
Definition: BigMatrix.h:1541
MatrixView_< EHerm > transpose() const
Definition: BigMatrix.h:222
RowVector_< Complex > ComplexRowVector
Variable-size row vector of Complex (std::complex<Real>) elements.
Definition: BigMatrix.h:1493
void clear()
Definition: VectorBase.h:455
bool readUnformatted(std::istream &in, MatrixView_< E > &v)
Read fixed-size MatrixView in row order from unformatted (whitespace- separated) input stream...
Definition: BigMatrix.h:1291
Vector_< Complex > ComplexVector
Variable-size column vector of Complex (std::complex<Real>) elements.
Definition: BigMatrix.h:1489
MatrixView_< dComplex > dComplexMatrixView
Abbreviation for MatrixView_<std::complex<double>>.
Definition: BigMatrix.h:1561
void elementwiseAddScalar(const S &s, typename EltResult< S >::Add &) const
RowVector_< fComplex > fComplexRowVector
Abbreviation for RowVector_<std::complex<float>>.
Definition: BigMatrix.h:1532
void writeUnformatted(std::ostream &o, const RowVectorBase< E > &v)
Specialize for RowVectorBase<E> to delegate to element type E, with spaces separating the elements; r...
Definition: BigMatrix.h:1206
Define the SimTK::RowVector_ class that is part of Simbody's BigMatrix toolset.
int size() const
Definition: RowVectorBase.h:237
This is a dataless rehash of the MatrixBase class to specialize it for Vectors.
Definition: BigMatrix.h:164
Vector_< Real > Vector
Variable-size column vector of Real elements; abbreviation for Vector_<Real>.
Definition: BigMatrix.h:1473
#define SimTK_INDEXCHECK(ix, ub, where)
Definition: ExceptionMacros.h:145
Define the SimTK::MatrixBase class that is part of Simbody's BigMatrix toolset.
Represents a variable size row vector; much less common than the column vector type Vector_...
Definition: BigMatrix.h:174
int size() const
Definition: VectorBase.h:396
Define the SimTK::Vector_ class that is part of Simbody's BigMatrix toolset.
static std::istream & readVectorFromStreamHelper(std::istream &in, bool isFixedSize, Vector_< T > &out)
Definition: BigMatrix.h:978
Define the SimTK::RowVectorView_ class that is part of Simbody's BigMatrix toolset.
A MatrixCommitment provides a set of acceptable matrix characteristics.
Definition: MatrixCharacteristics.h:832
VectorView_< ELT > & updAsVectorView()
Definition: MatrixBase.h:799
void elementwiseDivide(const MatrixBase< EE > &, typename EltResult< EE >::Dvd &) const
RowVectorView_< Real > RowVectorView
Non-owner row vector sharing Real elements.
Definition: BigMatrix.h:1500
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...
Matrix_< typename CNT< E1 >::template Result< E2 >::Add > operator+(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:568
Matrix_< Complex > ComplexMatrix
Variable-size 2D matrix of Complex (std::complex<Real>) elements.
Definition: BigMatrix.h:1491
static std::istream & readVectorFromStream(std::istream &in, Vector_< T > &out)
Read in a Vector_<T> from a stream, as a sequence of space-separated or comma-separated values option...
Definition: BigMatrix.h:1400
MatrixView_< ELT > block(int i, int j, int m, int n) const
Definition: BigMatrix.h:200
VectorBase & resize(int m)
Definition: VectorBase.h:451
Vector_< double > dVector
Abbreviation for Vector_<double>.
Definition: BigMatrix.h:1512
MatrixBase & elementwiseDivideInPlace(const MatrixBase< EE > &)
M(i,j) /= R(i,j); R must have same dimensions as this.
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:620
This is the common base class for Simbody's Vector_ and Matrix_ classes for handling large...
Definition: BigMatrix.h:163
bool fillUnformatted(std::istream &in, Matrix_< E > &v)
Read in new values for a Matrix without changing its size, from a stream of whitespace-separated toke...
Definition: BigMatrix.h:1305
void elementwiseMultiply(const MatrixBase< EE > &, typename EltResult< EE >::Mul &) const
void writeUnformatted(std::ostream &o, const MatrixBase< E > &v)
Specialize for MatrixBase<E> delegating to RowVectorBase<E> with newlines separating the rows...
Definition: BigMatrix.h:1225
int ncol() const
Definition: RowVectorBase.h:243
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.
RowVector_< Real > RowVector
Variable-size row vector of Real elements; abbreviation for RowVector_<Real>.
Definition: BigMatrix.h:1483
static std::istream & fillVectorFromStream(std::istream &in, Vector_< T > &out)
Read in a fixed number of elements from a stream into a Vector.
Definition: BigMatrix.h:1430
MatrixBase & resize(int m, int n)
Change the size of this matrix.
Definition: MatrixBase.h:773
RowVectorView_< dComplex > dComplexRowVectorView
Abbreviation for RowVectorView_<std::complex<double>>.
Definition: BigMatrix.h:1543
(Advanced) This class is identical to Vector_ except that it has shallow (reference) copy and assignm...
Definition: BigMatrix.h:170
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:793
This is the default commitment for a column vector.
Definition: MatrixCharacteristics.h:981
int nrow() const
Return the number of rows m in the logical shape of this matrix.
Definition: MatrixBase.h:136
RowVectorView_< float > fRowVectorView
Abbreviation for RowVectorView_<float>.
Definition: BigMatrix.h:1537
RowVectorView_< ELT > row(int i) const
Definition: BigMatrix.h:270