RowVectorBase< ELT > Class Template Reference

This is a dataless rehash of the MatrixBase class to specialize it for RowVectors. More...

#include <BigMatrix.h>

Inheritance diagram for RowVectorBase< ELT >:
MatrixBase< ELT > RowVector_< ELT > RowVectorView_< ELT >

List of all members.

Classes

struct  EltResult

Public Member Functions

RowVectorBaseoperator= (const RowVectorBase &b)
 Copy assignment is deep copy but behavior depends on type of lhs: if view, rhs must match.
RowVectorBaseoperator*= (const StdNumber &t)
RowVectorBaseoperator/= (const StdNumber &t)
RowVectorBaseoperator+= (const RowVectorBase &r)
RowVectorBaseoperator-= (const RowVectorBase &r)
template<class EE >
RowVectorBaseoperator= (const RowVectorBase< EE > &b)
template<class EE >
RowVectorBaseoperator+= (const RowVectorBase< EE > &b)
template<class EE >
RowVectorBaseoperator-= (const RowVectorBase< EE > &b)
RowVectorBaseoperator= (const ELT &t)
 Fill current allocation with copies of element.
template<class EE >
RowVectorBasecolScaleInPlace (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.
template<class EE >
void colScale (const VectorBase< EE > &v, typename EltResult< EE >::Mul &out) const
template<class EE >
EltResult< EE >::Mul colScale (const VectorBase< EE > &v) const
template<class EE >
RowVectorBaseelementwiseMultiplyInPlace (const RowVectorBase< EE > &r)
 M(i,j) *= R(i,j); R must have same dimensions as this.
template<class EE >
void elementwiseMultiply (const RowVectorBase< EE > &v, typename EltResult< EE >::Mul &out) const
template<class EE >
EltResult< EE >::Mul elementwiseMultiply (const RowVectorBase< EE > &v) const
template<class EE >
RowVectorBaseelementwiseMultiplyFromLeftInPlace (const RowVectorBase< EE > &r)
 M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this.
template<class EE >
void elementwiseMultiplyFromLeft (const RowVectorBase< EE > &v, typename RowVectorBase< EE >::template EltResult< ELT >::Mul &out) const
template<class EE >
RowVectorBase< EE >::template
EltResult< ELT >::Mul 
elementwiseMultiplyFromLeft (const RowVectorBase< EE > &v) const
template<class EE >
RowVectorBaseelementwiseDivideInPlace (const RowVectorBase< EE > &r)
 M(i,j) /= R(i,j); R must have same dimensions as this.
template<class EE >
void elementwiseDivide (const RowVectorBase< EE > &v, typename EltResult< EE >::Dvd &out) const
template<class EE >
EltResult< EE >::Dvd elementwiseDivide (const RowVectorBase< EE > &v) const
template<class EE >
RowVectorBaseelementwiseDivideFromLeftInPlace (const RowVectorBase< EE > &r)
 M(i,j) = R(i,j) / M(i,j); R must have same dimensions as this.
template<class EE >
void elementwiseDivideFromLeft (const RowVectorBase< EE > &v, typename RowVectorBase< EE >::template EltResult< ELT >::Dvd &out) const
template<class EE >
RowVectorBase< EE >::template
EltResult< ELT >::Dvd 
elementwiseDivideFromLeft (const RowVectorBase< EE > &v) const
 operator const RowVector_< ELT > & () const
 operator RowVector_< ELT > & ()
 operator const RowVectorView_< ELT > & () const
 operator RowVectorView_< ELT > & ()
 operator const Matrix_< ELT > & () const
 operator Matrix_< ELT > & ()
 operator const MatrixView_< ELT > & () const
 operator MatrixView_< ELT > & ()
int size () const
int nrow () const
 Return the number of rows m in the logical shape of this matrix.
int ncol () const
 Return the number of columns n in the logical shape of this matrix.
ptrdiff_t nelt () const
 Return the number of elements in the logical shape of this matrix.
TAbs abs () const
 abs() with the result as a function return.
const ELT & operator[] (int j) const
ELT & operator[] (int j)
const ELT & operator() (int j) const
ELT & operator() (int j)
RowVectorView_< ELT > operator() (int j, int n) const
RowVectorView_< ELT > operator() (int j, int n)
RowVectorView_< ELT > index (const Array_< int > &indices) const
RowVectorView_< ELT > updIndex (const Array_< int > &indices)
RowVectorView_< ELT > operator() (const Array_< int > &indices) const
RowVectorView_< ELT > operator() (const Array_< int > &indices)
THerm transpose () const
THerm updTranspose ()
THerm operator~ () const
THerm operator~ ()
const RowVectorBaseoperator+ () const
const TNegnegate () const
TNegupdNegate ()
const TNegoperator- () const
TNegoperator- ()
RowVectorBaseresize (int n)
RowVectorBaseresizeKeep (int n)
void clear ()
 This restores the MatrixBase to the state it would be in had it been constructed specifying only its handle commitment.
ELT sum () const
 Form the column sums of this matrix, returned as a RowVector.
VectorIterator< ELT,
RowVectorBase< ELT > > 
begin ()
VectorIterator< ELT,
RowVectorBase< ELT > > 
end ()
RowVectorBase "owner" construction

These constructors create new RowVectorBase objects which own their own data and are (at least by default) resizable.

The resulting matrices are 1 x n with the number of rows locked at 1. If there is any data allocated but not explicitly initialized, that data will be uninitialized garbage in Release builds but will be initialized to NaN (at a performance cost) in Debug builds.



 RowVectorBase (int n=0)
 Default constructor makes a 1x0 matrix locked at 1 row; you can provide an initial allocation if you want.
 RowVectorBase (const RowVectorBase &source)
 Copy constructor is a deep copy (not appropriate for views!).
 RowVectorBase (const TNeg &source)
 Implicit conversion from compatible row vector with negated elements.
 RowVectorBase (int n, const ELT &initialValue)
 Construct an owner row vector of length n, with each element initialized to the given value.
 RowVectorBase (int n, const ELT *cppInitialValues)
 Construct an owner vector of length n, with the elements initialized sequentially from a C++ array of elements which is assumed to be of length n.
RowVectorBase construction from pre-existing data

Construct a non-resizeable, RowVectorBase view of externally supplied data.

Note that stride should be interpreted as "the number of scalars between elements" and for composite elements may have a different value if the source is a C++ array of elements vs. a Simmatrix packed data array. We provide constructors for both read-only and writable external data.



 RowVectorBase (int n, int stride, const Scalar *s)
 Construct a read-only view of existing data.
 RowVectorBase (int n, int stride, Scalar *s)
 Construct a writable view into existing data.
RowVectorBase construction from an existing Helper.

Create a new RowVectorBase from an existing helper.

Both shallow (view) and deep copies are possible. For shallow copies, there is a constructor providing a read-only view of the original data and one providing a writable view into the original data.



 RowVectorBase (MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::ShallowCopy &s)
 Construct a writable view into the source data.
 RowVectorBase (const MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::ShallowCopy &s)
 Construct a read-only view of the source data.
 RowVectorBase (const MatrixHelper< Scalar > &h, const typename MatrixHelper< Scalar >::DeepCopy &d)
 Construct a new owner vector initialized with the data from the source.

Protected Member Functions

 RowVectorBase (MatrixHelperRep< Scalar > *hrep)

Detailed Description

template<class ELT>
class SimTK::RowVectorBase< ELT >

This is a dataless rehash of the MatrixBase class to specialize it for RowVectors.

This mostly entails overriding a few of the methods. Note that all the MatrixBase operations remain available if you static_cast<> this up to a MatrixBase.


Constructor & Destructor Documentation

RowVectorBase ( int  n = 0  )  [inline, explicit]

Default constructor makes a 1x0 matrix locked at 1 row; you can provide an initial allocation if you want.

RowVectorBase ( const RowVectorBase< ELT > &  source  )  [inline]

Copy constructor is a deep copy (not appropriate for views!).

That means it creates a new, densely packed vector whose elements are initialized from the source object.

RowVectorBase ( const TNeg source  )  [inline]

Implicit conversion from compatible row vector with negated elements.

RowVectorBase ( int  n,
const ELT &  initialValue 
) [inline]

Construct an owner row vector of length n, with each element initialized to the given value.

RowVectorBase ( int  n,
const ELT *  cppInitialValues 
) [inline]

Construct an owner vector of length n, with the elements initialized sequentially from a C++ array of elements which is assumed to be of length n.

Note that we are expecting C++ packing; don't use this to initialize one Simmatrix vector from another because Simmatrix may pack its elements more densely than C++.

RowVectorBase ( int  n,
int  stride,
const Scalar *  s 
) [inline]

Construct a read-only view of existing data.

RowVectorBase ( int  n,
int  stride,
Scalar *  s 
) [inline]

Construct a writable view into existing data.

RowVectorBase ( MatrixHelper< Scalar > &  h,
const typename MatrixHelper< Scalar >::ShallowCopy &  s 
) [inline]

Construct a writable view into the source data.

RowVectorBase ( const MatrixHelper< Scalar > &  h,
const typename MatrixHelper< Scalar >::ShallowCopy &  s 
) [inline]

Construct a read-only view of the source data.

RowVectorBase ( const MatrixHelper< Scalar > &  h,
const typename MatrixHelper< Scalar >::DeepCopy &  d 
) [inline]

Construct a new owner vector initialized with the data from the source.

RowVectorBase ( MatrixHelperRep< Scalar > *  hrep  )  [inline, explicit, protected]

Member Function Documentation

TAbs abs (  )  const [inline]

abs() with the result as a function return.

More convenient than the other abs() member function, but may involve an additional copy of the matrix.

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::abs().

Referenced by SimTK::abs().

VectorIterator<ELT, RowVectorBase<ELT> > begin (  )  [inline]

Referenced by SimTK::median(), and SimTK::sort().

void clear (  )  [inline]

This restores the MatrixBase to the state it would be in had it been constructed specifying only its handle commitment.

The size will have been reduced to the smallest size consistent with the commitment.

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::clear(), and MatrixBase< ELT >::resize().

EltResult<EE>::Mul colScale ( const VectorBase< EE > &  v  )  const [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::ncol().

void colScale ( const VectorBase< EE > &  v,
typename EltResult< EE >::Mul &  out 
) const [inline]

Reimplemented from MatrixBase< ELT >.

RowVectorBase& colScaleInPlace ( const VectorBase< EE > &  v  )  [inline]

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.

Using rowScale would be really wacky since it is the same as a scalar multiply. We won't support rowScale here except through inheritance where it will not be much use.

Reimplemented from MatrixBase< ELT >.

EltResult<EE>::Dvd elementwiseDivide ( const RowVectorBase< EE > &  v  )  const [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::nrow().

void elementwiseDivide ( const RowVectorBase< EE > &  v,
typename EltResult< EE >::Dvd &  out 
) const [inline]

Reimplemented from MatrixBase< ELT >.

RowVectorBase<EE>::template EltResult<ELT>::Dvd elementwiseDivideFromLeft ( const RowVectorBase< EE > &  v  )  const [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::nrow().

void elementwiseDivideFromLeft ( const RowVectorBase< EE > &  v,
typename RowVectorBase< EE >::template EltResult< ELT >::Dvd &  out 
) const [inline]

Reimplemented from MatrixBase< ELT >.

RowVectorBase& elementwiseDivideFromLeftInPlace ( const RowVectorBase< EE > &  r  )  [inline]

M(i,j) = R(i,j) / M(i,j); R must have same dimensions as this.

Reimplemented from MatrixBase< ELT >.

RowVectorBase& elementwiseDivideInPlace ( const RowVectorBase< EE > &  r  )  [inline]

M(i,j) /= R(i,j); R must have same dimensions as this.

Reimplemented from MatrixBase< ELT >.

EltResult<EE>::Mul elementwiseMultiply ( const RowVectorBase< EE > &  v  )  const [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::nrow().

void elementwiseMultiply ( const RowVectorBase< EE > &  v,
typename EltResult< EE >::Mul &  out 
) const [inline]

Reimplemented from MatrixBase< ELT >.

RowVectorBase<EE>::template EltResult<ELT>::Mul elementwiseMultiplyFromLeft ( const RowVectorBase< EE > &  v  )  const [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::nrow().

void elementwiseMultiplyFromLeft ( const RowVectorBase< EE > &  v,
typename RowVectorBase< EE >::template EltResult< ELT >::Mul &  out 
) const [inline]

Reimplemented from MatrixBase< ELT >.

RowVectorBase& elementwiseMultiplyFromLeftInPlace ( const RowVectorBase< EE > &  r  )  [inline]

M(i,j) = R(i,j) * M(i,j); R must have same dimensions as this.

Reimplemented from MatrixBase< ELT >.

RowVectorBase& elementwiseMultiplyInPlace ( const RowVectorBase< EE > &  r  )  [inline]

M(i,j) *= R(i,j); R must have same dimensions as this.

Reimplemented from MatrixBase< ELT >.

VectorIterator<ELT, RowVectorBase<ELT> > end (  )  [inline]
RowVectorView_<ELT> index ( const Array_< int > &  indices  )  const [inline]
int ncol (  )  const [inline]

Return the number of columns n in the logical shape of this matrix.

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::ncol(), and MatrixBase< ELT >::nrow().

Referenced by RowVectorBase< ELT >::colScale(), and SimTK::operator*().

const TNeg& negate (  )  const [inline]

Reimplemented from MatrixBase< ELT >.

Referenced by RowVectorBase< ELT >::operator-().

ptrdiff_t nelt (  )  const [inline]

Return the number of elements in the logical shape of this matrix.

This has nothing to do with how many elements are actually stored; it is simply the product of the logical number of rows and columns, that is, nrow()*ncol(). Note that although each dimension is limited to a 32 bit size, the product of those dimensions may be > 32 bits on a 64 bit machine so the return type may be larger than that of nrow() and ncol().

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::nelt(), and MatrixBase< ELT >::nrow().

int nrow (  )  const [inline]
operator const Matrix_< ELT > & (  )  const [inline]
operator const MatrixView_< ELT > & (  )  const [inline]
operator const RowVector_< ELT > & (  )  const [inline]
operator const RowVectorView_< ELT > & (  )  const [inline]
operator Matrix_< ELT > & (  )  [inline]
operator MatrixView_< ELT > & (  )  [inline]
operator RowVector_< ELT > & (  )  [inline]
operator RowVectorView_< ELT > & (  )  [inline]
RowVectorView_<ELT> operator() ( const Array_< int > &  indices  )  [inline]
RowVectorView_<ELT> operator() ( const Array_< int > &  indices  )  const [inline]
RowVectorView_<ELT> operator() ( int  j,
int  n 
) [inline]

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::operator()().

RowVectorView_<ELT> operator() ( int  j,
int  n 
) const [inline]

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::operator()().

ELT& operator() ( int  j  )  [inline]
const ELT& operator() ( int  j  )  const [inline]
RowVectorBase& operator*= ( const StdNumber &  t  )  [inline]
const RowVectorBase& operator+ (  )  const [inline]

Reimplemented from MatrixBase< ELT >.

RowVectorBase& operator+= ( const RowVectorBase< EE > &  b  )  [inline]

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::operator+=().

RowVectorBase& operator+= ( const RowVectorBase< ELT > &  r  )  [inline]
TNeg& operator- (  )  [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::updNegate().

const TNeg& operator- (  )  const [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::negate().

RowVectorBase& operator-= ( const RowVectorBase< EE > &  b  )  [inline]

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::operator-=().

RowVectorBase& operator-= ( const RowVectorBase< ELT > &  r  )  [inline]
RowVectorBase& operator/= ( const StdNumber &  t  )  [inline]
RowVectorBase& operator= ( const ELT &  t  )  [inline]

Fill current allocation with copies of element.

Note that this is not the same behavior as assignment for Matrices, where only the diagonal is set (and everything else is set to zero.)

Reimplemented from MatrixBase< ELT >.

Reimplemented in RowVectorView_< ELT >, and RowVector_< ELT >.

References MatrixBase< ELT >::setTo().

RowVectorBase& operator= ( const RowVectorBase< EE > &  b  )  [inline]

Reimplemented from MatrixBase< ELT >.

Reimplemented in RowVectorView_< ELT >, and RowVector_< ELT >.

References MatrixBase< ELT >::operator=().

RowVectorBase& operator= ( const RowVectorBase< ELT > &  b  )  [inline]

Copy assignment is deep copy but behavior depends on type of lhs: if view, rhs must match.

If owner, we reallocate and copy rhs.

Reimplemented from MatrixBase< ELT >.

Reimplemented in RowVectorView_< ELT >, and RowVector_< ELT >.

References MatrixBase< ELT >::operator=().

Referenced by RowVector_< ELT >::operator=(), and RowVectorView_< ELT >::operator=().

ELT& operator[] ( int  j  )  [inline]
const ELT& operator[] ( int  j  )  const [inline]
THerm operator~ (  )  [inline]
THerm operator~ (  )  const [inline]

Reimplemented from MatrixBase< ELT >.

References RowVectorBase< ELT >::transpose().

RowVectorBase& resize ( int  n  )  [inline]
RowVectorBase& resizeKeep ( int  n  )  [inline]
int size (  )  const [inline]
ELT sum (  )  const [inline]

Form the column sums of this matrix, returned as a RowVector.

Reimplemented from MatrixBase< ELT >.

References MatrixBase< ELT >::getHelper(), and MatrixHelper< S >::sum().

Referenced by SimTK::sum().

THerm transpose (  )  const [inline]
RowVectorView_<ELT> updIndex ( const Array_< int > &  indices  )  [inline]
TNeg& updNegate (  )  [inline]

Reimplemented from MatrixBase< ELT >.

Referenced by RowVectorBase< ELT >::operator-().

THerm updTranspose (  )  [inline]

The documentation for this class was generated from the following file:

Generated on Thu Aug 12 16:38:14 2010 for SimTKcore by  doxygen 1.6.1