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...

#include <negator.h>

List of all members.

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

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

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

Member Enumeration Documentation

anonymous enum
Enumerator:
NRows 
NCols 
RowSpacing 
ColSpacing 
NPackedElements 
NActualElements 
NActualScalars 
ImagOffset 
RealStrideFactor 
ArgDepth 
IsScalar 
IsULessScalar 
IsNumber 
IsStdNumber 
IsPrecision 
SignInterpretation 

Constructor & Destructor Documentation

negator (  )  [inline]
negator ( const negator< NUMBER > &  n  )  [inline]
negator ( int  t  )  [inline, explicit]
negator ( const float &  t  )  [inline, explicit]
negator ( const double &  t  )  [inline, explicit]
negator ( const long double &  t  )  [inline, explicit]
negator ( const std::complex< P > &  t  )  [inline, explicit]
negator ( const conjugate< P > &  t  )  [inline, explicit]

Member Function Documentation

TAbs abs (  )  const [inline]

References SimTK::abs().

const negator<N>* getData (  )  const [inline]
static double getDefaultTolerance (  )  [inline, static]
static negator<N> getInfinity (  )  [inline, static]
static negator<N> getNaN (  )  [inline, static]
TImag& imag (  )  [inline]

References SimTK::imag().

const TImag& imag (  )  const [inline]

References SimTK::imag().

TInvert invert (  )  const [inline]
bool isFinite (  )  const [inline]

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

bool isInf (  )  const [inline]

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

bool isNaN (  )  const [inline]

Returns true if the negated value contains a NaN.

bool isNumericallyEqual ( const negator< N2 > &  t2,
double  tol 
) const [inline]

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

References SimTK::isNumericallyEqual().

bool isNumericallyEqual ( const T2 &  t2,
double  tol 
) const [inline]

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

References SimTK::isNumericallyEqual().

bool 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.

References SimTK::isNumericallyEqual().

bool 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.

References SimTK::isNumericallyEqual().

TNormalize normalize (  )  const [inline]
operator N (  )  const [inline]
negator& operator*= ( const P &  t  )  [inline]
N operator+ (  )  const [inline]
negator& operator+= ( const negator< NN > &  t  )  [inline]
negator& operator+= ( const P &  t  )  [inline]
N& operator- (  )  [inline]
const N& operator- (  )  const [inline]
negator& operator-= ( const negator< NN > &  t  )  [inline]
negator& operator-= ( const P &  t  )  [inline]
negator& operator/= ( const P &  t  )  [inline]
negator& operator= ( const negator< NN > &  t  )  [inline]
negator& operator= ( const P &  t  )  [inline]
negator& operator= ( const negator< NUMBER > &  n  )  [inline]
TReal& real (  )  [inline]

References SimTK::real().

const TReal& real (  )  const [inline]

References SimTK::real().

static const negator<N>& recast ( const N &  val  )  [inline, static]

Referenced by SimTK::cube().

ScalarNormSq scalarNormSqr (  )  const [inline]
TSqrt sqrt (  )  const [inline]
TStandard standardize (  )  const [inline]
negator<N>* updData (  )  [inline]

Friends And Related Function Documentation

friend class negator [friend]

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

Generated on Wed Dec 30 11:05:27 2009 for SimTKcore by  doxygen 1.6.1