Simbody  3.5
SimTK::negator< NUMBER > Class Template Reference

negator<N>, where N is a number type (real, complex, conjugate), is represented in memory identically to N, but behaves as though multiplied by -1, though at zero cost. More...

Classes

struct  Result
 
struct  Substitute
 

Public Types

enum  {
  NRows = 1,
  NCols = 1,
  RowSpacing = 1,
  ColSpacing = 1,
  NPackedElements = 1,
  NActualElements = 1,
  NActualScalars = 1,
  ImagOffset = NTraits<N>::ImagOffset,
  RealStrideFactor = NTraits<N>::RealStrideFactor,
  ArgDepth = SCALAR_DEPTH,
  IsScalar = 1,
  IsULessScalar = 1,
  IsNumber = 0,
  IsStdNumber = 0,
  IsPrecision = 0,
  SignInterpretation = -1
}
 
typedef negator< N > T
 
typedef NUMBER TNeg
 
typedef NUMBER TWithoutNegator
 
typedef CNT< NReal >::TNeg TReal
 
typedef CNT< NImag >::TNeg TImag
 
typedef CNT< NComplex >::TNeg TComplex
 
typedef CNT< NHerm >::TNeg THerm
 
typedef negator< N > TPosTrans
 
typedef NTraits< N >::TSqHermT TSqHermT
 
typedef NTraits< N >::TSqTHerm TSqTHerm
 
typedef negator< N > TElement
 
typedef negator< N > TRow
 
typedef negator< N > TCol
 
typedef NTraits< N >::TSqrt TSqrt
 
typedef NTraits< N >::TAbs TAbs
 
typedef NTraits< N >::TStandard TStandard
 
typedef CNT< NInvert >::TNeg TInvert
 
typedef NTraits< N >::TStandard TNormalize
 
typedef negator< N > Scalar
 
typedef negator< N > ULessScalar
 
typedef NUMBER Number
 
typedef NTraits< N >::StdNumber StdNumber
 
typedef NTraits< N >::Precision Precision
 
typedef NTraits< N >::ScalarNormSq ScalarNormSq
 

Public Member Functions

const negator< N > * getData () const
 
negator< N > * updData ()
 
const TRealreal () const
 
TRealreal ()
 
const TImagimag () const
 
TImagimag ()
 
ScalarNormSq scalarNormSqr () const
 
TSqrt sqrt () const
 
TAbs abs () const
 
TStandard standardize () const
 
TNormalize normalize () const
 
TInvert invert () const
 
bool isFinite () const
 Returns true if the negated value is finite (i.e., not NaN or Inf). More...
 
bool isNaN () const
 Returns true if the negated value contains a NaN. More...
 
bool isInf () const
 Returns true if the negated value contains an Inf or -Inf and does not contain a NaN. More...
 
template<class T2 >
bool isNumericallyEqual (const T2 &t2) const
 In the generic case we'll perform the negation here to get a number, and then delegate to the other type which can be any CNT. More...
 
template<class N2 >
bool isNumericallyEqual (const negator< N2 > &t2) const
 In this partial specialization we know that both types have negators so we can just compare the underlying numbers, each of which has the reversed sign, using the global SimTK method available for comparing numbers. More...
 
template<class T2 >
bool isNumericallyEqual (const T2 &t2, double tol) const
 This is the generic case (see above) but with an explicitly-provided tolerance. More...
 
template<class N2 >
bool isNumericallyEqual (const negator< N2 > &t2, double tol) const
 This is the partially specialized case again (see above) but with an explicitly-provided tolerance. More...
 
 negator ()
 
 negator (const negator &n)
 
negatoroperator= (const negator &n)
 
 negator (int t)
 
 negator (const float &t)
 
 negator (const double &t)
 
 negator (const long double &t)
 
template<class P >
 negator (const std::complex< P > &t)
 
template<class P >
 negator (const conjugate< P > &t)
 
const N & operator- () const
 
N & operator- ()
 
operator+ () const
 
 operator N () const
 
template<class P >
negatoroperator= (const P &t)
 
template<class P >
negatoroperator+= (const P &t)
 
template<class P >
negatoroperator-= (const P &t)
 
template<class P >
negatoroperator*= (const P &t)
 
template<class P >
negatoroperator/= (const P &t)
 
template<class NN >
negatoroperator= (const negator< NN > &t)
 
template<class NN >
negatoroperator+= (const negator< NN > &t)
 
template<class NN >
negatoroperator-= (const negator< NN > &t)
 

Static Public Member Functions

static negator< N > getNaN ()
 
static negator< N > getInfinity ()
 
static double getDefaultTolerance ()
 
static const negator< N > & recast (const N &val)
 

Friends

template<class N2 >
class negator
 

Detailed Description

template<class NUMBER>
class SimTK::negator< NUMBER >

negator<N>, where N is a number type (real, complex, conjugate), is represented in memory identically to N, but behaves as though multiplied by -1, though at zero cost.

Only negators instantiated with the nine number types (real, complex, conjugate) are allowed.

Member Typedef Documentation

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::T
template<class NUMBER>
typedef NUMBER SimTK::negator< NUMBER >::TNeg
template<class NUMBER>
typedef NUMBER SimTK::negator< NUMBER >::TWithoutNegator
template<class NUMBER>
typedef CNT<NReal>::TNeg SimTK::negator< NUMBER >::TReal
template<class NUMBER>
typedef CNT<NImag>::TNeg SimTK::negator< NUMBER >::TImag
template<class NUMBER>
typedef CNT<NComplex>::TNeg SimTK::negator< NUMBER >::TComplex
template<class NUMBER>
typedef CNT<NHerm>::TNeg SimTK::negator< NUMBER >::THerm
template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TPosTrans
template<class NUMBER>
typedef NTraits<N>::TSqHermT SimTK::negator< NUMBER >::TSqHermT
template<class NUMBER>
typedef NTraits<N>::TSqTHerm SimTK::negator< NUMBER >::TSqTHerm
template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TElement
template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TRow
template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TCol
template<class NUMBER>
typedef NTraits<N>::TSqrt SimTK::negator< NUMBER >::TSqrt
template<class NUMBER>
typedef NTraits<N>::TAbs SimTK::negator< NUMBER >::TAbs
template<class NUMBER>
typedef NTraits<N>::TStandard SimTK::negator< NUMBER >::TStandard
template<class NUMBER>
typedef CNT<NInvert>::TNeg SimTK::negator< NUMBER >::TInvert
template<class NUMBER>
typedef NTraits<N>::TStandard SimTK::negator< NUMBER >::TNormalize
template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::Scalar
template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::ULessScalar
template<class NUMBER>
typedef NUMBER SimTK::negator< NUMBER >::Number
template<class NUMBER>
typedef NTraits<N>::StdNumber SimTK::negator< NUMBER >::StdNumber
template<class NUMBER>
typedef NTraits<N>::Precision SimTK::negator< NUMBER >::Precision
template<class NUMBER>
typedef NTraits<N>::ScalarNormSq SimTK::negator< NUMBER >::ScalarNormSq

Member Enumeration Documentation

template<class NUMBER>
anonymous enum
Enumerator
NRows 
NCols 
RowSpacing 
ColSpacing 
NPackedElements 
NActualElements 
NActualScalars 
ImagOffset 
RealStrideFactor 
ArgDepth 
IsScalar 
IsULessScalar 
IsNumber 
IsStdNumber 
IsPrecision 
SignInterpretation 

Constructor & Destructor Documentation

template<class NUMBER>
SimTK::negator< NUMBER >::negator ( )
inline
template<class NUMBER>
SimTK::negator< NUMBER >::negator ( const negator< NUMBER > &  n)
inline
template<class NUMBER>
SimTK::negator< NUMBER >::negator ( int  t)
inline
template<class NUMBER>
SimTK::negator< NUMBER >::negator ( const float &  t)
inline
template<class NUMBER>
SimTK::negator< NUMBER >::negator ( const double &  t)
inline
template<class NUMBER>
SimTK::negator< NUMBER >::negator ( const long double &  t)
inline
template<class NUMBER>
template<class P >
SimTK::negator< NUMBER >::negator ( const std::complex< P > &  t)
inline
template<class NUMBER>
template<class P >
SimTK::negator< NUMBER >::negator ( const conjugate< P > &  t)
inline

Member Function Documentation

template<class NUMBER>
const negator<N>* SimTK::negator< NUMBER >::getData ( ) const
inline
template<class NUMBER>
negator<N>* SimTK::negator< NUMBER >::updData ( )
inline
template<class NUMBER>
const TReal& SimTK::negator< NUMBER >::real ( ) const
inline
template<class NUMBER>
TReal& SimTK::negator< NUMBER >::real ( )
inline
template<class NUMBER>
const TImag& SimTK::negator< NUMBER >::imag ( ) const
inline
template<class NUMBER>
TImag& SimTK::negator< NUMBER >::imag ( )
inline
template<class NUMBER>
ScalarNormSq SimTK::negator< NUMBER >::scalarNormSqr ( ) const
inline
template<class NUMBER>
TSqrt SimTK::negator< NUMBER >::sqrt ( ) const
inline
template<class NUMBER>
TAbs SimTK::negator< NUMBER >::abs ( ) const
inline
template<class NUMBER>
TStandard SimTK::negator< NUMBER >::standardize ( ) const
inline
template<class NUMBER>
TNormalize SimTK::negator< NUMBER >::normalize ( ) const
inline
template<class NUMBER>
TInvert SimTK::negator< NUMBER >::invert ( ) const
inline
template<class NUMBER>
static negator<N> SimTK::negator< NUMBER >::getNaN ( )
inlinestatic
template<class NUMBER>
static negator<N> SimTK::negator< NUMBER >::getInfinity ( )
inlinestatic
template<class N >
bool SimTK::negator< N >::isFinite ( ) const
inline

Returns true if the negated value is finite (i.e., not NaN or Inf).

template<class N >
bool SimTK::negator< N >::isNaN ( ) const
inline

Returns true if the negated value contains a NaN.

template<class N >
bool SimTK::negator< N >::isInf ( ) const
inline

Returns true if the negated value contains an Inf or -Inf and does not contain a NaN.

template<class NUMBER>
static double SimTK::negator< NUMBER >::getDefaultTolerance ( )
inlinestatic
template<class NUMBER>
template<class T2 >
bool SimTK::negator< NUMBER >::isNumericallyEqual ( const T2 &  t2) const
inline

In the generic case we'll perform the negation here to get a number, and then delegate to the other type which can be any CNT.

template<class NUMBER>
template<class N2 >
bool SimTK::negator< NUMBER >::isNumericallyEqual ( const negator< N2 > &  t2) const
inline

In this partial specialization we know that both types have negators so we can just compare the underlying numbers, each of which has the reversed sign, using the global SimTK method available for comparing numbers.

template<class NUMBER>
template<class T2 >
bool SimTK::negator< NUMBER >::isNumericallyEqual ( const T2 &  t2,
double  tol 
) const
inline

This is the generic case (see above) but with an explicitly-provided tolerance.

template<class NUMBER>
template<class N2 >
bool SimTK::negator< NUMBER >::isNumericallyEqual ( const negator< N2 > &  t2,
double  tol 
) const
inline

This is the partially specialized case again (see above) but with an explicitly-provided tolerance.

template<class NUMBER>
negator& SimTK::negator< NUMBER >::operator= ( const negator< NUMBER > &  n)
inline
template<class NUMBER>
static const negator<N>& SimTK::negator< NUMBER >::recast ( const N &  val)
inlinestatic
template<class NUMBER>
const N& SimTK::negator< NUMBER >::operator- ( ) const
inline
template<class NUMBER>
N& SimTK::negator< NUMBER >::operator- ( )
inline
template<class NUMBER>
N SimTK::negator< NUMBER >::operator+ ( ) const
inline
template<class NUMBER>
SimTK::negator< NUMBER >::operator N ( ) const
inline
template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator= ( const P &  t)
inline
template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator+= ( const P &  t)
inline
template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator-= ( const P &  t)
inline
template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator*= ( const P &  t)
inline
template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator/= ( const P &  t)
inline
template<class NUMBER>
template<class NN >
negator& SimTK::negator< NUMBER >::operator= ( const negator< NN > &  t)
inline
template<class NUMBER>
template<class NN >
negator& SimTK::negator< NUMBER >::operator+= ( const negator< NN > &  t)
inline
template<class NUMBER>
template<class NN >
negator& SimTK::negator< NUMBER >::operator-= ( const negator< NN > &  t)
inline

Friends And Related Function Documentation

template<class NUMBER>
template<class N2 >
friend class negator
friend

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