Simbody
3.4 (development)
|
This is a fixed length column vector designed for no-overhead inline computation. More...
#include <Vec.h>
Inherited by SimTK::UnitVec< Real, 1 >.
Classes | |
struct | EltResult |
struct | Result |
struct | Substitute |
Shape-preserving element substitution (always packed). More... | |
Public Types | |
Advanced | |
These are obscure members of Vec that are used for template metaprogramming and can be ignored by most users. | |
enum | { NRows = M, NCols = 1, NPackedElements = M, NActualElements = M * STRIDE, NActualScalars = CNT<E>::NActualScalars * NActualElements, RowSpacing = STRIDE, ColSpacing = NActualElements, ImagOffset = NTraits<ENumber>::ImagOffset, RealStrideFactor = 1, ArgDepth, IsScalar = 0, IsULessScalar = 0, IsNumber = 0, IsStdNumber = 0, IsPrecision = 0, SignInterpretation = CNT<E>::SignInterpretation } |
These compile-time constants are required of every Composite Numerical Type (CNT). More... | |
typedef ELT | E |
Element type of this Vec. | |
typedef CNT< E >::TNeg | ENeg |
Negated version of this Vec's element type; ENeg==negator< E >. | |
typedef CNT< E >::TWithoutNegator | EWithoutNegator |
Element type, stripped of negator<> if it has one. | |
typedef CNT< E >::TReal | EReal |
Type showing just the real part of an element of this Vec if elements are complex; otherwise just the element type. | |
typedef CNT< E >::TImag | EImag |
Type showing the imaginary part of an element of this Vec as real, if elements are complex; otherwise a type that can hold a zero of the element type. | |
typedef CNT< E >::TComplex | EComplex |
Type that elements would have if complex, if E is currently real; otherwise just the element type E. | |
typedef CNT< E >::THerm | EHerm |
Type of the Hermitian transpose of an element of this Vec. | |
typedef CNT< E >::TPosTrans | EPosTrans |
Type of a positional transpose of an element of this Vec. | |
typedef CNT< E >::TSqHermT | ESqHermT |
Type of the expression ~E*E (default vector and matrix square; symmetric). | |
typedef CNT< E >::TSqTHerm | ESqTHerm |
Type of the expression E*~E ("row square"; symmetric). | |
typedef CNT< E >::TSqrt | ESqrt |
Type required to hold the result of sqrt(E). | |
typedef CNT< E >::TAbs | EAbs |
Type required to hold the result of abs(E). | |
typedef CNT< E >::TStandard | EStandard |
Return type of standardize(E) method; a packed type that can hold the value of an element after eliminating negator and conjugate types. | |
typedef CNT< E >::TInvert | EInvert |
Packed type that can hold the value returned from invert(E), the inverse type of an element. | |
typedef CNT< E >::TNormalize | ENormalize |
Packed type that can hold the value returned from normalize(E). | |
typedef CNT< E >::Scalar | EScalar |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef CNT< E >::ULessScalar | EULessScalar |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef CNT< E >::Number | ENumber |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef CNT< E >::StdNumber | EStdNumber |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef CNT< E >::Precision | EPrecision |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef CNT< E >::ScalarNormSq | EScalarNormSq |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef Vec< M, E, STRIDE > | T |
The type of this Vec. | |
typedef Vec< M, ENeg, STRIDE > | TNeg |
Type this Vec would have if its elements were interpreted as negated. | |
typedef Vec< M, EWithoutNegator, STRIDE > | TWithoutNegator |
Type of this Vec with negator removed from its element type, if the element is negated. | |
typedef Vec< M, EReal, STRIDE *CNT< E >::RealStrideFactor > | TReal |
Type of this Vec cast to show only the real part of its element; this might affect the stride. | |
typedef Vec< M, EImag, STRIDE *CNT< E >::RealStrideFactor > | TImag |
Type of this Vec cast to show only the imaginary part of its element; this might affect the stride. | |
typedef Vec< M, EComplex, STRIDE > | TComplex |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef Row< M, EHerm, STRIDE > | THerm |
Type of this Vec after casting to its Hermitian transpose; that is, the Vec turns into a Row and each element turns into its Hermitian transpose. | |
typedef Row< M, E, STRIDE > | TPosTrans |
Type of this Vec after casting to its positional transpose; that is, the Vec turns into a Row but the element type remains unchanged. | |
typedef E | TElement |
Element type of this Vec. | |
typedef E | TRow |
Type of a row of this CNT object (for a Vec, just its element type). | |
typedef Vec | TCol |
Type of a column of this CNT object (for a Vec, the whole thing). | |
typedef Vec< M, ESqrt, 1 > | TSqrt |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef Vec< M, EAbs, 1 > | TAbs |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef Vec< M, EStandard, 1 > | TStandard |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef Row< M, EInvert, 1 > | TInvert |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef Vec< M, ENormalize, 1 > | TNormalize |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef ESqHermT | TSqHermT |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef SymMat< M, ESqTHerm > | TSqTHerm |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef EScalar | Scalar |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef EULessScalar | ULessScalar |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef ENumber | Number |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef EStdNumber | StdNumber |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef EPrecision | Precision |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
typedef EScalarNormSq | ScalarNormSq |
These compile-time constants are required of every Composite Numerical Type (CNT). | |
Public Member Functions | |
ScalarNormSq | scalarNormSqr () const |
Scalar norm square is sum( conjugate squares of all underlying scalars ), where conjugate square of scalar s is conj(s)*s. | |
TSqrt | sqrt () const |
Elementwise square root; that is, the return value has the same length as this Vec but with each element replaced by whatever it thinks its square root is. | |
TAbs | abs () const |
Elementwise absolute value; that is, the return value has the same dimension as this Vec but with each element replaced by whatever it thinks its absolute value is. | |
TStandard | standardize () const |
Return a copy of this Vec but with the underlying scalar type converted (if necessary) to one of the C++ standard real or complex floating point types. | |
EStandard | sum () const |
Sum just adds up all the elements into a single return element that is the same type as this Vec's elements except standardized to use one of the C++ built-in real or complex types as its underlying scalars. | |
Vec () | |
Default construction initializes Vec's elements to NaN when debugging but leaves them uninitialized garbage otherwise, so declarations have zero cost in Release builds. | |
Vec (const Vec &src) | |
Copy constructor copies the logically-included elements from the source Vec; gaps due to stride are not accessed in either source or destination. | |
Vec & | operator= (const Vec &src) |
Copy assignment operator copies the logically-included elements from the source Vec; gaps due to stride are not accessed in either source or destination. | |
template<int SS> | |
Vec (const Vec< M, E, SS > &src) | |
This is an implicit conversion from a Vec of the same length and element type but with a different stride. | |
template<int SS> | |
Vec (const Vec< M, ENeg, SS > &src) | |
This is an implicit conversion from a Vec of the same length and negated element type (possibly with a different stride). | |
template<class EE , int SS> | |
Vec (const Vec< M, EE, SS > &src) | |
Construct a Vec from a Vec of the same length, with any stride. | |
Vec (const E &e) | |
Construction from a single value of this Vec's element type assigns that value to each element. | |
Vec (const ENeg &ne) | |
Construction from a single value of this Vec's negated element type assigns that value to each element, requiring floating point negation to be performed once to compute the type-E representation of the type negator<E> value provided. | |
Vec (int i) | |
Given an int value, turn it into a suitable floating point number, convert that to element type E and then feed that to the above single-element constructor. | |
Vec (const E &e0, const E &e1) | |
Construct a Vec<2,E> from two elements of type E, etc. | |
Vec (const E &e0, const E &e1, const E &e2) | |
Vec (const E &e0, const E &e1, const E &e2, const E &e3) | |
Vec (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4) | |
Vec (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5) | |
Vec (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6) | |
Vec (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7) | |
Vec (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8) | |
template<class EE > | |
Vec (const EE *p) | |
Construction from a pointer to elements of any type EE assumes we're pointing at a C++ array of EE's of the right length, and that EE is assignment compatible with this Vec's element type E. | |
template<class EE > | |
Vec & | operator= (const EE *p) |
Assignment to a pointer to elements of any type EE assumes we're pointing at a C++ array of EE's of the right length, and that EE is assignment compatible with this Vec's element type E. | |
template<class EE , int SS> | |
Vec & | operator= (const Vec< M, EE, SS > &vv) |
Assignment to a conforming Vec, of any element type and stride, provided that the element types are assignment-compatible. | |
template<class EE , int SS> | |
Vec & | operator+= (const Vec< M, EE, SS > &r) |
Add in a conforming Vec, of any element type and stride, provided that the element types are addition-compatible. | |
template<class EE , int SS> | |
Vec & | operator+= (const Vec< M, negator< EE >, SS > &r) |
Add in a conforming Vec, of any negated element type and stride, provided that the element types are addition-compatible. | |
template<class EE , int SS> | |
Vec & | operator-= (const Vec< M, EE, SS > &r) |
Subtract off a conforming Vec, of any element type and stride, provided that the element types are addition-compatible. | |
template<class EE , int SS> | |
Vec & | operator-= (const Vec< M, negator< EE >, SS > &r) |
Subtract off a conforming Vec, of any negated element type and stride, provided that the element types are addition-compatible. | |
template<class EE , int SS> | |
Vec< M, typename CNT< E > ::template Result< EE >::Add > | conformingAdd (const Vec< M, EE, SS > &r) const |
Vector addition -- use operator+ instead. | |
template<class EE , int SS> | |
Vec< M, typename CNT< E > ::template Result< EE >::Sub > | conformingSubtract (const Vec< M, EE, SS > &r) const |
Vector subtraction -- use operator- instead. | |
template<class EE , int SS> | |
Mat< M, M, typename CNT< E > ::template Result< EE >::Mul > | conformingMultiply (const Row< M, EE, SS > &r) const |
Same as outer product (m = col*row) -- use operator* or outer() instead. | |
template<class EE , int SS> | |
Vec< M, typename CNT< E > ::template Result< EE >::Mul > | elementwiseMultiply (const Vec< M, EE, SS > &r) const |
Elementwise multiply (Matlab . | |
template<class EE , int SS> | |
Vec< M, typename CNT< E > ::template Result< EE >::Dvd > | elementwiseDivide (const Vec< M, EE, SS > &r) const |
Elementwise divide (Matlab . | |
const E & | operator[] (int i) const |
Select an element of this Vec and return a const reference to it. | |
const E & | operator() (int i) const |
Same as const operator[] above. | |
E & | operator[] (int i) |
Select an element of this Vec and return a writable reference to it. | |
E & | operator() (int i) |
Same as non-const operator[] above. | |
ScalarNormSq | normSqr () const |
CNT< ScalarNormSq >::TSqrt | norm () const |
TNormalize | normalize () const |
If the elements of this Vec are scalars, the result is what you get by dividing each element by the norm() calculated above. | |
TInvert | invert () const |
This method is not supported for Vec objects. | |
const Vec & | operator+ () const |
Unary plus does nothing. | |
const TNeg & | operator- () const |
Unary minus recasts this Vec to a type that has the opposite interpretation of the sign but is otherwise identical, so no computation or copying is performed here. | |
TNeg & | operator- () |
Recast to negated type and return a writable reference; writing to this will cause the negated result to be placed in the original Vec. | |
const THerm & | operator~ () const |
The Hermitian transpose operator recasts this Vec to a type that specifies the opposite storage order (row vs. column) then returns a reference, so no computation or copying is performed here. | |
THerm & | operator~ () |
Recast to Hermitian transposed type and return a writable reference; the effect is that writing to elements of the result affects the transposed element of the original Vec. | |
const TNeg & | negate () const |
Non-operator version of unary negation; just a recast. | |
TNeg & | updNegate () |
Non-operator version of unary negation; recasts and returns a writable reference. | |
const THerm & | transpose () const |
Non-operator version of Hermitian transpose; just a recast. | |
THerm & | updTranspose () |
Non-operator version of Hermitian transpose; recasts and returns a writable reference. | |
const TPosTrans & | positionalTranspose () const |
Positional transpose turns this Vec into a Row but does not transpose the individual elements. | |
TPosTrans & | updPositionalTranspose () |
Positional transpose returning a writable reference. | |
const TReal & | real () const |
Return a reference to the real portion of this Vec if it has complex elements; otherwise the type doesn't change. | |
TReal & | real () |
Recast to show only the real portion of this Vec and return a writable reference. | |
const TImag & | imag () const |
Return a reference to the imaginary portion of this Vec if it has complex elements; otherwise the type doesn't change. | |
TImag & | imag () |
Recast to show only the imaginary portion of this Vec and return a writable reference. | |
const TWithoutNegator & | castAwayNegatorIfAny () const |
Recast to remove negators from this Vec's type if present; this is handy for simplifying operations where we know the sign can be ignored such as squaring. | |
TWithoutNegator & | updCastAwayNegatorIfAny () |
Recast to remove negators from this Vec's type if present and return a writable reference. | |
template<class EE > | |
Vec< M, typename CNT< E > ::template Result< EE >::Mul > | scalarMultiply (const EE &e) const |
template<class EE > | |
Vec< M, typename CNT< EE > ::template Result< E >::Mul > | scalarMultiplyFromLeft (const EE &e) const |
template<class EE > | |
Vec< M, typename CNT< E > ::template Result< EE >::Dvd > | scalarDivide (const EE &e) const |
template<class EE > | |
Vec< M, typename CNT< EE > ::template Result< E >::Dvd > | scalarDivideFromLeft (const EE &e) const |
template<class EE > | |
Vec< M, typename CNT< E > ::template Result< EE >::Add > | scalarAdd (const EE &e) const |
template<class EE > | |
Vec< M, typename CNT< E > ::template Result< EE >::Sub > | scalarSubtract (const EE &e) const |
template<class EE > | |
Vec< M, typename CNT< EE > ::template Result< E >::Sub > | scalarSubtractFromLeft (const EE &e) const |
template<class EE > | |
Vec & | operator= (const EE &e) |
template<class EE > | |
Vec & | operator+= (const EE &e) |
template<class EE > | |
Vec & | operator-= (const EE &e) |
template<class EE > | |
Vec & | operator*= (const EE &e) |
template<class EE > | |
Vec & | operator/= (const EE &e) |
template<class EE > | |
Vec & | scalarEq (const EE &ee) |
template<class EE > | |
Vec & | scalarPlusEq (const EE &ee) |
template<class EE > | |
Vec & | scalarMinusEq (const EE &ee) |
template<class EE > | |
Vec & | scalarMinusEqFromLeft (const EE &ee) |
template<class EE > | |
Vec & | scalarTimesEq (const EE &ee) |
template<class EE > | |
Vec & | scalarTimesEqFromLeft (const EE &ee) |
template<class EE > | |
Vec & | scalarDivideEq (const EE &ee) |
template<class EE > | |
Vec & | scalarDivideEqFromLeft (const EE &ee) |
Vec & | scalarEq (int ee) |
Vec & | scalarPlusEq (int ee) |
Vec & | scalarMinusEq (int ee) |
Vec & | scalarTimesEq (int ee) |
Vec & | scalarDivideEq (int ee) |
Vec & | scalarMinusEqFromLeft (int ee) |
Vec & | scalarTimesEqFromLeft (int ee) |
Vec & | scalarDivideEqFromLeft (int ee) |
void | setToNaN () |
Set every scalar in this Vec to NaN; this is the default initial value in Debug builds, but not in Release. | |
void | setToZero () |
Set every scalar in this Vec to zero. | |
template<int MM> | |
const Vec< MM, ELT, STRIDE > & | getSubVec (int i) const |
Extract a const reference to a sub-Vec with size known at compile time. | |
template<int MM> | |
Vec< MM, ELT, STRIDE > & | updSubVec (int i) |
Extract a writable reference to a sub-Vec with size known at compile time. | |
Vec< M-1, ELT, 1 > | drop1 (int p) const |
Return a vector one smaller than this one by dropping the element at the indicated position p. | |
template<class EE > | |
Vec< M+1, ELT, 1 > | append1 (const EE &v) const |
Return a vector one larger than this one by adding an element to the end. | |
template<class EE > | |
Vec< M+1, ELT, 1 > | insert1 (int p, const EE &v) const |
Return a vector one larger than this one by inserting an element before the indicated one. | |
bool | isNaN () const |
Return true if any element of this Vec contains a NaN anywhere. | |
bool | isInf () const |
Return true if any element of this Vec contains a +Infinity or -Infinity somewhere but no element contains a NaN anywhere. | |
bool | isFinite () const |
Return true if no element of this Vec contains an Infinity or a NaN anywhere. | |
template<class E2 , int RS2> | |
bool | isNumericallyEqual (const Vec< M, E2, RS2 > &v, double tol) const |
Test whether this vector is numerically equal to some other vector with the same shape, using a specified tolerance. | |
template<class E2 , int RS2> | |
bool | isNumericallyEqual (const Vec< M, E2, RS2 > &v) const |
Test whether this vector is numerically equal to some other vector with the same shape, using a default tolerance which is the looser of the default tolerances of the two objects being compared. | |
bool | isNumericallyEqual (const ELT &e, double tol=getDefaultTolerance()) const |
Test whether every element of this vector is numerically equal to the given element, using either a specified tolerance or the vector's default tolerance (which is always the same or looser than the default tolerance for one of its elements). | |
std::string | toString () const |
Print Vec into a string and return it. | |
void | set (int i, const E &value) |
Variant of operator[] that's scripting friendly to set ith entry. | |
const E & | get (int i) const |
Variant of operator[] that's scripting friendly to get const reference to ith entry. | |
Static Public Member Functions | |
static int | size () |
The number of elements in this Vec (note that stride does not affect this number.) | |
static int | nrow () |
The number of rows in a Vec is the number of elements. | |
static int | ncol () |
The number of columns in a Vec is always 1. | |
template<int MM> | |
static const Vec & | getSubVec (const Vec< MM, ELT, STRIDE > &v, int i) |
Extract a subvector of type Vec from a longer one that has the same element type and stride, and return a const reference to the selected subsequence. | |
template<int MM> | |
static Vec & | updSubVec (Vec< MM, ELT, STRIDE > &v, int i) |
Extract a subvector of type Vec from a longer one that has the same element type and stride, and return a writable reference to the selected subsequence. | |
static const Vec & | getAs (const ELT *p) |
Recast an ordinary C++ array E[] to a const Vec<M,E,S>; assumes compatible length, stride, and packing. | |
static Vec & | updAs (ELT *p) |
Recast a writable ordinary C++ array E[] to a writable Vec<M,E,S>; assumes compatible length, stride, and packing. | |
static Vec< M, ELT, 1 > | getNaN () |
Return a Vec of the same length and element type as this one but with all elements set to NaN. | |
static double | getDefaultTolerance () |
For approximate comparisions, the default tolerance to use for a vector is the same as its elements' default tolerance. | |
Related Functions | |
(Note that these are not member functions.) | |
template<int M, class E , int S> | |
void | writeUnformatted (std::ostream &o, const Vec< M, E, S > &v) |
Specialize for Vec<M,E,S> to delegate to element type E, with spaces separating the elements. | |
template<int M, class E , int S> | |
bool | readUnformatted (std::istream &in, Vec< M, E, S > &v) |
Specialize for Vec<M,E,S> to delegate to element type E, with spaces separating the elements. |
This is a fixed length column vector designed for no-overhead inline computation.
M | The number of rows in the vector. |
ELT | The element type. Must be a composite numerical type (CNT). The default is ELT=Real. |
STRIDE | The spacing from one element to the next in memory, as an integer number of elements of type ELT. The default is STRIDE=1. |
typedef ELT SimTK::Vec< M, ELT, STRIDE >::E |
Element type of this Vec.
typedef CNT<E>::TNeg SimTK::Vec< M, ELT, STRIDE >::ENeg |
Negated version of this Vec's element type; ENeg==negator< E >.
typedef CNT<E>::TWithoutNegator SimTK::Vec< M, ELT, STRIDE >::EWithoutNegator |
Element type, stripped of negator<> if it has one.
typedef CNT<E>::TReal SimTK::Vec< M, ELT, STRIDE >::EReal |
Type showing just the real part of an element of this Vec if elements are complex; otherwise just the element type.
typedef CNT<E>::TImag SimTK::Vec< M, ELT, STRIDE >::EImag |
Type showing the imaginary part of an element of this Vec as real, if elements are complex; otherwise a type that can hold a zero of the element type.
typedef CNT<E>::TComplex SimTK::Vec< M, ELT, STRIDE >::EComplex |
Type that elements would have if complex, if E is currently real; otherwise just the element type E.
typedef CNT<E>::THerm SimTK::Vec< M, ELT, STRIDE >::EHerm |
Type of the Hermitian transpose of an element of this Vec.
typedef CNT<E>::TPosTrans SimTK::Vec< M, ELT, STRIDE >::EPosTrans |
Type of a positional transpose of an element of this Vec.
typedef CNT<E>::TSqHermT SimTK::Vec< M, ELT, STRIDE >::ESqHermT |
Type of the expression ~E*E (default vector and matrix square; symmetric).
typedef CNT<E>::TSqTHerm SimTK::Vec< M, ELT, STRIDE >::ESqTHerm |
Type of the expression E*~E ("row square"; symmetric).
typedef CNT<E>::TSqrt SimTK::Vec< M, ELT, STRIDE >::ESqrt |
Type required to hold the result of sqrt(E).
typedef CNT<E>::TAbs SimTK::Vec< M, ELT, STRIDE >::EAbs |
Type required to hold the result of abs(E).
typedef CNT<E>::TStandard SimTK::Vec< M, ELT, STRIDE >::EStandard |
Return type of standardize(E) method; a packed type that can hold the value of an element after eliminating negator and conjugate types.
typedef CNT<E>::TInvert SimTK::Vec< M, ELT, STRIDE >::EInvert |
Packed type that can hold the value returned from invert(E), the inverse type of an element.
typedef CNT<E>::TNormalize SimTK::Vec< M, ELT, STRIDE >::ENormalize |
Packed type that can hold the value returned from normalize(E).
typedef CNT<E>::Scalar SimTK::Vec< M, ELT, STRIDE >::EScalar |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef CNT<E>::ULessScalar SimTK::Vec< M, ELT, STRIDE >::EULessScalar |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef CNT<E>::Number SimTK::Vec< M, ELT, STRIDE >::ENumber |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef CNT<E>::StdNumber SimTK::Vec< M, ELT, STRIDE >::EStdNumber |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef CNT<E>::Precision SimTK::Vec< M, ELT, STRIDE >::EPrecision |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef CNT<E>::ScalarNormSq SimTK::Vec< M, ELT, STRIDE >::EScalarNormSq |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef Vec<M,E,STRIDE> SimTK::Vec< M, ELT, STRIDE >::T |
The type of this Vec.
typedef Vec<M,ENeg,STRIDE> SimTK::Vec< M, ELT, STRIDE >::TNeg |
Type this Vec would have if its elements were interpreted as negated.
typedef Vec<M,EWithoutNegator,STRIDE> SimTK::Vec< M, ELT, STRIDE >::TWithoutNegator |
Type of this Vec with negator removed from its element type, if the element is negated.
typedef Vec<M,EReal,STRIDE*CNT<E>::RealStrideFactor> SimTK::Vec< M, ELT, STRIDE >::TReal |
Type of this Vec cast to show only the real part of its element; this might affect the stride.
typedef Vec<M,EImag,STRIDE*CNT<E>::RealStrideFactor> SimTK::Vec< M, ELT, STRIDE >::TImag |
Type of this Vec cast to show only the imaginary part of its element; this might affect the stride.
typedef Vec<M,EComplex,STRIDE> SimTK::Vec< M, ELT, STRIDE >::TComplex |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef Row<M,EHerm,STRIDE> SimTK::Vec< M, ELT, STRIDE >::THerm |
typedef Row<M,E,STRIDE> SimTK::Vec< M, ELT, STRIDE >::TPosTrans |
typedef E SimTK::Vec< M, ELT, STRIDE >::TElement |
Element type of this Vec.
typedef E SimTK::Vec< M, ELT, STRIDE >::TRow |
typedef Vec SimTK::Vec< M, ELT, STRIDE >::TCol |
typedef Vec<M,ESqrt,1> SimTK::Vec< M, ELT, STRIDE >::TSqrt |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef Vec<M,EAbs,1> SimTK::Vec< M, ELT, STRIDE >::TAbs |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef Vec<M,EStandard,1> SimTK::Vec< M, ELT, STRIDE >::TStandard |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef Row<M,EInvert,1> SimTK::Vec< M, ELT, STRIDE >::TInvert |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef Vec<M,ENormalize,1> SimTK::Vec< M, ELT, STRIDE >::TNormalize |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef ESqHermT SimTK::Vec< M, ELT, STRIDE >::TSqHermT |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef SymMat<M,ESqTHerm> SimTK::Vec< M, ELT, STRIDE >::TSqTHerm |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef EScalar SimTK::Vec< M, ELT, STRIDE >::Scalar |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef EULessScalar SimTK::Vec< M, ELT, STRIDE >::ULessScalar |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef ENumber SimTK::Vec< M, ELT, STRIDE >::Number |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef EStdNumber SimTK::Vec< M, ELT, STRIDE >::StdNumber |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef EPrecision SimTK::Vec< M, ELT, STRIDE >::Precision |
These compile-time constants are required of every Composite Numerical Type (CNT).
typedef EScalarNormSq SimTK::Vec< M, ELT, STRIDE >::ScalarNormSq |
These compile-time constants are required of every Composite Numerical Type (CNT).
anonymous enum |
These compile-time constants are required of every Composite Numerical Type (CNT).
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | ) | [inline] |
Default construction initializes Vec's elements to NaN when debugging but leaves them uninitialized garbage otherwise, so declarations have zero cost in Release builds.
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const Vec< M, ELT, STRIDE > & | src | ) | [inline] |
Copy constructor copies the logically-included elements from the source Vec; gaps due to stride are not accessed in either source or destination.
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const Vec< M, E, SS > & | src | ) | [inline] |
This is an implicit conversion from a Vec of the same length and element type but with a different stride.
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const Vec< M, ENeg, SS > & | src | ) | [inline] |
This is an implicit conversion from a Vec of the same length and negated element type (possibly with a different stride).
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const Vec< M, EE, SS > & | src | ) | [inline, explicit] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e | ) | [inline, explicit] |
Construction from a single value of this Vec's element type assigns that value to each element.
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const ENeg & | ne | ) | [inline, explicit] |
Construction from a single value of this Vec's negated element type assigns that value to each element, requiring floating point negation to be performed once to compute the type-E representation of the type negator<E> value provided.
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | int | i | ) | [inline, explicit] |
Given an int value, turn it into a suitable floating point number, convert that to element type E and then feed that to the above single-element constructor.
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1 | ||
) | [inline] |
Construct a Vec<2,E> from two elements of type E, etc.
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1, | ||
const E & | e2 | ||
) | [inline] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1, | ||
const E & | e2, | ||
const E & | e3 | ||
) | [inline] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1, | ||
const E & | e2, | ||
const E & | e3, | ||
const E & | e4 | ||
) | [inline] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1, | ||
const E & | e2, | ||
const E & | e3, | ||
const E & | e4, | ||
const E & | e5 | ||
) | [inline] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1, | ||
const E & | e2, | ||
const E & | e3, | ||
const E & | e4, | ||
const E & | e5, | ||
const E & | e6 | ||
) | [inline] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1, | ||
const E & | e2, | ||
const E & | e3, | ||
const E & | e4, | ||
const E & | e5, | ||
const E & | e6, | ||
const E & | e7 | ||
) | [inline] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const E & | e0, |
const E & | e1, | ||
const E & | e2, | ||
const E & | e3, | ||
const E & | e4, | ||
const E & | e5, | ||
const E & | e6, | ||
const E & | e7, | ||
const E & | e8 | ||
) | [inline] |
SimTK::Vec< M, ELT, STRIDE >::Vec | ( | const EE * | p | ) | [inline, explicit] |
Construction from a pointer to elements of any type EE assumes we're pointing at a C++ array of EE's of the right length, and that EE is assignment compatible with this Vec's element type E.
The supplied pointer cannot be null.
static int SimTK::Vec< M, ELT, STRIDE >::size | ( | ) | [inline, static] |
The number of elements in this Vec (note that stride does not affect this number.)
static int SimTK::Vec< M, ELT, STRIDE >::nrow | ( | ) | [inline, static] |
The number of rows in a Vec is the number of elements.
static int SimTK::Vec< M, ELT, STRIDE >::ncol | ( | ) | [inline, static] |
The number of columns in a Vec is always 1.
ScalarNormSq SimTK::Vec< M, ELT, STRIDE >::scalarNormSqr | ( | ) | const [inline] |
Scalar norm square is sum( conjugate squares of all underlying scalars ), where conjugate square of scalar s is conj(s)*s.
TSqrt SimTK::Vec< M, ELT, STRIDE >::sqrt | ( | ) | const [inline] |
TAbs SimTK::Vec< M, ELT, STRIDE >::abs | ( | ) | const [inline] |
Elementwise absolute value; that is, the return value has the same dimension as this Vec but with each element replaced by whatever it thinks its absolute value is.
The element type may have changed and the stride of the return Vec is always 1.
Reimplemented in SimTK::UnitVec< P, S >, and SimTK::UnitVec< Real, 1 >.
TStandard SimTK::Vec< M, ELT, STRIDE >::standardize | ( | ) | const [inline] |
Return a copy of this Vec but with the underlying scalar type converted (if necessary) to one of the C++ standard real or complex floating point types.
This may require floating point negations to occur to get read of negator or conjugate types.
EStandard SimTK::Vec< M, ELT, STRIDE >::sum | ( | ) | const [inline] |
Sum just adds up all the elements into a single return element that is the same type as this Vec's elements except standardized to use one of the C++ built-in real or complex types as its underlying scalars.
Vec& SimTK::Vec< M, ELT, STRIDE >::operator= | ( | const Vec< M, ELT, STRIDE > & | src | ) | [inline] |
Copy assignment operator copies the logically-included elements from the source Vec; gaps due to stride are not accessed in either source or destination.
OK if source and destination are the same vector; results are unpredictable if they otherwise overlap with elements in common.
Vec& SimTK::Vec< M, ELT, STRIDE >::operator= | ( | const EE * | p | ) | [inline] |
Assignment to a pointer to elements of any type EE assumes we're pointing at a C++ array of EE's of the right length, and that EE is assignment compatible with this Vec's element type E.
The supplied pointer cannot be null.
Vec& SimTK::Vec< M, ELT, STRIDE >::operator= | ( | const Vec< M, EE, SS > & | vv | ) | [inline] |
Assignment to a conforming Vec, of any element type and stride, provided that the element types are assignment-compatible.
Vec& SimTK::Vec< M, ELT, STRIDE >::operator+= | ( | const Vec< M, EE, SS > & | r | ) | [inline] |
Add in a conforming Vec, of any element type and stride, provided that the element types are addition-compatible.
Vec& SimTK::Vec< M, ELT, STRIDE >::operator+= | ( | const Vec< M, negator< EE >, SS > & | r | ) | [inline] |
Add in a conforming Vec, of any negated element type and stride, provided that the element types are addition-compatible.
The negation is removed at zero cost by subtracting rather than adding.
Vec& SimTK::Vec< M, ELT, STRIDE >::operator-= | ( | const Vec< M, EE, SS > & | r | ) | [inline] |
Subtract off a conforming Vec, of any element type and stride, provided that the element types are addition-compatible.
Vec& SimTK::Vec< M, ELT, STRIDE >::operator-= | ( | const Vec< M, negator< EE >, SS > & | r | ) | [inline] |
Subtract off a conforming Vec, of any negated element type and stride, provided that the element types are addition-compatible.
The negation is removed at zero cost by adding rather than subtracting.
Vec<M,typename CNT<E>::template Result<EE>::Add> SimTK::Vec< M, ELT, STRIDE >::conformingAdd | ( | const Vec< M, EE, SS > & | r | ) | const [inline] |
Vector addition -- use operator+ instead.
Vec<M,typename CNT<E>::template Result<EE>::Sub> SimTK::Vec< M, ELT, STRIDE >::conformingSubtract | ( | const Vec< M, EE, SS > & | r | ) | const [inline] |
Vector subtraction -- use operator- instead.
Mat<M,M,typename CNT<E>::template Result<EE>::Mul> SimTK::Vec< M, ELT, STRIDE >::conformingMultiply | ( | const Row< M, EE, SS > & | r | ) | const [inline] |
Same as outer product (m = col*row) -- use operator* or outer() instead.
Vec<M,typename CNT<E>::template Result<EE>::Mul> SimTK::Vec< M, ELT, STRIDE >::elementwiseMultiply | ( | const Vec< M, EE, SS > & | r | ) | const [inline] |
Elementwise multiply (Matlab .
* operator).
Vec<M,typename CNT<E>::template Result<EE>::Dvd> SimTK::Vec< M, ELT, STRIDE >::elementwiseDivide | ( | const Vec< M, EE, SS > & | r | ) | const [inline] |
Elementwise divide (Matlab .
/ operator).
const E& SimTK::Vec< M, ELT, STRIDE >::operator[] | ( | int | i | ) | const [inline] |
Select an element of this Vec and return a const reference to it.
This is range-checked in Debug builds but has zero overhead in Release builds.
Reimplemented in SimTK::UnitVec< P, S >, and SimTK::UnitVec< Real, 1 >.
const E& SimTK::Vec< M, ELT, STRIDE >::operator() | ( | int | i | ) | const [inline] |
Same as const operator[] above.
Reimplemented in SimTK::UnitVec< P, S >, and SimTK::UnitVec< Real, 1 >.
E& SimTK::Vec< M, ELT, STRIDE >::operator[] | ( | int | i | ) | [inline] |
Select an element of this Vec and return a writable reference to it.
This is range-checked in Debug builds but has zero overhead in Release builds.
E& SimTK::Vec< M, ELT, STRIDE >::operator() | ( | int | i | ) | [inline] |
Same as non-const operator[] above.
ScalarNormSq SimTK::Vec< M, ELT, STRIDE >::normSqr | ( | ) | const [inline] |
CNT<ScalarNormSq>::TSqrt SimTK::Vec< M, ELT, STRIDE >::norm | ( | ) | const [inline] |
TNormalize SimTK::Vec< M, ELT, STRIDE >::normalize | ( | ) | const [inline] |
If the elements of this Vec are scalars, the result is what you get by dividing each element by the norm() calculated above.
If the elements are not scalars, then the elements are *separately* normalized. That means you will get a different answer from Vec<2,Vec3>::normalize() than you would from a Vec<6>::normalize() containing the same scalars.
Normalize returns a vector of the same dimension but in new, packed storage and with a return type that does not include negator<> even if the original Vec<> does, because we can eliminate the negation here almost for free. But we can't standardize (change conjugate to complex) for free, so we'll retain conjugates if there are any.
Reimplemented in SimTK::Quaternion_< P >.
TInvert SimTK::Vec< M, ELT, STRIDE >::invert | ( | ) | const [inline] |
This method is not supported for Vec objects.
const Vec& SimTK::Vec< M, ELT, STRIDE >::operator+ | ( | ) | const [inline] |
Unary plus does nothing.
const TNeg& SimTK::Vec< M, ELT, STRIDE >::operator- | ( | ) | const [inline] |
Unary minus recasts this Vec to a type that has the opposite interpretation of the sign but is otherwise identical, so no computation or copying is performed here.
Reimplemented in SimTK::UnitVec< P, S >, and SimTK::UnitVec< Real, 1 >.
TNeg& SimTK::Vec< M, ELT, STRIDE >::operator- | ( | ) | [inline] |
Recast to negated type and return a writable reference; writing to this will cause the negated result to be placed in the original Vec.
const THerm& SimTK::Vec< M, ELT, STRIDE >::operator~ | ( | ) | const [inline] |
The Hermitian transpose operator recasts this Vec to a type that specifies the opposite storage order (row vs. column) then returns a reference, so no computation or copying is performed here.
Reimplemented in SimTK::UnitVec< P, S >, and SimTK::UnitVec< Real, 1 >.
THerm& SimTK::Vec< M, ELT, STRIDE >::operator~ | ( | ) | [inline] |
Recast to Hermitian transposed type and return a writable reference; the effect is that writing to elements of the result affects the transposed element of the original Vec.
Reimplemented in SimTK::UnitVec< P, S >, and SimTK::UnitVec< Real, 1 >.
const TNeg& SimTK::Vec< M, ELT, STRIDE >::negate | ( | ) | const [inline] |
Non-operator version of unary negation; just a recast.
Reimplemented in SimTK::UnitVec< P, S >, and SimTK::UnitVec< Real, 1 >.
TNeg& SimTK::Vec< M, ELT, STRIDE >::updNegate | ( | ) | [inline] |
Non-operator version of unary negation; recasts and returns a writable reference.
const THerm& SimTK::Vec< M, ELT, STRIDE >::transpose | ( | ) | const [inline] |
Non-operator version of Hermitian transpose; just a recast.
THerm& SimTK::Vec< M, ELT, STRIDE >::updTranspose | ( | ) | [inline] |
Non-operator version of Hermitian transpose; recasts and returns a writable reference.
const TPosTrans& SimTK::Vec< M, ELT, STRIDE >::positionalTranspose | ( | ) | const [inline] |
Positional transpose turns this Vec into a Row but does not transpose the individual elements.
That is, a Vec<2,Vec3> becomes a Row<2,Vec3>, rather than a Row<2,Row3> as would happen with ordinary transpose(). This is just a recast; no copying or computation is performed here.
TPosTrans& SimTK::Vec< M, ELT, STRIDE >::updPositionalTranspose | ( | ) | [inline] |
Positional transpose returning a writable reference.
const TReal& SimTK::Vec< M, ELT, STRIDE >::real | ( | ) | const [inline] |
Return a reference to the real portion of this Vec if it has complex elements; otherwise the type doesn't change.
This is just a recast; no copying or computation is done here. The result may have a different stride than the original since the imaginary parts must be skipped.
TReal& SimTK::Vec< M, ELT, STRIDE >::real | ( | ) | [inline] |
Recast to show only the real portion of this Vec and return a writable reference.
const TImag& SimTK::Vec< M, ELT, STRIDE >::imag | ( | ) | const [inline] |
Return a reference to the imaginary portion of this Vec if it has complex elements; otherwise the type doesn't change.
This is just a recast; no copying or computation is done here. The result may have a different stride than the original since the real parts must be skipped.
TImag& SimTK::Vec< M, ELT, STRIDE >::imag | ( | ) | [inline] |
Recast to show only the imaginary portion of this Vec and return a writable reference.
const TWithoutNegator& SimTK::Vec< M, ELT, STRIDE >::castAwayNegatorIfAny | ( | ) | const [inline] |
Recast to remove negators from this Vec's type if present; this is handy for simplifying operations where we know the sign can be ignored such as squaring.
TWithoutNegator& SimTK::Vec< M, ELT, STRIDE >::updCastAwayNegatorIfAny | ( | ) | [inline] |
Recast to remove negators from this Vec's type if present and return a writable reference.
Vec<M, typename CNT<E>::template Result<EE>::Mul> SimTK::Vec< M, ELT, STRIDE >::scalarMultiply | ( | const EE & | e | ) | const [inline] |
Vec<M, typename CNT<EE>::template Result<E>::Mul> SimTK::Vec< M, ELT, STRIDE >::scalarMultiplyFromLeft | ( | const EE & | e | ) | const [inline] |
Vec<M, typename CNT<E>::template Result<EE>::Dvd> SimTK::Vec< M, ELT, STRIDE >::scalarDivide | ( | const EE & | e | ) | const [inline] |
Vec<M, typename CNT<EE>::template Result<E>::Dvd> SimTK::Vec< M, ELT, STRIDE >::scalarDivideFromLeft | ( | const EE & | e | ) | const [inline] |
Vec<M, typename CNT<E>::template Result<EE>::Add> SimTK::Vec< M, ELT, STRIDE >::scalarAdd | ( | const EE & | e | ) | const [inline] |
Vec<M, typename CNT<E>::template Result<EE>::Sub> SimTK::Vec< M, ELT, STRIDE >::scalarSubtract | ( | const EE & | e | ) | const [inline] |
Vec<M, typename CNT<EE>::template Result<E>::Sub> SimTK::Vec< M, ELT, STRIDE >::scalarSubtractFromLeft | ( | const EE & | e | ) | const [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::operator= | ( | const EE & | e | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::operator+= | ( | const EE & | e | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::operator-= | ( | const EE & | e | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::operator*= | ( | const EE & | e | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::operator/= | ( | const EE & | e | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarEq | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarPlusEq | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarMinusEq | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarMinusEqFromLeft | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarTimesEq | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarTimesEqFromLeft | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarDivideEq | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarDivideEqFromLeft | ( | const EE & | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarEq | ( | int | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarPlusEq | ( | int | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarMinusEq | ( | int | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarTimesEq | ( | int | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarDivideEq | ( | int | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarMinusEqFromLeft | ( | int | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarTimesEqFromLeft | ( | int | ee | ) | [inline] |
Vec& SimTK::Vec< M, ELT, STRIDE >::scalarDivideEqFromLeft | ( | int | ee | ) | [inline] |
void SimTK::Vec< M, ELT, STRIDE >::setToNaN | ( | ) | [inline] |
Set every scalar in this Vec to NaN; this is the default initial value in Debug builds, but not in Release.
void SimTK::Vec< M, ELT, STRIDE >::setToZero | ( | ) | [inline] |
Set every scalar in this Vec to zero.
const Vec<MM,ELT,STRIDE>& SimTK::Vec< M, ELT, STRIDE >::getSubVec | ( | int | i | ) | const [inline] |
Extract a const reference to a sub-Vec with size known at compile time.
This must be called with an explicit template argument for the size, for example, getSubVec<3>(i). This is only a recast; no copying or computation is performed. The size and index are range checked in Debug builds but not in Release builds.
Vec<MM,ELT,STRIDE>& SimTK::Vec< M, ELT, STRIDE >::updSubVec | ( | int | i | ) | [inline] |
Extract a writable reference to a sub-Vec with size known at compile time.
This must be called with an explicit template argument for the size, for example, updSubVec<3>(i). This is only a recast; no copying or computation is performed. The size and index are range checked in Debug builds but not in Release builds.
static const Vec& SimTK::Vec< M, ELT, STRIDE >::getSubVec | ( | const Vec< MM, ELT, STRIDE > & | v, |
int | i | ||
) | [inline, static] |
Extract a subvector of type Vec from a longer one that has the same element type and stride, and return a const reference to the selected subsequence.
static Vec& SimTK::Vec< M, ELT, STRIDE >::updSubVec | ( | Vec< MM, ELT, STRIDE > & | v, |
int | i | ||
) | [inline, static] |
Extract a subvector of type Vec from a longer one that has the same element type and stride, and return a writable reference to the selected subsequence.
Vec<M-1,ELT,1> SimTK::Vec< M, ELT, STRIDE >::drop1 | ( | int | p | ) | const [inline] |
Return a vector one smaller than this one by dropping the element at the indicated position p.
The result is a packed copy with the same element type as this one.
Vec<M+1,ELT,1> SimTK::Vec< M, ELT, STRIDE >::append1 | ( | const EE & | v | ) | const [inline] |
Return a vector one larger than this one by adding an element to the end.
The result is a packed copy with the same element type as this one. Works for any assignment compatible element.
Vec<M+1,ELT,1> SimTK::Vec< M, ELT, STRIDE >::insert1 | ( | int | p, |
const EE & | v | ||
) | const [inline] |
Return a vector one larger than this one by inserting an element before the indicated one.
The result is a packed copy with the same element type as this one. Works for any assignment compatible element. The index can be one greater than normally allowed in which case the element is appended (but use append1() if you know you're appending).
static const Vec& SimTK::Vec< M, ELT, STRIDE >::getAs | ( | const ELT * | p | ) | [inline, static] |
Recast an ordinary C++ array E[] to a const Vec<M,E,S>; assumes compatible length, stride, and packing.
Reimplemented in SimTK::UnitVec< P, S >.
static Vec& SimTK::Vec< M, ELT, STRIDE >::updAs | ( | ELT * | p | ) | [inline, static] |
Recast a writable ordinary C++ array E[] to a writable Vec<M,E,S>; assumes compatible length, stride, and packing.
static Vec<M,ELT,1> SimTK::Vec< M, ELT, STRIDE >::getNaN | ( | ) | [inline, static] |
Return a Vec of the same length and element type as this one but with all elements set to NaN.
The result is packed (stride==1) regardless of the stride of this Vec.
bool SimTK::Vec< M, ELT, STRIDE >::isNaN | ( | ) | const [inline] |
Return true if any element of this Vec contains a NaN anywhere.
bool SimTK::Vec< M, ELT, STRIDE >::isInf | ( | ) | const [inline] |
Return true if any element of this Vec contains a +Infinity or -Infinity somewhere but no element contains a NaN anywhere.
bool SimTK::Vec< M, ELT, STRIDE >::isFinite | ( | ) | const [inline] |
Return true if no element of this Vec contains an Infinity or a NaN anywhere.
static double SimTK::Vec< M, ELT, STRIDE >::getDefaultTolerance | ( | ) | [inline, static] |
For approximate comparisions, the default tolerance to use for a vector is the same as its elements' default tolerance.
bool SimTK::Vec< M, ELT, STRIDE >::isNumericallyEqual | ( | const Vec< M, E2, RS2 > & | v, |
double | tol | ||
) | const [inline] |
Test whether this vector is numerically equal to some other vector with the same shape, using a specified tolerance.
bool SimTK::Vec< M, ELT, STRIDE >::isNumericallyEqual | ( | const Vec< M, E2, RS2 > & | v | ) | const [inline] |
Test whether this vector is numerically equal to some other vector with the same shape, using a default tolerance which is the looser of the default tolerances of the two objects being compared.
bool SimTK::Vec< M, ELT, STRIDE >::isNumericallyEqual | ( | const ELT & | e, |
double | tol = getDefaultTolerance() |
||
) | const [inline] |
Test whether every element of this vector is numerically equal to the given element, using either a specified tolerance or the vector's default tolerance (which is always the same or looser than the default tolerance for one of its elements).
std::string SimTK::Vec< M, ELT, STRIDE >::toString | ( | ) | const [inline] |
Print Vec into a string and return it.
Please refer to operator<< for details.
void SimTK::Vec< M, ELT, STRIDE >::set | ( | int | i, |
const E & | value | ||
) | [inline] |
Variant of operator[] that's scripting friendly to set ith entry.
const E& SimTK::Vec< M, ELT, STRIDE >::get | ( | int | i | ) | const [inline] |
Variant of operator[] that's scripting friendly to get const reference to ith entry.