1 #ifndef SimTK_SIMMATRIX_VECTOR_H_
2 #define SimTK_SIMMATRIX_VECTOR_H_
50 template <
class ELT>
class Vector_ :
public VectorBase<ELT> {
51 typedef typename CNT<ELT>::Scalar S;
52 typedef typename CNT<ELT>::Number Number;
53 typedef typename CNT<ELT>::StdNumber StdNumber;
54 typedef typename CNT<ELT>::TNeg ENeg;
55 typedef VectorBase<ELT> Base;
56 typedef VectorBase<ENeg> BaseNeg;
81 Vector_(
const BaseNeg& src) : Base(src) {}
92 Vector_(
int m,
const ELT* cppInitialValues) : Base(m, cppInitialValues) {}
95 Vector_(
int m,
const ELT& initialValue) : Base(m, initialValue) {}
101 for (
int i = 0; i < M; ++i)
102 this->
updElt(i, 0) = v(i);
129 Vector_(
int m,
int stride,
const S* data,
bool)
130 : Base(m, stride, data) {}
135 : Base(m, stride, data) {}
192 std::stringstream stream;
197 const ELT&
get(
int i)
const {
return (*
this)[i]; }
199 void set(
int i,
const ELT& value) { (*this)[i]=value; }
208 #endif // SimTK_SIMMATRIX_VECTOR_H_
Vector_()
Default constructor creates a 0x1, reallocatable vector.
Definition: Vector_.h:67
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...
Definition: Vector_.h:148
VectorBase & operator*=(const StdNumber &t)
Definition: VectorBase.h:145
Vector_(int m, int stride, S *data, bool)
Borrowed-space writable construction with explicit stride supplied as "number of scalars between elem...
Definition: Vector_.h:134
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Vector_ & operator+=(const VectorBase< EE > &m)
Add in a conforming vector of the base type even if it has a different element type EE...
Definition: Vector_.h:157
Vector_(int m, const S *cppData, bool)
Construct a Vector_ which shares read-only, borrowed space with assumed element-to-element stride equ...
Definition: Vector_.h:117
This is a dataless rehash of the MatrixBase class to specialize it for Vectors.
Definition: BigMatrix.h:164
VectorBase & operator=(const VectorBase &b)
Copy assignment is deep copy but behavior depends on type of lhs: if view, rhs must match...
Definition: VectorBase.h:138
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 point...
Definition: Vector_.h:92
Vector_(const Base &src)
This copy constructor serves as an implicit conversion from objects of the base class type (for examp...
Definition: Vector_.h:77
ELT & updElt(int i, int j)
Definition: MatrixBase.h:657
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 i...
Definition: Vector_.h:95
Vector_ & operator/=(const StdNumber &t)
In-place divide of each element of this Vector_ by a scalar t.
Definition: Vector_.h:171
MatrixBase & elementwiseSubtractScalarInPlace(const S &s)
Set M(i,j)-=s for every element of M and some value s.
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...
Definition: Vector_.h:163
VectorBase & operator/=(const StdNumber &t)
Definition: VectorBase.h:146
Vector_(int m, S *cppData, bool)
Construct a Vector_ which shares writable, borrowed space with assumed element-to-element stride equa...
Definition: Vector_.h:123
std::string toString() const
toString() returns a string representation of the Vector_.
Definition: Vector_.h:191
VectorBase & operator-=(const VectorBase &r)
Definition: VectorBase.h:148
This is the vector class intended to appear in user code for large, variable size column vectors...
Definition: BigMatrix.h:171
MatrixBase & elementwiseAddScalarInPlace(const S &s)
Set M(i,j)+=s for every element of M and some value s.
Vector_ & operator=(const ELT &v)
Set all elements of this Vector_ to the same value v.
Definition: Vector_.h:152
Vector_ & operator-=(const ELT &b)
In-place subtract from each element of this Vector_ the same given value b.
Definition: Vector_.h:181
Vector_(int m, int stride, const S *data, bool)
Borrowed-space read-only construction with explicit stride supplied as "number of scalars between ele...
Definition: Vector_.h:129
Vector_ & operator*=(const StdNumber &t)
In-place multiply of each element of this Vector_ by a scalar t.
Definition: Vector_.h:168
void set(int i, const ELT &value)
Variant of operator[] that's scripting friendly to set ith element.
Definition: Vector_.h:199
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:589
Vector_(int m)
Construct a Vector_ with a given preallocated size, but with uninitialized values.
Definition: Vector_.h:87
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 o...
Definition: Vector_.h:100
Vector_ & operator=(const Vector_ &src)
Copy assignment is deep and can be reallocating if this Vector_ is an owner.
Definition: Vector_.h:142
Vector_(const BaseNeg &src)
This copy constructor serves as an implicit conversion from objects of the base class but with negate...
Definition: Vector_.h:81
VectorBase & operator+=(const VectorBase &r)
Definition: VectorBase.h:147
Vector_(const Vector_ &src)
Copy constructor is deep, that is the source Vector_ is copied, not referenced.
Definition: Vector_.h:71
Vector_ & operator+=(const ELT &b)
In-place add to each element of this Vector_ the same given value b.
Definition: Vector_.h:176
Definition: MatrixBase.h:155