Simbody
3.5
|
This is the vector class intended to appear in user code for large, variable size column vectors. More...
Public Member Functions | |
Owner constructors | |
These constructors create a Vector_ object that allocates new data on the heap and serves as the owner of that data. Any existing data that is supplied in these constructors is copied, not shared. | |
Vector_ () | |
Default constructor creates a 0x1, reallocatable vector. More... | |
Vector_ (const Vector_ &src) | |
Copy constructor is deep, that is the source Vector_ is copied, not referenced. More... | |
Vector_ (const Base &src) | |
This copy constructor serves as an implicit conversion from objects of the base class type (for example, a VectorView_<ELT>), to objects of this Vector_<ELT> type. More... | |
Vector_ (const BaseNeg &src) | |
This copy constructor serves as an implicit conversion from objects of the base class but with negated elements, to objects of this Vector_<ELT> type. More... | |
Vector_ (int m) | |
Construct a Vector_ with a given preallocated size, but with uninitialized values. More... | |
Vector_ (int m, const ELT *cppInitialValues) | |
Construct an owner Vector_ of a given size m and initialize it from a C++ array of m ELT values pointed to by cppInitialValues. More... | |
Vector_ (int m, const ELT &initialValue) | |
Construct an owner Vector_ of a given size m and initialize all the elements to the given ELT value initialValue. More... | |
template<int M> | |
Vector_ (const Vec< M, ELT > &v) | |
This constructor creates a new owner Vector_ that is the same length and has a copy of the contents of a given fixed-size Vec. More... | |
View constructors | |
These constructors create a Vector_ object that is a view of existing data that is owned by some other object. Any existing data that is supplied in these constructors is shared, not copied, so writing to the created Vector_ view modifies the original data. | |
Vector_ (int m, const S *cppData, bool) | |
Construct a Vector_ which shares read-only, borrowed space with assumed element-to-element stride equal to the C++ element spacing. More... | |
Vector_ (int m, S *cppData, bool) | |
Construct a Vector_ which shares writable, borrowed space with assumed element-to-element stride equal to the C++ element spacing. More... | |
Vector_ (int m, int stride, const S *data, bool) | |
Borrowed-space read-only construction with explicit stride supplied as "number of scalars between elements". More... | |
Vector_ (int m, int stride, S *data, bool) | |
Borrowed-space writable construction with explicit stride supplied as "number of scalars between elements". More... | |
Assignment operators | |
Vector_ & | operator= (const Vector_ &src) |
Copy assignment is deep and can be reallocating if this Vector_ is an owner. More... | |
template<class EE > | |
Vector_ & | operator= (const VectorBase< EE > &src) |
Like copy assignment but the source can be any object of the base type, even with a different element type EE as long as that element type is assignment-compatible to an element of our type ELT. More... | |
Vector_ & | operator= (const ELT &v) |
Set all elements of this Vector_ to the same value v. More... | |
template<class EE > | |
Vector_ & | operator+= (const VectorBase< EE > &m) |
Add in a conforming vector of the base type even if it has a different element type EE, provided that element type is add-compatible with our element type ELT, meaning that ELT+=EE is allowed. More... | |
template<class EE > | |
Vector_ & | operator-= (const VectorBase< EE > &m) |
In-place subtract of a conforming vector of the base type even if it has a different element type EE, provided that element type is subtract-compatible with our element type ELT, meaning that ELT-=EE is allowed. More... | |
Vector_ & | operator*= (const StdNumber &t) |
In-place multiply of each element of this Vector_ by a scalar t. More... | |
Vector_ & | operator/= (const StdNumber &t) |
In-place divide of each element of this Vector_ by a scalar t. More... | |
Vector_ & | operator+= (const ELT &b) |
In-place add to each element of this Vector_ the same given value b. More... | |
Vector_ & | operator-= (const ELT &b) |
In-place subtract from each element of this Vector_ the same given value b. More... | |
Operator equivalents for scripting | |
Functions to be used for Scripting in MATLAB and languages that do not support operator overloading. | |
std::string | toString () const |
toString() returns a string representation of the Vector_. More... | |
const ELT & | get (int i) const |
Variant of operator[] that's scripting friendly to get ith element. More... | |
void | set (int i, const ELT &value) |
Variant of operator[] that's scripting friendly to set ith element. More... | |
Public Member Functions inherited from SimTK::VectorBase< ELT > | |
VectorBase & | operator= (const VectorBase &b) |
Copy assignment is deep copy but behavior depends on type of lhs: if view, rhs must match. More... | |
VectorBase & | operator*= (const StdNumber &t) |
VectorBase & | operator/= (const StdNumber &t) |
VectorBase & | operator+= (const VectorBase &r) |
VectorBase & | operator-= (const VectorBase &r) |
template<class EE > | |
VectorBase & | operator= (const VectorBase< EE > &b) |
template<class EE > | |
VectorBase & | operator+= (const VectorBase< EE > &b) |
template<class EE > | |
VectorBase & | operator-= (const VectorBase< EE > &b) |
VectorBase & | operator= (const ELT &t) |
Fill current allocation with copies of element. More... | |
template<class EE > | |
VectorBase & | rowScaleInPlace (const VectorBase< EE > &v) |
There's only one column here so it's a bit weird to use rowScale rather than elementwiseMultiply, but there's nothing really wrong with it. More... | |
template<class EE > | |
void | rowScale (const VectorBase< EE > &v, typename EltResult< EE >::Mul &out) const |
template<class EE > | |
EltResult< EE >::Mul | rowScale (const VectorBase< EE > &v) const |
CNT< ScalarNormSq >::TSqrt | normRMS (int *worstOne=0) const |
Return the root-mean-square (RMS) norm of a Vector of scalars, with optional return of the index of the element of largest absolute value. More... | |
template<class EE > | |
CNT< ScalarNormSq >::TSqrt | weightedNormRMS (const VectorBase< EE > &w, int *worstOne=0) const |
Return the weighted root-mean-square (WRMS) norm of a Vector of scalars, with optional return of the index of the weighted element of largest absolute value. More... | |
EAbs | normInf (int *worstOne=0) const |
Return the infinity norm (max absolute value) of a Vector of scalars, with optional return of the index of the element of largest absolute value. More... | |
template<class EE > | |
EAbs | weightedNormInf (const VectorBase< EE > &w, int *worstOne=0) const |
Return the weighted infinity norm (max absolute value) WInf of a Vector of scalars, with optional return of the index of the weighted element of largest absolute value. More... | |
VectorBase & | elementwiseInvertInPlace () |
Set this[i] = this[i]^-1. More... | |
void | elementwiseInvert (VectorBase< typename CNT< ELT >::TInvert > &out) const |
Set supplied out[i] = this[i]^-1. More... | |
VectorBase< typename CNT< ELT > ::TInvert > | elementwiseInvert () const |
Return out[i]=this[i]^-1 as function return. More... | |
template<class EE > | |
VectorBase & | elementwiseMultiplyInPlace (const VectorBase< EE > &r) |
template<class EE > | |
void | elementwiseMultiply (const VectorBase< EE > &v, typename EltResult< EE >::Mul &out) const |
template<class EE > | |
EltResult< EE >::Mul | elementwiseMultiply (const VectorBase< EE > &v) const |
template<class EE > | |
VectorBase & | elementwiseMultiplyFromLeftInPlace (const VectorBase< EE > &r) |
template<class EE > | |
void | elementwiseMultiplyFromLeft (const VectorBase< EE > &v, typename VectorBase< EE >::template EltResult< ELT >::Mul &out) const |
template<class EE > | |
VectorBase< EE >::template EltResult< ELT >::Mul | elementwiseMultiplyFromLeft (const VectorBase< EE > &v) const |
template<class EE > | |
VectorBase & | elementwiseDivideInPlace (const VectorBase< EE > &r) |
template<class EE > | |
void | elementwiseDivide (const VectorBase< EE > &v, typename EltResult< EE >::Dvd &out) const |
template<class EE > | |
EltResult< EE >::Dvd | elementwiseDivide (const VectorBase< EE > &v) const |
template<class EE > | |
VectorBase & | elementwiseDivideFromLeftInPlace (const VectorBase< EE > &r) |
template<class EE > | |
void | elementwiseDivideFromLeft (const VectorBase< EE > &v, typename VectorBase< EE >::template EltResult< ELT >::Dvd &out) const |
template<class EE > | |
VectorBase< EE >::template EltResult< ELT >::Dvd | elementwiseDivideFromLeft (const VectorBase< EE > &v) const |
operator const Vector_< ELT > & () const | |
operator Vector_< ELT > & () | |
operator const VectorView_< ELT > & () const | |
operator VectorView_< ELT > & () | |
operator const Matrix_< ELT > & () const | |
operator Matrix_< ELT > & () | |
operator const MatrixView_< ELT > & () const | |
operator MatrixView_< ELT > & () | |
int | size () const |
int | nrow () const |
int | ncol () const |
ptrdiff_t | nelt () const |
TAbs | abs () const |
const ELT & | operator[] (int i) const |
ELT & | operator[] (int i) |
const ELT & | operator() (int i) const |
ELT & | operator() (int i) |
VectorView_< ELT > | operator() (int i, int m) const |
VectorView_< ELT > | operator() (int i, int m) |
VectorView_< ELT > | index (const Array_< int > &indices) const |
VectorView_< ELT > | updIndex (const Array_< int > &indices) |
VectorView_< ELT > | operator() (const Array_< int > &indices) const |
VectorView_< ELT > | operator() (const Array_< int > &indices) |
THerm | transpose () const |
THerm | updTranspose () |
THerm | operator~ () const |
THerm | operator~ () |
const VectorBase & | operator+ () const |
const TNeg & | negate () const |
TNeg & | updNegate () |
const TNeg & | operator- () const |
TNeg & | operator- () |
VectorBase & | resize (int m) |
VectorBase & | resizeKeep (int m) |
void | clear () |
ELT | sum () const |
VectorIterator< ELT, VectorBase< ELT > > | begin () |
VectorIterator< ELT, VectorBase< ELT > > | end () |
VectorBase (int m=0) | |
Default constructor makes a 0x1 matrix locked at 1 column; you can provide an initial allocation if you want. More... | |
VectorBase (const VectorBase &source) | |
Copy constructor is a deep copy (not appropriate for views!). More... | |
VectorBase (const TNeg &source) | |
Implicit conversion from compatible vector with negated elements. More... | |
VectorBase (int m, const ELT &initialValue) | |
Construct an owner vector of length m, with each element initialized to the given value. More... | |
VectorBase (int m, const ELT *cppInitialValues) | |
Construct an owner vector of length m, with the elements initialized sequentially from a C++ array of elements which is assumed to be of length m. More... | |
VectorBase (int m, int stride, const Scalar *s) | |
Construct a read-only view of existing data. More... | |
VectorBase (int m, int stride, Scalar *s) | |
Construct a writable view into existing data. More... | |
VectorBase (MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::ShallowCopy &s) | |
Construct a writable view into the source data. More... | |
VectorBase (const MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::ShallowCopy &s) | |
Construct a read-only view of the source data. More... | |
VectorBase (const MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::DeepCopy &d) | |
Construct a new owner vector initialized with the data from the source. More... | |
Public Member Functions inherited from SimTK::MatrixBase< ELT > | |
const MatrixCommitment & | getCharacterCommitment () const |
const MatrixCharacter & | getMatrixCharacter () const |
void | commitTo (const MatrixCommitment &mc) |
Change the handle commitment for this matrix handle; only allowed if the handle is currently clear. More... | |
int | nrow () const |
Return the number of rows m in the logical shape of this matrix. More... | |
int | ncol () const |
Return the number of columns n in the logical shape of this matrix. More... | |
ptrdiff_t | nelt () const |
Return the number of elements in the logical shape of this matrix. More... | |
bool | isResizeable () const |
Return true if either dimension of this Matrix is resizable. More... | |
MatrixBase () | |
The default constructor builds a 0x0 matrix managed by a helper that understands how many scalars there are in one of our elements but is otherwise uncommitted. More... | |
MatrixBase (int m, int n) | |
This constructor allocates the default matrix a completely uncommitted matrix commitment, given particular initial dimensions. More... | |
MatrixBase (const MatrixCommitment &commitment) | |
This constructor takes a handle commitment and allocates the default matrix for that kind of commitment. More... | |
MatrixBase (const MatrixCommitment &commitment, int m, int n) | |
This constructor takes a handle commitment and allocates the default matrix for that kind of commitment given particular initial minimum dimensions, which cannot be larger than those permitted by the commitment. More... | |
MatrixBase (const MatrixBase &b) | |
Copy constructor is a deep copy (not appropriate for views!). More... | |
MatrixBase (const TNeg &b) | |
Implicit conversion from matrix with negated elements (otherwise this is just like the copy constructor. More... | |
MatrixBase & | copyAssign (const MatrixBase &b) |
Copy assignment is a deep copy but behavior depends on type of lhs: if view, rhs must match. More... | |
MatrixBase & | operator= (const MatrixBase &b) |
MatrixBase & | viewAssign (const MatrixBase &src) |
View assignment is a shallow copy, meaning that we disconnect the MatrixBase from whatever it used to refer to (destructing as necessary), then make it a new view for the data descriptor referenced by the source. More... | |
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. More... | |
MatrixBase (const MatrixCommitment &commitment, int m, int n, const ELT *cppInitialValuesByRow) | |
Initializing constructor with the initially-allocated elements initialized from a C++ array of elements, which is provided in row major order. More... | |
MatrixBase (const MatrixCommitment &commitment, MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::ShallowCopy &shallow) | |
MatrixBase (const MatrixCommitment &commitment, const MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::ShallowCopy &shallow) | |
MatrixBase (const MatrixCommitment &commitment, const MatrixHelper< Scalar > &source, const typename MatrixHelper< Scalar >::DeepCopy &deep) | |
void | clear () |
This restores the MatrixBase to the state it would be in had it been constructed specifying only its handle commitment. More... | |
MatrixBase & | operator*= (const StdNumber &t) |
MatrixBase & | operator/= (const StdNumber &t) |
MatrixBase & | operator+= (const MatrixBase &r) |
MatrixBase & | operator-= (const MatrixBase &r) |
template<class EE > | |
MatrixBase (const MatrixBase< EE > &b) | |
template<class EE > | |
MatrixBase & | operator= (const MatrixBase< EE > &b) |
template<class EE > | |
MatrixBase & | operator+= (const MatrixBase< EE > &b) |
template<class EE > | |
MatrixBase & | operator-= (const MatrixBase< EE > &b) |
MatrixBase & | operator= (const ELT &t) |
Matrix assignment to an element sets only the *diagonal* elements to the indicated value; everything else is set to zero. More... | |
template<class S > | |
MatrixBase & | scalarAssign (const S &s) |
Set M's diagonal elements to a "scalar" value S, and all off-diagonal elements to zero. More... | |
template<class S > | |
MatrixBase & | scalarAddInPlace (const S &s) |
Add a scalar to M's diagonal. More... | |
template<class S > | |
MatrixBase & | scalarSubtractInPlace (const S &s) |
Subtract a scalar from M's diagonal. More... | |
template<class S > | |
MatrixBase & | scalarSubtractFromLeftInPlace (const S &s) |
Set M(i,i) = S - M(i,i), M(i,j) = -M(i,j) for i!=j. More... | |
template<class S > | |
MatrixBase & | scalarMultiplyInPlace (const S &) |
Set M(i,j) = M(i,j)*S for some "scalar" S. More... | |
template<class S > | |
MatrixBase & | scalarMultiplyFromLeftInPlace (const S &) |
Set M(i,j) = S * M(i,j) for some "scalar" S. More... | |
template<class S > | |
MatrixBase & | scalarDivideInPlace (const S &) |
Set M(i,j) = M(i,j)/S for some "scalar" S. More... | |
template<class S > | |
MatrixBase & | scalarDivideFromLeftInPlace (const S &) |
Set M(i,j) = S/M(i,j) for some "scalar" S. More... | |
template<class EE > | |
MatrixBase & | rowScaleInPlace (const VectorBase< EE > &) |
M = diag(r) * M; r must have nrow() elements. More... | |
template<class EE > | |
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 appropriate for the elementwise multiply being performed. More... | |
template<class EE > | |
EltResult< EE >::Mul | rowScale (const VectorBase< EE > &r) const |
template<class EE > | |
MatrixBase & | colScaleInPlace (const VectorBase< EE > &) |
M = M * diag(c); c must have ncol() elements. More... | |
template<class EE > | |
void | colScale (const VectorBase< EE > &c, typename EltResult< EE >::Mul &out) const |
template<class EE > | |
EltResult< EE >::Mul | colScale (const VectorBase< EE > &c) const |
template<class ER , class EC > | |
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. More... | |
template<class ER , class EC > | |
void | rowAndColScale (const VectorBase< ER > &r, const VectorBase< EC > &c, typename EltResult< typename VectorBase< ER >::template EltResult< EC >::Mul >::Mul &out) const |
template<class ER , class EC > | |
EltResult< typename VectorBase < ER >::template EltResult< EC > ::Mul >::Mul | rowAndColScale (const VectorBase< ER > &r, const VectorBase< EC > &c) const |
template<class S > | |
MatrixBase & | elementwiseAssign (const S &s) |
Set M(i,j)=s for every element of M and some value s. More... | |
MatrixBase & | elementwiseAssign (int s) |
Overloaded to allow an integer argument, which is converted to Real. More... | |
MatrixBase & | elementwiseInvertInPlace () |
Set M(i,j) = M(i,j)^-1. More... | |
void | elementwiseInvert (MatrixBase< typename CNT< E >::TInvert > &out) const |
MatrixBase< typename CNT< E > ::TInvert > | elementwiseInvert () const |
template<class S > | |
MatrixBase & | elementwiseAddScalarInPlace (const S &s) |
Set M(i,j)+=s for every element of M and some value s. More... | |
template<class S > | |
void | elementwiseAddScalar (const S &s, typename EltResult< S >::Add &) const |
template<class S > | |
EltResult< S >::Add | elementwiseAddScalar (const S &s) const |
template<class S > | |
MatrixBase & | elementwiseSubtractScalarInPlace (const S &s) |
Set M(i,j)-=s for every element of M and some value s. More... | |
template<class S > | |
void | elementwiseSubtractScalar (const S &s, typename EltResult< S >::Sub &) const |
template<class S > | |
EltResult< S >::Sub | elementwiseSubtractScalar (const S &s) const |
template<class S > | |
MatrixBase & | elementwiseSubtractFromScalarInPlace (const S &s) |
Set M(i,j) = s - M(i,j) for every element of M and some value s. More... | |
template<class S > | |
void | elementwiseSubtractFromScalar (const S &, typename MatrixBase< S >::template EltResult< E >::Sub &) const |
template<class S > | |
MatrixBase< S >::template EltResult< E >::Sub | elementwiseSubtractFromScalar (const S &s) const |
template<class EE > | |
MatrixBase & | elementwiseMultiplyInPlace (const MatrixBase< EE > &) |
M(i,j) *= R(i,j); R must have same dimensions as this. More... | |
template<class EE > | |
void | elementwiseMultiply (const MatrixBase< EE > &, typename EltResult< EE >::Mul &) const |
template<class EE > | |
EltResult< EE >::Mul | elementwiseMultiply (const MatrixBase< EE > &m) const |
template<class EE > | |
MatrixBase & | elementwiseMultiplyFromLeftInPlace (const MatrixBase< EE > &) |
M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this. More... | |
template<class EE > | |
void | elementwiseMultiplyFromLeft (const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Mul &) const |
template<class EE > | |
MatrixBase< EE >::template EltResult< E >::Mul | elementwiseMultiplyFromLeft (const MatrixBase< EE > &m) const |
template<class EE > | |
MatrixBase & | elementwiseDivideInPlace (const MatrixBase< EE > &) |
M(i,j) /= R(i,j); R must have same dimensions as this. More... | |
template<class EE > | |
void | elementwiseDivide (const MatrixBase< EE > &, typename EltResult< EE >::Dvd &) const |
template<class EE > | |
EltResult< EE >::Dvd | elementwiseDivide (const MatrixBase< EE > &m) const |
template<class EE > | |
MatrixBase & | elementwiseDivideFromLeftInPlace (const MatrixBase< EE > &) |
M(i,j) = R(i,j) / M(i,j); R must have same dimensions as this. More... | |
template<class EE > | |
void | elementwiseDivideFromLeft (const MatrixBase< EE > &, typename MatrixBase< EE >::template EltResult< E >::Dvd &) const |
template<class EE > | |
MatrixBase< EE >::template EltResult< EE >::Dvd | elementwiseDivideFromLeft (const MatrixBase< EE > &m) const |
MatrixBase & | setTo (const ELT &t) |
Fill every element in current allocation with given element (or NaN or 0). More... | |
MatrixBase & | setToNaN () |
MatrixBase & | setToZero () |
RowVectorView_< ELT > | row (int i) const |
RowVectorView_< ELT > | updRow (int i) |
VectorView_< ELT > | col (int j) const |
VectorView_< ELT > | updCol (int j) |
RowVectorView_< ELT > | operator[] (int i) const |
RowVectorView_< ELT > | operator[] (int i) |
VectorView_< ELT > | operator() (int j) const |
VectorView_< ELT > | operator() (int j) |
MatrixView_< ELT > | block (int i, int j, int m, int n) const |
MatrixView_< ELT > | updBlock (int i, int j, int m, int n) |
MatrixView_< ELT > | operator() (int i, int j, int m, int n) const |
MatrixView_< ELT > | operator() (int i, int j, int m, int n) |
MatrixView_< EHerm > | transpose () const |
MatrixView_< EHerm > | updTranspose () |
MatrixView_< EHerm > | operator~ () const |
MatrixView_< EHerm > | operator~ () |
VectorView_< ELT > | diag () const |
Select main diagonal (of largest leading square if rectangular) and return it as a read-only view of the diagonal elements of this Matrix. More... | |
VectorView_< ELT > | updDiag () |
Select main diagonal (of largest leading square if rectangular) and return it as a writable view of the diagonal elements of this Matrix. More... | |
VectorView_< ELT > | diag () |
This non-const version of diag() is an alternate name for updDiag() available for historical reasons. More... | |
TInvert | invert () const |
void | invertInPlace () |
void | dump (const char *msg=0) const |
Matlab-compatible debug output. More... | |
const ELT & | getElt (int i, int j) const |
Element selection for stored elements. More... | |
ELT & | updElt (int i, int j) |
const ELT & | operator() (int i, int j) const |
ELT & | operator() (int i, int j) |
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 whether it is stored in memory. More... | |
ELT | getAnyElt (int i, int j) const |
ScalarNormSq | scalarNormSqr () const |
Scalar norm square is sum( squares of all scalars ). More... | |
void | abs (TAbs &mabs) const |
abs() is elementwise absolute value; that is, the return value has the same dimension as this Matrix but with each element replaced by whatever it thinks its absolute value is. More... | |
TAbs | abs () const |
abs() with the result as a function return. More... | |
TStandard | standardize () const |
Return a Matrix of the same shape and contents as this one but with the element type converted to one based on the standard C++ scalar types: float, double, complex<float>, complex<double>. More... | |
ScalarNormSq | normSqr () const |
This is the scalar Frobenius norm, and its square. More... | |
CNT< ScalarNormSq >::TSqrt | norm () const |
CNT< ScalarNormSq >::TSqrt | normRMS () const |
We only allow RMS norm if the elements are scalars. More... | |
RowVector_< ELT > | colSum () const |
Form the column sums of this matrix, returned as a RowVector. More... | |
RowVector_< ELT > | sum () const |
Alternate name for colSum(); behaves like the Matlab function sum(). More... | |
Vector_< ELT > | rowSum () const |
Form the row sums of this matrix, returned as a Vector. More... | |
const MatrixBase & | operator+ () const |
const TNeg & | negate () const |
TNeg & | updNegate () |
const TNeg & | operator- () const |
TNeg & | operator- () |
MatrixBase & | negateInPlace () |
MatrixBase & | resize (int m, int n) |
Change the size of this matrix. More... | |
MatrixBase & | resizeKeep (int m, int n) |
Change the size of this matrix, retaining as much of the old data as will fit. More... | |
void | lockShape () |
void | unlockShape () |
const MatrixView_< ELT > & | getAsMatrixView () const |
MatrixView_< ELT > & | updAsMatrixView () |
const Matrix_< ELT > & | getAsMatrix () const |
Matrix_< ELT > & | updAsMatrix () |
const VectorView_< ELT > & | getAsVectorView () const |
VectorView_< ELT > & | updAsVectorView () |
const Vector_< ELT > & | getAsVector () const |
Vector_< ELT > & | updAsVector () |
const VectorBase< ELT > & | getAsVectorBase () const |
VectorBase< ELT > & | updAsVectorBase () |
const RowVectorView_< ELT > & | getAsRowVectorView () const |
RowVectorView_< ELT > & | updAsRowVectorView () |
const RowVector_< ELT > & | getAsRowVector () const |
RowVector_< ELT > & | updAsRowVector () |
const RowVectorBase< ELT > & | getAsRowVectorBase () const |
RowVectorBase< ELT > & | updAsRowVectorBase () |
int | getNScalarsPerElement () const |
This is the number of consecutive scalars used to represent one element of type ELT. More... | |
int | getPackedSizeofElement () const |
This is like sizeof(ELT), but returning the number of bytes we use to store the element which may be fewer than what C++ would use. More... | |
bool | hasContiguousData () const |
ptrdiff_t | getContiguousScalarDataLength () const |
const Scalar * | getContiguousScalarData () const |
Scalar * | updContiguousScalarData () |
void | replaceContiguousScalarData (Scalar *newData, ptrdiff_t length, bool takeOwnership) |
void | replaceContiguousScalarData (const Scalar *newData, ptrdiff_t length) |
void | swapOwnedContiguousScalarData (Scalar *newData, ptrdiff_t length, Scalar *&oldData) |
MatrixBase (MatrixHelperRep< Scalar > *hrep) | |
Helper rep-stealing constructor. More... | |
template<class EE > | |
MatrixBase< ELT > & | rowScaleInPlace (const VectorBase< EE > &v) |
template<class EE > | |
void | rowScale (const VectorBase< EE > &v, typename MatrixBase< ELT >::template EltResult< EE >::Mul &out) const |
template<class EE > | |
MatrixBase< ELT > & | colScaleInPlace (const VectorBase< EE > &v) |
template<class EE > | |
void | colScale (const VectorBase< EE > &v, typename MatrixBase< ELT >::template EltResult< EE >::Mul &out) const |
template<class ER , class EC > | |
MatrixBase< ELT > & | rowAndColScaleInPlace (const VectorBase< ER > &r, const VectorBase< EC > &c) |
template<class S > | |
MatrixBase< ELT > & | elementwiseAssign (const S &s) |
template<class S > | |
MatrixBase< ELT > & | elementwiseAddScalarInPlace (const S &s) |
template<class S > | |
void | elementwiseAddScalar (const S &s, typename MatrixBase< ELT >::template EltResult< S >::Add &out) const |
template<class S > | |
MatrixBase< ELT > & | elementwiseSubtractScalarInPlace (const S &s) |
template<class S > | |
void | elementwiseSubtractScalar (const S &s, typename MatrixBase< ELT >::template EltResult< S >::Sub &out) const |
template<class S > | |
MatrixBase< ELT > & | elementwiseSubtractFromScalarInPlace (const S &s) |
template<class EE > | |
MatrixBase< ELT > & | elementwiseMultiplyInPlace (const MatrixBase< EE > &r) |
template<class EE > | |
void | elementwiseMultiply (const MatrixBase< EE > &r, typename MatrixBase< ELT >::template EltResult< EE >::Mul &out) const |
template<class EE > | |
MatrixBase< ELT > & | elementwiseMultiplyFromLeftInPlace (const MatrixBase< EE > &r) |
template<class EE > | |
MatrixBase< ELT > & | elementwiseDivideInPlace (const MatrixBase< EE > &r) |
template<class EE > | |
void | elementwiseDivide (const MatrixBase< EE > &r, typename MatrixBase< ELT >::template EltResult< EE >::Dvd &out) const |
template<class EE > | |
MatrixBase< ELT > & | elementwiseDivideFromLeftInPlace (const MatrixBase< EE > &r) |
MatrixBase (const MatrixCommitment &commitment, const MatrixCharacter &character, int spacing, const Scalar *data) | |
Construct a read-only view of pre-existing data. More... | |
MatrixBase (const MatrixCommitment &commitment, const MatrixCharacter &character, int spacing, Scalar *data) | |
Construct a writable view of pre-existing data. More... | |
Related Functions | |
(Note that these are not member functions.) | |
Matrix_<T> serialization and I/O | |
These methods are at namespace scope but are logically part of the Vector classes. These deal with reading and writing Vectors from and to streams, which places an additional requirement on the element type T: the element must support the same operation you are trying to do on the Vector as a whole. | |
template<class E > | |
void | writeUnformatted (std::ostream &o, const Vector_< E > &v) |
Raw serialization of Vector_<E>; same as VectorBase<E>. More... | |
template<class E > | |
bool | readUnformatted (std::istream &in, Vector_< E > &v) |
Read variable-size Vector from input stream. More... | |
template<class T > | |
std::ostream & | operator<< (std::ostream &o, const VectorBase< T > &v) |
Output a human readable representation of a Vector to an std::ostream (like std::cout). More... | |
template<class T > | |
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 optionally surrounded by parentheses (), or square brackets [], or the "transposed" ~() or ~[]. More... | |
template<class T > | |
static std::istream & | fillVectorFromStream (std::istream &in, Vector_< T > &out) |
Read in a fixed number of elements from a stream into a Vector. More... | |
template<class T > | |
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, optionally delimited by parentheses, or brackets, and preceded by "~". More... | |
Related Functions inherited from SimTK::VectorBase< ELT > | |
template<class E > | |
void | writeUnformatted (std::ostream &o, const VectorBase< E > &v) |
Specialize for VectorBase<E> to delegate to element type E, with spaces separating the elements. More... | |
Related Functions inherited from SimTK::MatrixBase< ELT > | |
template<class E > | |
void | writeUnformatted (std::ostream &o, const MatrixBase< E > &v) |
Specialize for MatrixBase<E> delegating to RowVectorBase<E> with newlines separating the rows, but no final newline. More... | |
This is the vector class intended to appear in user code for large, variable size column vectors.
More commonly, the typedef Vector is used instead; that is just an abbreviation for Vector_<Real>
.
A Vector_ can be a fixed-size view of someone else's data, or can be a resizable data owner itself, although of course it will always have just one column.
|
inline |
Default constructor creates a 0x1, reallocatable vector.
|
inline |
Copy constructor is deep, that is the source Vector_ is copied, not referenced.
|
inline |
This copy constructor serves as an implicit conversion from objects of the base class type (for example, a VectorView_<ELT>), to objects of this Vector_<ELT> type.
Note that the source object is copied, not referenced.
|
inline |
This copy constructor serves as an implicit conversion from objects of the base class but with negated elements, to objects of this Vector_<ELT> type.
Note that the source object is copied, not referenced.
|
inlineexplicit |
Construct a Vector_ with a given preallocated size, but with uninitialized values.
In Debug builds the elements will be initialized to NaN as a debugging aid, but in Release (optimized) builds they will be uninitialized garbage so that we don't waste time setting them.
|
inline |
Construct an owner Vector_ of a given size m and initialize it from a C++ array of m ELT values pointed to by cppInitialValues.
Note that there is no way to check that the correct number of elements has been provided; make sure you have supplied enough of them.
|
inline |
Construct an owner Vector_ of a given size m and initialize all the elements to the given ELT value initialValue.
|
inlineexplicit |
This constructor creates a new owner Vector_ that is the same length and has a copy of the contents of a given fixed-size Vec.
|
inline |
Construct a Vector_ which shares read-only, borrowed space with assumed element-to-element stride equal to the C++ element spacing.
Last parameter is a required dummy to avoid overload conflicts when ELT=S; pass it as "true".
|
inline |
Construct a Vector_ which shares writable, borrowed space with assumed element-to-element stride equal to the C++ element spacing.
Last parameter is a required dummy to avoid overload conflicts when ELT=S; pass it as "true".
|
inline |
Borrowed-space read-only construction with explicit stride supplied as "number of scalars between elements".
Last parameter is a dummy to avoid overload conflicts; pass it as "true".
|
inline |
Borrowed-space writable construction with explicit stride supplied as "number of scalars between elements".
Last parameter is a dummy to avoid overload conflicts; pass it as "true".
|
inline |
Copy assignment is deep and can be reallocating if this Vector_ is an owner.
Otherwise the source is copied into the destination view.
|
inline |
Like copy assignment but the source can be any object of the base type, even with a different element type EE as long as that element type is assignment-compatible to an element of our type ELT.
|
inline |
Set all elements of this Vector_ to the same value v.
|
inline |
Add in a conforming vector of the base type even if it has a different element type EE, provided that element type is add-compatible with our element type ELT, meaning that ELT+=EE is allowed.
|
inline |
In-place subtract of a conforming vector of the base type even if it has a different element type EE, provided that element type is subtract-compatible with our element type ELT, meaning that ELT-=EE is allowed.
|
inline |
In-place multiply of each element of this Vector_ by a scalar t.
Returns a reference to the now-modified Vector_.
|
inline |
In-place divide of each element of this Vector_ by a scalar t.
Returns a reference to the now-modified Vector_.
|
inline |
In-place add to each element of this Vector_ the same given value b.
Returns a reference to the now-modified Vector_. This is the same operation as elementwiseAddScalarInPlace().
|
inline |
In-place subtract from each element of this Vector_ the same given value b.
Returns a reference to the now-modified Vector_. This is the same operation as elementwiseSubtractScalarInPlace().
|
inline |
toString() returns a string representation of the Vector_.
Please refer to operator<< for details.
|
inline |
Variant of operator[] that's scripting friendly to get ith element.
|
inline |
Variant of operator[] that's scripting friendly to set ith element.
Raw serialization of Vector_<E>; same as VectorBase<E>.
Read variable-size Vector from input stream.
Reads until error or eof.
|
related |
Output a human readable representation of a Vector to an std::ostream (like std::cout).
The format is ~[ elements ] where elements is a space-separated list of the Vector's contents output by invoking the "<<" operator on the elements. This function will not compile if the element type does not support the "<<" operator. No newline is issued before or after the output.
|
related |
Read in a Vector_<T> from a stream, as a sequence of space-separated or comma-separated values optionally surrounded by parentheses (), or square brackets [], or the "transposed" ~() or ~[].
In the case that the transpose operator is present, the parentheses or brackets are required, otherwise they are optional. We will continue to read elements of type T from the stream until we find a reason to stop, using type T's stream extraction operator>>() to read in each element and resizing the Vector as necessary. If the data is bracketed, we'll read until we hit the closing bracket. If it is not bracketed, we'll read until we hit eof() or get an error such as the element extractor setting the stream's fail bit due to bad formatting. On successful return, the stream will be positioned right after the final read-in element or terminating bracket, and the stream's status will be good() or eof(). We will not consume trailing whitespace after bracketed elements; that means the stream might actually be empty even if we don't return eof(). If you want to know whether there is anything else in the stream, follow this call with the STL whitespace skipper std::ws() like this:
A compilation error will occur if you try to use this method on an Vector_<T> for a type T for which there is no stream extraction operator>>().
|
related |
Read in a fixed number of elements from a stream into a Vector.
We expect to read in exactly size() elements of type T, using type T's stream extraction operator>>(). This will stop reading when we've read size() elements, or set the fail bit in the stream if we run out of elements or if any element's extract operator sets the fail bit. On successful return, all size() elements will have been set, the stream will be positioned right after the final read-in element or terminating bracket, and the stream's status will be good() or eof(). We will not consume trailing whitespace after reading all the elements; that means the stream might actually be empty even if we don't return eof(). If you want to know whether there is anything else in the stream, follow this call with std::ws() like this:
A compilation error will occur if you try to use this method on a Vector_<T> for a type T for which there is no stream extraction operator>>().
Read Vector_<T> from a stream as a sequence of space- or comma-separated values of type T, optionally delimited by parentheses, or brackets, and preceded by "~".
The Vector_<T> may be an owner (variable size) or a view (fixed size n). In the case of an owner, we'll read all the elements in brackets or until eof if there are no brackets. In the case of a view, there must be exactly n elements in brackets, or if there are no brackets we'll consume exactly n elements and then stop. Each element is read in with its own operator ">>" so this won't work if no such operator is defined for type T.