1 #ifndef SimTK_SIMMATRIX_MATRIXBASE_H_
2 #define SimTK_SIMMATRIX_MATRIXBASE_H_
227 { helper.
fillWith(reinterpret_cast<const Scalar*>(&initialValue)); }
240 const ELT* 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
397 template <
class EE>
inline typename EltResult<EE>::Mul
399 typename EltResult<EE>::Mul out(
nrow(),
ncol());
rowScale(r,out);
return out;
407 template <
class EE>
inline void
410 template <
class EE>
inline typename EltResult<EE>::Mul
412 typename EltResult<EE>::Mul out(
nrow(),
ncol());
colScale(c,out);
return out;
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
429 typename EltResult<typename VectorBase<ER>::template EltResult<EC>::Mul>::Mul
446 {
return elementwiseAssign<Real>(
Real(s)); }
469 template <
class S>
inline void
472 template <
class S>
inline typename EltResult<S>::Add
474 typename EltResult<S>::Add out(
nrow(),
ncol());
489 template <
class S>
inline void
492 template <
class S>
inline typename EltResult<S>::Sub
494 typename EltResult<S>::Sub out(
nrow(),
ncol());
510 template <
class S>
inline void
518 elementwiseSubtractFromScalar<S>(s,out);
526 template <
class EE>
inline void
529 template <
class EE>
inline typename EltResult<EE>::Mul
531 typename EltResult<EE>::Mul out(
nrow(),
ncol());
532 elementwiseMultiply<EE>(m,out);
540 template <
class EE>
inline void
547 typename EltResult<EE>::Mul out(
nrow(),
ncol());
548 elementwiseMultiplyFromLeft<EE>(m,out);
556 template <
class EE>
inline void
559 template <
class EE>
inline typename EltResult<EE>::Dvd
561 typename EltResult<EE>::Dvd out(
nrow(),
ncol());
562 elementwiseDivide<EE>(m,out);
570 template <
class EE>
inline void
578 elementwiseDivideFromLeft<EE>(m,out);
603 {
return block(i,j,m,n); }
644 void dump(
const char* msg=0)
const {
665 template <
class ELT_A,
class ELT_B>
669 helper.
matmul(beta,alpha,A.helper,B.helper);
681 const ELT&
getElt(
int i,
int j)
const {
return *
reinterpret_cast<const ELT*
>(helper.
getElt(i,j)); }
682 ELT&
updElt(
int i,
int j) {
return *
reinterpret_cast< ELT*
>(helper.
updElt(i,j)); }
692 { helper.
getAnyElt(i,j,reinterpret_cast<Scalar*>(&value)); }
702 for(
int j=0;j<nc;++j)
703 for (
int i=0; i<nr; ++i)
716 for(
int j=0;j<nc;++j)
717 for (
int i=0; i<nr; ++i)
739 for(
int j=0;j<nc;++j)
740 for (
int i=0; i<nr; ++i)
767 const int cols =
ncol();
769 for (
int j = 0; j < cols; ++j)
770 helper.
colSum(j, reinterpret_cast<Scalar*>(&row[j]));
778 const int rows =
nrow();
780 for (
int i = 0; i < rows; ++i)
781 helper.
rowSum(i, reinterpret_cast<Scalar*>(&col[i]));
887 explicit MatrixBase(MatrixHelperRep<Scalar>* hrep) : helper(hrep) {}
901 #endif // SimTK_SIMMATRIX_MATRIXBASE_H_