Simbody  3.7
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)
 
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

◆ T

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::T

◆ TNeg

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

◆ TWithoutNegator

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

◆ TReal

template<class NUMBER>
typedef CNT<NReal>::TNeg SimTK::negator< NUMBER >::TReal

◆ TImag

template<class NUMBER>
typedef CNT<NImag>::TNeg SimTK::negator< NUMBER >::TImag

◆ TComplex

template<class NUMBER>
typedef CNT<NComplex>::TNeg SimTK::negator< NUMBER >::TComplex

◆ THerm

template<class NUMBER>
typedef CNT<NHerm>::TNeg SimTK::negator< NUMBER >::THerm

◆ TPosTrans

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TPosTrans

◆ TSqHermT

template<class NUMBER>
typedef NTraits<N>::TSqHermT SimTK::negator< NUMBER >::TSqHermT

◆ TSqTHerm

template<class NUMBER>
typedef NTraits<N>::TSqTHerm SimTK::negator< NUMBER >::TSqTHerm

◆ TElement

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TElement

◆ TRow

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TRow

◆ TCol

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::TCol

◆ TSqrt

template<class NUMBER>
typedef NTraits<N>::TSqrt SimTK::negator< NUMBER >::TSqrt

◆ TAbs

template<class NUMBER>
typedef NTraits<N>::TAbs SimTK::negator< NUMBER >::TAbs

◆ TStandard

template<class NUMBER>
typedef NTraits<N>::TStandard SimTK::negator< NUMBER >::TStandard

◆ TInvert

template<class NUMBER>
typedef CNT<NInvert>::TNeg SimTK::negator< NUMBER >::TInvert

◆ TNormalize

template<class NUMBER>
typedef NTraits<N>::TStandard SimTK::negator< NUMBER >::TNormalize

◆ Scalar

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::Scalar

◆ ULessScalar

template<class NUMBER>
typedef negator<N> SimTK::negator< NUMBER >::ULessScalar

◆ Number

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

◆ StdNumber

template<class NUMBER>
typedef NTraits<N>::StdNumber SimTK::negator< NUMBER >::StdNumber

◆ Precision

template<class NUMBER>
typedef NTraits<N>::Precision SimTK::negator< NUMBER >::Precision

◆ ScalarNormSq

template<class NUMBER>
typedef NTraits<N>::ScalarNormSq SimTK::negator< NUMBER >::ScalarNormSq

Member Enumeration Documentation

◆ anonymous enum

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

◆ negator() [1/7]

template<class NUMBER>
SimTK::negator< NUMBER >::negator ( )
inline

◆ negator() [2/7]

template<class NUMBER>
SimTK::negator< NUMBER >::negator ( const negator< NUMBER > &  n)
inline

◆ negator() [3/7]

template<class NUMBER>
SimTK::negator< NUMBER >::negator ( int  t)
inline

◆ negator() [4/7]

template<class NUMBER>
SimTK::negator< NUMBER >::negator ( const float &  t)
inline

◆ negator() [5/7]

template<class NUMBER>
SimTK::negator< NUMBER >::negator ( const double &  t)
inline

◆ negator() [6/7]

template<class NUMBER>
template<class P >
SimTK::negator< NUMBER >::negator ( const std::complex< P > &  t)
inline

◆ negator() [7/7]

template<class NUMBER>
template<class P >
SimTK::negator< NUMBER >::negator ( const conjugate< P > &  t)
inline

Member Function Documentation

◆ getData()

template<class NUMBER>
const negator<N>* SimTK::negator< NUMBER >::getData ( ) const
inline

◆ updData()

template<class NUMBER>
negator<N>* SimTK::negator< NUMBER >::updData ( )
inline

◆ real() [1/2]

template<class NUMBER>
const TReal& SimTK::negator< NUMBER >::real ( ) const
inline

◆ real() [2/2]

template<class NUMBER>
TReal& SimTK::negator< NUMBER >::real ( )
inline

◆ imag() [1/2]

template<class NUMBER>
const TImag& SimTK::negator< NUMBER >::imag ( ) const
inline

◆ imag() [2/2]

template<class NUMBER>
TImag& SimTK::negator< NUMBER >::imag ( )
inline

◆ scalarNormSqr()

template<class NUMBER>
ScalarNormSq SimTK::negator< NUMBER >::scalarNormSqr ( ) const
inline

◆ sqrt()

template<class NUMBER>
TSqrt SimTK::negator< NUMBER >::sqrt ( ) const
inline

◆ abs()

template<class NUMBER>
TAbs SimTK::negator< NUMBER >::abs ( ) const
inline

◆ standardize()

template<class NUMBER>
TStandard SimTK::negator< NUMBER >::standardize ( ) const
inline

◆ normalize()

template<class NUMBER>
TNormalize SimTK::negator< NUMBER >::normalize ( ) const
inline

◆ invert()

template<class NUMBER>
TInvert SimTK::negator< NUMBER >::invert ( ) const
inline

◆ getNaN()

template<class NUMBER>
static negator<N> SimTK::negator< NUMBER >::getNaN ( )
inlinestatic

◆ getInfinity()

template<class NUMBER>
static negator<N> SimTK::negator< NUMBER >::getInfinity ( )
inlinestatic

◆ isFinite()

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

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

◆ isNaN()

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

Returns true if the negated value contains a NaN.

◆ isInf()

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.

◆ getDefaultTolerance()

template<class NUMBER>
static double SimTK::negator< NUMBER >::getDefaultTolerance ( )
inlinestatic

◆ isNumericallyEqual() [1/4]

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.

◆ isNumericallyEqual() [2/4]

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.

◆ isNumericallyEqual() [3/4]

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.

◆ isNumericallyEqual() [4/4]

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.

◆ operator=() [1/3]

template<class NUMBER>
negator& SimTK::negator< NUMBER >::operator= ( const negator< NUMBER > &  n)
inline

◆ recast()

template<class NUMBER>
static const negator<N>& SimTK::negator< NUMBER >::recast ( const N &  val)
inlinestatic

◆ operator-() [1/2]

template<class NUMBER>
const N& SimTK::negator< NUMBER >::operator- ( ) const
inline

◆ operator-() [2/2]

template<class NUMBER>
N& SimTK::negator< NUMBER >::operator- ( )
inline

◆ operator+()

template<class NUMBER>
N SimTK::negator< NUMBER >::operator+ ( ) const
inline

◆ operator N()

template<class NUMBER>
SimTK::negator< NUMBER >::operator N ( ) const
inline

◆ operator=() [2/3]

template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator= ( const P &  t)
inline

◆ operator+=() [1/2]

template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator+= ( const P &  t)
inline

◆ operator-=() [1/2]

template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator-= ( const P &  t)
inline

◆ operator*=()

template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator*= ( const P &  t)
inline

◆ operator/=()

template<class NUMBER>
template<class P >
negator& SimTK::negator< NUMBER >::operator/= ( const P &  t)
inline

◆ operator=() [3/3]

template<class NUMBER>
template<class NN >
negator& SimTK::negator< NUMBER >::operator= ( const negator< NN > &  t)
inline

◆ operator+=() [2/2]

template<class NUMBER>
template<class NN >
negator& SimTK::negator< NUMBER >::operator+= ( const negator< NN > &  t)
inline

◆ operator-=() [2/2]

template<class NUMBER>
template<class NN >
negator& SimTK::negator< NUMBER >::operator-= ( const negator< NN > &  t)
inline

Friends And Related Function Documentation

◆ negator

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

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