1 #ifndef SimTK_SIMMATRIX_MATRIX_HELPER_H_
2 #define SimTK_SIMMATRIX_MATRIX_HELPER_H_
48 template <
class S>
class MatrixHelperRep;
49 class MatrixCharacter;
50 class MatrixCommitment;
175 int n,
const int* indices);
177 int n,
const int* indices);
231 bool isClear()
const;
238 const S* getElt(
int i,
int j)
const;
239 S* updElt(
int i,
int j);
242 const S* getElt(
int i)
const;
248 void getAnyElt(
int i,
int j, S* value)
const;
251 void getAnyElt(
int i, S* value)
const;
255 void sum(S* eltp)
const;
256 void colSum(
int j, S* eltp)
const;
257 void rowSum(
int i, S* eltp)
const;
266 void fillWith(
const S* eltp);
271 void copyInByRowsFromCpp(
const S* elts);
276 void fillWithScalar(
const StdNumber&);
280 void scaleBy(
const StdNumber&);
285 void invertInPlace();
287 void dump(
const char* msg=0)
const;
290 template <
class SA,
class SB>
291 void matmul(
const StdNumber& beta,
301 ptrdiff_t nelt()
const;
312 void resize(
int m,
int n);
318 void resizeKeep(
int m,
int n);
329 bool hasContiguousData()
const;
330 ptrdiff_t getContiguousDataLength()
const;
331 const S* getContiguousData()
const;
332 S* updContiguousData();
334 void replaceContiguousData(S* newData, ptrdiff_t length,
bool takeOwnership);
335 void replaceContiguousData(
const S* newData, ptrdiff_t length);
336 void swapOwnedContiguousData(S* newData, ptrdiff_t length, S*& oldData);
338 const MatrixHelperRep<S>&
getRep()
const {assert(rep);
return *rep;}
339 MatrixHelperRep<S>&
updRep() {assert(rep);
return *rep;}
340 void setRep(MatrixHelperRep<S>* hrep) {assert(!rep); rep = hrep;}
341 MatrixHelperRep<S>* stealRep()
342 { assert(rep); MatrixHelperRep<S>* stolen=rep; rep=0;
return stolen; }
344 void deleteRepIfOwner();
345 void replaceRep(MatrixHelperRep<S>*);
354 class MatrixHelperRep<S>* rep;
365 #endif // SimTK_SIMMATRIX_MATRIX_HELPER_H_