Simbody 3.7
Loading...
Searching...
No Matches
SimTK::negator< N > 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...

#include <negator.h>

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).
 
bool isNaN () const
 Returns true if the negated value contains a NaN.
 
bool isInf () const
 Returns true if the negated value contains an Inf or -Inf and does not contain a NaN.
 
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.
 
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.
 
template<class T2 >
bool isNumericallyEqual (const T2 &t2, double tol) const
 This is the generic case (see above) but with an explicitly-provided tolerance.
 
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.
 
 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 N>
class SimTK::negator< N >

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 N >
negator<N> SimTK::negator< N >::T

◆ TNeg

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

◆ TWithoutNegator

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

◆ TReal

template<class N >
CNT<NReal>::TNeg SimTK::negator< N >::TReal

◆ TImag

template<class N >
CNT<NImag>::TNeg SimTK::negator< N >::TImag

◆ TComplex

template<class N >
CNT<NComplex>::TNeg SimTK::negator< N >::TComplex

◆ THerm

template<class N >
CNT<NHerm>::TNeg SimTK::negator< N >::THerm

◆ TPosTrans

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

◆ TSqHermT

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

◆ TSqTHerm

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

◆ TElement

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

◆ TRow

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

◆ TCol

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

◆ TSqrt

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

◆ TAbs

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

◆ TStandard

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

◆ TInvert

template<class N >
CNT<NInvert>::TNeg SimTK::negator< N >::TInvert

◆ TNormalize

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

◆ Scalar

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

◆ ULessScalar

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

◆ Number

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

◆ StdNumber

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

◆ Precision

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

◆ ScalarNormSq

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

Member Enumeration Documentation

◆ anonymous enum

template<class N >
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 N >
SimTK::negator< N >::negator ( )
inline

◆ negator() [2/7]

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

◆ negator() [3/7]

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

◆ negator() [4/7]

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

◆ negator() [5/7]

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

◆ negator() [6/7]

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

◆ negator() [7/7]

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

Member Function Documentation

◆ getData()

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

◆ updData()

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

◆ real() [1/2]

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

◆ real() [2/2]

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

◆ imag() [1/2]

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

◆ imag() [2/2]

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

◆ scalarNormSqr()

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

◆ sqrt()

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

◆ abs()

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

◆ standardize()

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

◆ normalize()

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

◆ invert()

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

◆ getNaN()

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

◆ getInfinity()

template<class N >
static negator< N > SimTK::negator< N >::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 N >
static double SimTK::negator< N >::getDefaultTolerance ( )
inlinestatic

◆ isNumericallyEqual() [1/4]

template<class N >
template<class T2 >
bool SimTK::negator< N >::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 N >
template<class N2 >
bool SimTK::negator< N >::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 N >
template<class T2 >
bool SimTK::negator< N >::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 N >
template<class N2 >
bool SimTK::negator< N >::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 N >
negator & SimTK::negator< N >::operator= ( const negator< N > & n)
inline

◆ recast()

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

◆ operator-() [1/2]

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

◆ operator-() [2/2]

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

◆ operator+()

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

◆ operator N()

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

◆ operator=() [2/3]

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

◆ operator+=() [1/2]

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

◆ operator-=() [1/2]

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

◆ operator*=()

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

◆ operator/=()

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

◆ operator=() [3/3]

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

◆ operator+=() [2/2]

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

◆ operator-=() [2/2]

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

Friends And Related Symbol Documentation

◆ negator

template<class N >
template<class N2 >
friend class negator
friend

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