Simbody  3.6
SimTK::UnitRow< P, S > Class Template Reference

This type is used for the transpose of UnitVec, and as the returned row type of a Rotation. More...

+ Inheritance diagram for SimTK::UnitRow< P, S >:

Public Types

typedef Row< 3, P, S > BaseRow
 
typedef UnitVec< P, S > TransposeType
 
- Public Types inherited from SimTK::Row< 3, P, S >
enum  
 
typedef Row< N, E, STRIDE > T
 
typedef Row< N, ENeg, STRIDE > TNeg
 
typedef Row< N, EWithoutNegator, STRIDE > TWithoutNegator
 
typedef Row< N, EReal, STRIDE *CNT< E >::RealStrideFactorTReal
 
typedef Row< N, EImag, STRIDE *CNT< E >::RealStrideFactorTImag
 
typedef Row< N, EComplex, STRIDE > TComplex
 
typedef Vec< N, EHerm, STRIDE > THerm
 
typedef Vec< N, E, STRIDE > TPosTrans
 
typedef E TElement
 
typedef Row TRow
 
typedef E TCol
 
typedef Vec< N, ESqrt, 1 > TSqrt
 
typedef Row< N, EAbs, 1 > TAbs
 
typedef Row< N, EStandard, 1 > TStandard
 
typedef Vec< N, EInvert, 1 > TInvert
 
typedef Row< N, ENormalize, 1 > TNormalize
 
typedef SymMat< N, ESqHermT > TSqHermT
 
typedef EScalarNormSq TSqTHerm
 
typedef EScalar Scalar
 
typedef EULessScalar ULessScalar
 
typedef ENumber Number
 
typedef EStdNumber StdNumber
 
typedef EPrecision Precision
 
typedef EScalarNormSq ScalarNormSq
 

Public Member Functions

 UnitRow ()
 
 UnitRow (const UnitRow &u)
 Copy constructor does not require normalization. More...
 
template<int S2>
 UnitRow (const UnitRow< P, S2 > &u)
 Implicit conversion from UnitRow with different stride; no normalization required. More...
 
UnitRowoperator= (const UnitRow &u)
 Copy assignment does not require normalization. More...
 
template<int S2>
UnitRowoperator= (const UnitRow< P, S2 > &u)
 Copy assignment from UnitRow with different stride; no computation needed. More...
 
 UnitRow (const BaseRow &v)
 Explicit conversion from Row to UnitRow, requiring expensive normalization. More...
 
template<int S2>
 UnitRow (const Row< 3, P, S2 > &v)
 Explicit conversion from Row of any stride to UnitRow, requiring expensive normalization. More...
 
 UnitRow (const P &x, const P &y, const P &z)
 Create a unit row from explicitly specified measure numbers (x,y,z); requires expensive normalization. More...
 
 UnitRow (int axis)
 Create a unit axis vector 100 010 001 given 0, 1, or 2. More...
 
const BaseRowasRow3 () const
 Return a const reference to the Row3 underlying this UnitRow. More...
 
UnitRow< P, 1 > negate () const
 Returns a new unit vector pointing in the opposite direction from this one; does not modify this UnitVec object. More...
 
UnitRow< P, 1 > operator- () const
 Returns a new unit vector pointing in the opposite direction from this one. More...
 
const TransposeTypeoperator~ () const
 Return a const reference to this UnitRow reinterpreted as a UnitVec; no computation requires since this is just a type cast. More...
 
TransposeTypeoperator~ ()
 Return a writable reference to this UnitRow reinterpreted as a UnitVec; no computation requires since this is just a type cast. More...
 
const P & operator[] (int i) const
 Return one element of this unit row as a const reference; there is no corresponding writable index function since changing a single element of a unit vector would violate the contract that it has unit length at all times. More...
 
const P & operator() (int i) const
 Return one element of this unit row as a const reference; there is no corresponding writable index function since changing a single element of a unit vector would violate the contract that it has unit length at all times. More...
 
UnitRow< P, 1 > abs () const
 Return a new UnitRow whose measure numbers are the absolute values of the ones here. More...
 
UnitRow< P, 1 > perp () const
 Return a new UnitRow perpendicular to this one but otherwise arbitrary. More...
 
 UnitRow (const BaseRow &v, bool)
 (Advanced) This constructor is only for our friends whom we trust to give us an already-normalized vector which we simply accept as normalized without checking. More...
 
template<int S2>
 UnitRow (const Row< 3, P, S2 > &v, bool)
 (Advanced) This constructor is only for our friends whom we trust to give us an already-normalized vector which we simply accept as normalized without checking (this version accepts an input vector of any stride). More...
 
- Public Member Functions inherited from SimTK::Row< 3, P, S >
ScalarNormSq scalarNormSqr () const
 
TSqrt sqrt () const
 
TAbs abs () const
 
TStandard standardize () const
 
EStandard sum () const
 
 Row ()
 
 Row (const Row &src)
 
 Row (const Row< N, E, SS > &src)
 
 Row (const Row< N, ENeg, SS > &src)
 
 Row (const Row< N, EE, SS > &vv)
 
 Row (const E &e)
 
 Row (const ENeg &ne)
 
 Row (int i)
 
 Row (const E &e0, const E &e1)
 
 Row (const E &e0, const E &e1, const E &e2)
 
 Row (const E &e0, const E &e1, const E &e2, const E &e3)
 
 Row (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4)
 
 Row (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5)
 
 Row (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6)
 
 Row (const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7)
 
 Row (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)
 
 Row (const EE *p)
 
Rowoperator= (const Row &src)
 
Rowoperator= (const EE *p)
 
Rowoperator= (const Row< N, EE, SS > &vv)
 
Rowoperator= (const EE &e)
 
Rowoperator+= (const Row< N, EE, SS > &r)
 
Rowoperator+= (const Row< N, negator< EE >, SS > &r)
 
Rowoperator+= (const EE &e)
 
Rowoperator-= (const Row< N, EE, SS > &r)
 
Rowoperator-= (const Row< N, negator< EE >, SS > &r)
 
Rowoperator-= (const EE &e)
 
Row< N, typename CNT< E >::template Result< EE >::Add > conformingAdd (const Row< N, EE, SS > &r) const
 Vector addition – use operator+ instead. More...
 
Row< N, typename CNT< E >::template Result< EE >::Sub > conformingSubtract (const Row< N, EE, SS > &r) const
 Vector subtraction – use operator- instead. More...
 
CNT< E >::template Result< EE >::Mul conformingMultiply (const Vec< N, EE, SS > &r) const
 Same as dot product (s = row*col) – use operator* or dot() instead. More...
 
Row< MatNCol, typename CNT< E >::template Result< EE >::Mul > conformingMultiply (const Mat< N, MatNCol, EE, CS, RS > &m) const
 Row times a conforming matrix, row=row*mat – use operator* instead. More...
 
Row< N, typename CNT< E >::template Result< EE >::Mul > elementwiseMultiply (const Row< N, EE, SS > &r) const
 Elementwise multiply (Matlab . More...
 
Row< N, typename CNT< E >::template Result< EE >::Dvd > elementwiseDivide (const Row< N, EE, SS > &r) const
 Elementwise divide (Matlab . More...
 
const E & operator[] (int i) const
 
E & operator[] (int i)
 
const E & operator() (int i) const
 
E & operator() (int i)
 
ScalarNormSq normSqr () const
 
CNT< ScalarNormSq >::TSqrt norm () const
 
TNormalize normalize () const
 
TInvert invert () const
 
const Rowoperator+ () const
 
const TNegoperator- () const
 
TNegoperator- ()
 
const THermoperator~ () const
 
THermoperator~ ()
 
const TNegnegate () const
 
TNegupdNegate ()
 
const THermtranspose () const
 
THermupdTranspose ()
 
const TPosTranspositionalTranspose () const
 
TPosTransupdPositionalTranspose ()
 
const TRealreal () const
 
TRealreal ()
 
const TImagimag () const
 
TImagimag ()
 
const TWithoutNegatorcastAwayNegatorIfAny () const
 
TWithoutNegatorupdCastAwayNegatorIfAny ()
 
Row< N, typename CNT< E >::template Result< EE >::Mul > scalarMultiply (const EE &e) const
 
Row< N, typename CNT< EE >::template Result< E >::Mul > scalarMultiplyFromLeft (const EE &e) const
 
Row< N, typename CNT< E >::template Result< EE >::Dvd > scalarDivide (const EE &e) const
 
Row< N, typename CNT< EE >::template Result< E >::Dvd > scalarDivideFromLeft (const EE &e) const
 
Row< N, typename CNT< E >::template Result< EE >::Add > scalarAdd (const EE &e) const
 
Row< N, typename CNT< E >::template Result< EE >::Sub > scalarSubtract (const EE &e) const
 
Row< N, typename CNT< EE >::template Result< E >::Sub > scalarSubtractFromLeft (const EE &e) const
 
Rowoperator*= (const EE &e)
 
Rowoperator/= (const EE &e)
 
RowscalarEq (const EE &ee)
 
RowscalarEq (int ee)
 
RowscalarPlusEq (const EE &ee)
 
RowscalarPlusEq (int ee)
 
RowscalarMinusEq (const EE &ee)
 
RowscalarMinusEq (int ee)
 
RowscalarMinusEqFromLeft (const EE &ee)
 
RowscalarMinusEqFromLeft (int ee)
 
RowscalarTimesEq (const EE &ee)
 
RowscalarTimesEq (int ee)
 
RowscalarTimesEqFromLeft (const EE &ee)
 
RowscalarTimesEqFromLeft (int ee)
 
RowscalarDivideEq (const EE &ee)
 
RowscalarDivideEq (int ee)
 
RowscalarDivideEqFromLeft (const EE &ee)
 
RowscalarDivideEqFromLeft (int ee)
 
void setToNaN ()
 Set every scalar in this Row to NaN; this is the default initial value in Debug builds, but not in Release. More...
 
void setToZero ()
 Set every scalar in this Row to zero. More...
 
const Row< NN, P, STRIDE > & getSubRow (int j) const
 Extract a const reference to a sub-Row with size known at compile time. More...
 
Row< NN, P, STRIDE > & updSubRow (int j)
 Extract a writable reference to a sub-Row with size known at compile time. More...
 
Row< N-1, P, 1 > drop1 (int p) const
 Return a row one smaller than this one by dropping the element at the indicated position p. More...
 
Row< N+1, P, 1 > append1 (const EE &v) const
 Return a row one larger than this one by adding an element to the end. More...
 
Row< N+1, P, 1 > insert1 (int p, const EE &v) const
 Return a row one larger than this one by inserting an element before the indicated one. More...
 
bool isNaN () const
 Return true if any element of this Row contains a NaN anywhere. More...
 
bool isInf () const
 Return true if any element of this Row contains a +Infinity or -Infinity somewhere but no element contains a NaN anywhere. More...
 
bool isFinite () const
 Return true if no element of this Row contains an Infinity or a NaN anywhere. More...
 
bool isNumericallyEqual (const Row< N, E2, CS2 > &r, double tol) const
 Test whether this row is numerically equal to some other row with the same shape, using a specified tolerance. More...
 
bool isNumericallyEqual (const Row< N, E2, CS2 > &r) const
 Test whether this row vector is numerically equal to some other row with the same shape, using a default tolerance which is the looser of the default tolerances of the two objects being compared. More...
 
bool isNumericallyEqual (const P &e, double tol=getDefaultTolerance()) const
 Test whether every element of this row vector is numerically equal to the given element, using either a specified tolerance or the row's default tolerance (which is always the same or looser than the default tolerance for one of its elements). More...
 

Static Public Member Functions

static const UnitRowgetAs (const P *p)
 (Advanced) Reinterpret a given memory location as a UnitRow like this one, without checking – don't use this if you aren't absolutely certain that the memory location actually does contain a unit vector, with the correct stride! This overrides the base Row class method of the same name. More...
 
- Static Public Member Functions inherited from SimTK::Row< 3, P, S >
static int size ()
 
static int nrow ()
 
static int ncol ()
 
static const RowgetSubRow (const Row< NN, P, STRIDE > &r, int j)
 Extract a subvector of type Row from a longer one that has the same element type and stride, and return a const reference to the selected subsequence. More...
 
static RowupdSubRow (Row< NN, P, STRIDE > &r, int j)
 Extract a subvector of type Row from a longer one that has the same element type and stride, and return a writable reference to the selected subsequence. More...
 
static const RowgetAs (const P *p)
 Recast an ordinary C++ array E[] to a const Row<N,E,S>; assumes compatible length, stride, and packing. More...
 
static RowupdAs (P *p)
 Recast a writable ordinary C++ array E[] to a writable Row<N,E,S>; assumes compatible length, stride, and packing. More...
 
static Row< N, P, 1 > getNaN ()
 Return a Row of the same length and element type as this one but with all elements set to NaN. More...
 
static double getDefaultTolerance ()
 For approximate comparisons, the default tolerance to use for a vector is the same as its elements' default tolerance. More...
 

Related Functions

(Note that these are not member functions.)

template<class P , int S1, int S2>
bool operator== (const UnitRow< P, S1 > &u1, const UnitRow< P, S2 > &u2)
 Compare two UnitRow3 objects for exact, bitwise equality (not very useful). More...
 
template<class P , int S1, int S2>
bool operator!= (const UnitRow< P, S1 > &u1, const UnitRow< P, S2 > &u2)
 Compare two UnitRow3 objects and return true unless they are exactly bitwise equal (not very useful). More...
 

Detailed Description

template<class P, int S>
class SimTK::UnitRow< P, S >

This type is used for the transpose of UnitVec, and as the returned row type of a Rotation.

Don't construct these directly.

Member Typedef Documentation

◆ BaseRow

template<class P, int S>
typedef Row<3,P,S> SimTK::UnitRow< P, S >::BaseRow

◆ TransposeType

template<class P, int S>
typedef UnitVec<P,S> SimTK::UnitRow< P, S >::TransposeType

Constructor & Destructor Documentation

◆ UnitRow() [1/9]

template<class P, int S>
SimTK::UnitRow< P, S >::UnitRow ( )
inline

◆ UnitRow() [2/9]

template<class P, int S>
SimTK::UnitRow< P, S >::UnitRow ( const UnitRow< P, S > &  u)
inline

Copy constructor does not require normalization.

◆ UnitRow() [3/9]

template<class P, int S>
template<int S2>
SimTK::UnitRow< P, S >::UnitRow ( const UnitRow< P, S2 > &  u)
inline

Implicit conversion from UnitRow with different stride; no normalization required.

◆ UnitRow() [4/9]

template<class P, int S>
SimTK::UnitRow< P, S >::UnitRow ( const BaseRow v)
inlineexplicit

Explicit conversion from Row to UnitRow, requiring expensive normalization.

◆ UnitRow() [5/9]

template<class P, int S>
template<int S2>
SimTK::UnitRow< P, S >::UnitRow ( const Row< 3, P, S2 > &  v)
inlineexplicit

Explicit conversion from Row of any stride to UnitRow, requiring expensive normalization.

◆ UnitRow() [6/9]

template<class P, int S>
SimTK::UnitRow< P, S >::UnitRow ( const P &  x,
const P &  y,
const P &  z 
)
inline

Create a unit row from explicitly specified measure numbers (x,y,z); requires expensive normalization.

◆ UnitRow() [7/9]

template<class P, int S>
SimTK::UnitRow< P, S >::UnitRow ( int  axis)
inlineexplicit

Create a unit axis vector 100 010 001 given 0, 1, or 2.

◆ UnitRow() [8/9]

template<class P, int S>
SimTK::UnitRow< P, S >::UnitRow ( const BaseRow v,
bool   
)
inline

(Advanced) This constructor is only for our friends whom we trust to give us an already-normalized vector which we simply accept as normalized without checking.

◆ UnitRow() [9/9]

template<class P, int S>
template<int S2>
SimTK::UnitRow< P, S >::UnitRow ( const Row< 3, P, S2 > &  v,
bool   
)
inline

(Advanced) This constructor is only for our friends whom we trust to give us an already-normalized vector which we simply accept as normalized without checking (this version accepts an input vector of any stride).

Member Function Documentation

◆ operator=() [1/2]

template<class P, int S>
UnitRow& SimTK::UnitRow< P, S >::operator= ( const UnitRow< P, S > &  u)
inline

Copy assignment does not require normalization.

◆ operator=() [2/2]

template<class P, int S>
template<int S2>
UnitRow& SimTK::UnitRow< P, S >::operator= ( const UnitRow< P, S2 > &  u)
inline

Copy assignment from UnitRow with different stride; no computation needed.

◆ asRow3()

template<class P, int S>
const BaseRow& SimTK::UnitRow< P, S >::asRow3 ( ) const
inline

Return a const reference to the Row3 underlying this UnitRow.

◆ negate()

template<class P, int S>
UnitRow<P,1> SimTK::UnitRow< P, S >::negate ( ) const
inline

Returns a new unit vector pointing in the opposite direction from this one; does not modify this UnitVec object.

Cost is 3 flops.

◆ operator-()

template<class P, int S>
UnitRow<P,1> SimTK::UnitRow< P, S >::operator- ( ) const
inline

Returns a new unit vector pointing in the opposite direction from this one.

Cost is 3 flops.

◆ operator~() [1/2]

template<class P, int S>
const TransposeType& SimTK::UnitRow< P, S >::operator~ ( ) const
inline

Return a const reference to this UnitRow reinterpreted as a UnitVec; no computation requires since this is just a type cast.

◆ operator~() [2/2]

template<class P, int S>
TransposeType& SimTK::UnitRow< P, S >::operator~ ( )
inline

Return a writable reference to this UnitRow reinterpreted as a UnitVec; no computation requires since this is just a type cast.

◆ operator[]()

template<class P, int S>
const P& SimTK::UnitRow< P, S >::operator[] ( int  i) const
inline

Return one element of this unit row as a const reference; there is no corresponding writable index function since changing a single element of a unit vector would violate the contract that it has unit length at all times.

◆ operator()()

template<class P, int S>
const P& SimTK::UnitRow< P, S >::operator() ( int  i) const
inline

Return one element of this unit row as a const reference; there is no corresponding writable index function since changing a single element of a unit vector would violate the contract that it has unit length at all times.

◆ abs()

template<class P, int S>
UnitRow<P,1> SimTK::UnitRow< P, S >::abs ( ) const
inline

Return a new UnitRow whose measure numbers are the absolute values of the ones here.

This will still have unit length but will be a reflection of this unit vector into the first octant (+x,+y,+z). Note that we are returning the packed form of UnitRow regardless of our stride here.

◆ perp()

template<class P , int S>
UnitRow< P, 1 > SimTK::UnitRow< P, S >::perp ( ) const
inline

Return a new UnitRow perpendicular to this one but otherwise arbitrary.

Some care is taken to ensure good numerical conditioning for the result regardless of what goes in. Cost is about 50 flops.

◆ getAs()

template<class P, int S>
static const UnitRow& SimTK::UnitRow< P, S >::getAs ( const P *  p)
inlinestatic

(Advanced) Reinterpret a given memory location as a UnitRow like this one, without checking – don't use this if you aren't absolutely certain that the memory location actually does contain a unit vector, with the correct stride! This overrides the base Row class method of the same name.

Friends And Related Function Documentation

◆ operator==()

template<class P , int S1, int S2>
bool operator== ( const UnitRow< P, S1 > &  u1,
const UnitRow< P, S2 > &  u2 
)
related

Compare two UnitRow3 objects for exact, bitwise equality (not very useful).

◆ operator!=()

template<class P , int S1, int S2>
bool operator!= ( const UnitRow< P, S1 > &  u1,
const UnitRow< P, S2 > &  u2 
)
related

Compare two UnitRow3 objects and return true unless they are exactly bitwise equal (not very useful).


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