1 #ifndef SimTK_SIMMATRIX_ROWVECTORBASE_H_ 2 #define SimTK_SIMMATRIX_ROWVECTORBASE_H_ 42 template <
class ELT>
class RowVectorBase :
public MatrixBase<ELT> {
43 typedef MatrixBase<ELT> Base;
47 typedef RowVectorBase<ELT> T;
48 typedef RowVectorBase<typename CNT<ELT>::TAbs> TAbs;
49 typedef RowVectorBase<typename CNT<ELT>::TNeg> TNeg;
50 typedef VectorView_<typename CNT<ELT>::THerm> THerm;
166 { Base::template colScaleInPlace<EE>(v);
return *
this; }
168 {
return Base::template colScale<EE>(v,out); }
175 { Base::template elementwiseMultiplyInPlace<EE>(r);
return *
this; }
177 { Base::template elementwiseMultiply<EE>(v,out); }
183 { Base::template elementwiseMultiplyFromLeftInPlace<EE>(r);
return *
this; }
184 template <
class EE>
inline void 189 Base::template elementwiseMultiplyFromLeft<EE>(v,out);
191 template <
class EE>
inline 195 Base::template elementwiseMultiplyFromLeft<EE>(v,out);
201 { Base::template elementwiseDivideInPlace<EE>(r);
return *
this; }
203 { Base::template elementwiseDivide<EE>(v,out); }
209 { Base::template elementwiseDivideFromLeftInPlace<EE>(r);
return *
this; }
210 template <
class EE>
inline void 214 Base::template elementwiseDivideFromLeft<EE>(v,out);
216 template <
class EE>
inline 220 Base::template elementwiseDivideFromLeft<EE>(v,out);
248 TAbs result;
Base::abs(result);
return result;
285 const TNeg&
negate()
const {
return *
reinterpret_cast<const TNeg*
>(
this); }
286 TNeg&
updNegate() {
return *
reinterpret_cast<TNeg*
>(
this); }
315 #endif // SimTK_SIMMATRIX_ROWVECTORBASE_H_
VectorView_< ELT > operator()(int j) const
Definition: MatrixBase.h:595
RowVectorBase(int n=0)
Default constructor makes a 1x0 matrix locked at 1 row; you can provide an initial allocation if you ...
Definition: RowVectorBase.h:65
RowVectorBase & operator+=(const RowVectorBase< EE > &b)
Definition: RowVectorBase.h:149
EltResult< EE >::Dvd elementwiseDivide(const RowVectorBase< EE > &v) const
Definition: RowVectorBase.h:204
RowVectorBase & elementwiseMultiplyFromLeftInPlace(const RowVectorBase< EE > &r)
Definition: RowVectorBase.h:182
void elementwiseDivide(const RowVectorBase< EE > &v, typename EltResult< EE >::Dvd &out) const
Definition: RowVectorBase.h:202
void clear()
Definition: RowVectorBase.h:295
RowVectorBase(const MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::ShallowCopy &s)
Construct a read-only view of the source data.
Definition: RowVectorBase.h:118
RowVectorView_< ELT > operator()(int j, int n) const
Definition: RowVectorBase.h:258
RowVectorBase(const TNeg &source)
Implicit conversion from compatible row vector with negated elements.
Definition: RowVectorBase.h:73
This is a dataless rehash of the MatrixBase class to specialize it for RowVectors.
Definition: BigMatrix.h:165
const MatrixCommitment & getCharacterCommitment() const
Definition: MatrixBase.h:119
RowVectorView_< ELT > operator()(int j, int n)
Definition: RowVectorBase.h:259
RowVectorBase< EE >::template EltResult< ELT >::Dvd elementwiseDivideFromLeft(const RowVectorBase< EE > &v) const
Definition: RowVectorBase.h:218
RowVectorBase< EE >::template EltResult< ELT >::Mul elementwiseMultiplyFromLeft(const RowVectorBase< EE > &v) const
Definition: RowVectorBase.h:193
void elementwiseMultiplyFromLeft(const RowVectorBase< EE > &v, typename RowVectorBase< EE >::template EltResult< ELT >::Mul &out) const
Definition: RowVectorBase.h:185
RowVectorBase & operator=(const ELT &t)
Fill current allocation with copies of element.
Definition: RowVectorBase.h:159
THerm operator~() const
Definition: RowVectorBase.h:278
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
MatrixHelper< Scalar > & updHelper()
Definition: MatrixBase.h:866
THerm operator~()
Definition: RowVectorBase.h:279
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
A MatrixCharacter is a set containing a value for each of the matrix characteristics except element t...
Definition: MatrixCharacteristics.h:597
void colScale(const VectorBase< EE > &v, typename EltResult< EE >::Mul &out) const
Definition: RowVectorBase.h:167
MatrixBase & operator/=(const StdNumber &t)
Definition: MatrixBase.h:291
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
RowVectorBase(MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::ShallowCopy &s)
Construct a writable view into the source data.
Definition: RowVectorBase.h:115
EltResult< EE >::Mul elementwiseMultiply(const RowVectorBase< EE > &v) const
Definition: RowVectorBase.h:178
RowVectorBase & operator-=(const RowVectorBase &r)
Definition: RowVectorBase.h:145
THerm transpose() const
Definition: RowVectorBase.h:275
MatrixBase & operator-=(const MatrixBase &r)
Definition: MatrixBase.h:293
MatrixBase & operator*=(const StdNumber &t)
Definition: MatrixBase.h:290
RowVectorBase & operator+=(const RowVectorBase &r)
Definition: RowVectorBase.h:144
ELT & operator()(int j)
Definition: RowVectorBase.h:255
Definition: RowVectorBase.h:127
RowVectorBase & operator=(const RowVectorBase< EE > &b)
Definition: RowVectorBase.h:147
(Advanced) This class is identical to RowVector_ except that it has shallow (reference) copy and assi...
Definition: BigMatrix.h:173
RowVectorBase(const RowVectorBase &source)
Copy constructor is a deep copy (not appropriate for views!).
Definition: RowVectorBase.h:70
const TNeg & operator-() const
Definition: RowVectorBase.h:288
RowVectorBase(int n, const ELT &initialValue)
Construct an owner row vector of length n, with each element initialized to the given value...
Definition: RowVectorBase.h:77
MatrixView_< EHerm > transpose() const
Definition: BigMatrix.h:222
This is an iterator for iterating over the elements of a Vector_ or Vec object.
Definition: BigMatrix.h:176
int nrow() const
Return the number of rows m in the logical shape of this matrix.
Definition: MatrixBase.h:137
RowVectorBase(MatrixHelperRep< Scalar > *hrep)
Definition: RowVectorBase.h:307
RowVectorBase & elementwiseMultiplyInPlace(const RowVectorBase< EE > &r)
Definition: RowVectorBase.h:174
(Advanced) This class is identical to Matrix_ except that it has shallow (reference) copy and assignm...
Definition: BigMatrix.h:167
RowVectorBase< typename CNT< ELT >::template Result< P >::Sub > Sub
Definition: RowVectorBase.h:131
RowVectorBase< typename CNT< ELT >::template Result< P >::Mul > Mul
Definition: RowVectorBase.h:128
const ELT & operator[](int j) const
Definition: RowVectorBase.h:252
MatrixView_< EHerm > updTranspose()
Definition: BigMatrix.h:230
RowVectorView_< ELT > updIndex(const Array_< int > &indices)
Definition: RowVectorBase.h:266
EltResult< EE >::Mul colScale(const VectorBase< EE > &v) const
Definition: RowVectorBase.h:169
TNeg & operator-()
Definition: RowVectorBase.h:289
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
RowVectorBase< typename CNT< ELT >::template Result< P >::Dvd > Dvd
Definition: RowVectorBase.h:129
RowVectorBase & colScaleInPlace(const VectorBase< EE > &v)
There's only one row here so it's a bit wierd to use colScale rather than elementwiseMultiply, but there's nothing really wrong with it.
Definition: RowVectorBase.h:165
RowVectorBase & operator-=(const RowVectorBase< EE > &b)
Definition: RowVectorBase.h:151
RowVectorBase & resize(int n)
Definition: RowVectorBase.h:291
VectorIterator< ELT, RowVectorBase< ELT > > begin()
Definition: RowVectorBase.h:298
VectorIterator< ELT, RowVectorBase< ELT > > end()
Definition: RowVectorBase.h:301
RowVectorBase & elementwiseDivideInPlace(const RowVectorBase< EE > &r)
Definition: RowVectorBase.h:200
int nrow() const
Definition: RowVectorBase.h:242
const RowVectorBase & operator+() const
Definition: RowVectorBase.h:281
RowVectorBase & elementwiseDivideFromLeftInPlace(const RowVectorBase< EE > &r)
Definition: RowVectorBase.h:208
RowVectorBase & operator/=(const StdNumber &t)
Definition: RowVectorBase.h:143
int size() const
Definition: RowVectorBase.h:237
This is the matrix class intended to appear in user code for large, variable size matrices...
Definition: BigMatrix.h:168
RowVectorBase & operator=(const RowVectorBase &b)
Copy assignment is deep copy but behavior depends on type of lhs: if view, rhs must match...
Definition: RowVectorBase.h:136
RowVectorView_< ELT > index(const Array_< int > &indices) const
Definition: RowVectorBase.h:262
MatrixBase & operator+=(const MatrixBase &r)
Definition: MatrixBase.h:292
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
const S * getElt(int i, int j) const
THerm updTranspose()
Definition: RowVectorBase.h:276
RowVectorBase(int n, int stride, Scalar *s)
Construct a writable view into existing data.
Definition: RowVectorBase.h:102
MatrixBase & operator=(const MatrixBase &b)
Definition: MatrixBase.h:201
const MatrixHelper< Scalar > & getHelper() const
Definition: MatrixBase.h:865
ELT & operator[](int j)
Definition: RowVectorBase.h:253
This is a dataless rehash of the MatrixBase class to specialize it for Vectors.
Definition: BigMatrix.h:164
void elementwiseMultiply(const RowVectorBase< EE > &v, typename EltResult< EE >::Mul &out) const
Definition: RowVectorBase.h:176
RowVectorBase(int n, int stride, const Scalar *s)
Construct a read-only view of existing data.
Definition: RowVectorBase.h:99
Represents a variable size row vector; much less common than the column vector type Vector_...
Definition: BigMatrix.h:174
A MatrixCommitment provides a set of acceptable matrix characteristics.
Definition: MatrixCharacteristics.h:832
RowVectorBase(const MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::DeepCopy &d)
Construct a new owner vector initialized with the data from the source.
Definition: RowVectorBase.h:121
ELT sum() const
Definition: RowVectorBase.h:297
const ELT & operator()(int j) const
Definition: RowVectorBase.h:254
void elementwiseDivideFromLeft(const RowVectorBase< EE > &v, typename RowVectorBase< EE >::template EltResult< ELT >::Dvd &out) const
Definition: RowVectorBase.h:212
RowVectorView_< ELT > operator()(const Array_< int > &indices) const
Definition: RowVectorBase.h:271
ptrdiff_t nelt() const
Return the number of elements in the logical shape of this matrix.
Definition: MatrixBase.h:148
TAbs abs() const
abs() with the result as a function return.
Definition: MatrixBase.h:699
K::Number Number
Definition: CompositeNumericalTypes.h:162
int ncol() const
Definition: RowVectorBase.h:243
ptrdiff_t nelt() const
Definition: RowVectorBase.h:244
void clear()
This restores the MatrixBase to the state it would be in had it been constructed specifying only its ...
Definition: MatrixBase.h:288
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
RowVectorBase & operator*=(const StdNumber &t)
Definition: RowVectorBase.h:142
RowVectorBase & resizeKeep(int n)
Definition: RowVectorBase.h:292
MatrixBase & resize(int m, int n)
Change the size of this matrix.
Definition: MatrixBase.h:774
RowVectorBase(int n, const ELT *cppInitialValues)
Construct an owner vector of length n, with the elements initialized sequentially from a C++ array of...
Definition: RowVectorBase.h:84
const TNeg & negate() const
Definition: RowVectorBase.h:285
RowVectorView_< ELT > operator()(const Array_< int > &indices)
Definition: RowVectorBase.h:272
RowVectorBase< typename CNT< ELT >::template Result< P >::Add > Add
Definition: RowVectorBase.h:130
TNeg & updNegate()
Definition: RowVectorBase.h:286
TAbs abs() const
Definition: RowVectorBase.h:247