NTraits.h File Reference


Detailed Description

This file contains classes and typedefs needed to provide uniform handling of floating point numeric values.

There are three numeric classes: real, complex, conjugate and each comes in float, double, and long double precision. Each of these may be modified by a negator, which does not change the in-memory *representation* but negates the *interpretation*. Thus there are 18 distinct scalar types: 3 precisions each of real, complex, and conjugate and their negators.

The Scalar Types ---------------- Here is a complete taxonomy of the scalar types we support.

<scalar> ::= <number> | negator< <number> > <number> ::= <standard> | <conjugate> <standard> ::= <real> | <complex>

<real> ::= float | double | long double <complex> ::= complex< <real> > <conjugate> ::= conjugate< <real> >

#include <cstddef>
#include <cassert>
#include <complex>
#include <iostream>
#include <limits>

Go to the source code of this file.

Namespaces

namespace  SimTK

Classes

struct  Widest
struct  Widest< float, float >
struct  Widest< float, double >
struct  Widest< float, long double >
struct  Widest< double, float >
struct  Widest< double, double >
struct  Widest< double, long double >
struct  Widest< long double, float >
struct  Widest< long double, double >
struct  Widest< long double, long double >
struct  Widest< complex< R1 >, complex< R2 > >
struct  Widest< complex< R1 >, R2 >
struct  Widest< R1, complex< R2 > >
class  NTraits
class  NTraits< complex< R > >
 Partial specialization for complex numbers -- underlying real R is still a template parameter. More...
struct  NTraits< complex< R > >::Result
struct  NTraits< complex< R > >::Substitute
class  NTraits< conjugate< R > >
struct  NTraits< conjugate< R > >::Result
struct  NTraits< conjugate< R > >::Substitute
class  CNT< complex< R > >
 Specializations of CNT for numeric types. More...
class  CNT< conjugate< R > >
class  CNT< float >
class  CNT< double >
class  CNT< long double >

Defines

#define SimTK_BNTCMPLX_SPEC(T1, T2)
#define SimTK_NTRAITS_CONJ_SPEC(T1, T2)
#define SimTK_DEFINE_REAL_NTRAITS(R)

Functions

 SimTK_BNTCMPLX_SPEC (float, float)
 SimTK_BNTCMPLX_SPEC (float, double)
 SimTK_BNTCMPLX_SPEC (float, long double)
 SimTK_BNTCMPLX_SPEC (double, float)
 SimTK_BNTCMPLX_SPEC (double, double)
 SimTK_BNTCMPLX_SPEC (double, long double)
 SimTK_BNTCMPLX_SPEC (long double, float)
 SimTK_BNTCMPLX_SPEC (long double, double)
 SimTK_BNTCMPLX_SPEC (long double, long double)
 SimTK_NTRAITS_CONJ_SPEC (float, float)
 SimTK_NTRAITS_CONJ_SPEC (float, double)
 SimTK_NTRAITS_CONJ_SPEC (float, long double)
 SimTK_NTRAITS_CONJ_SPEC (double, float)
 SimTK_NTRAITS_CONJ_SPEC (double, double)
 SimTK_NTRAITS_CONJ_SPEC (double, long double)
 SimTK_NTRAITS_CONJ_SPEC (long double, float)
 SimTK_NTRAITS_CONJ_SPEC (long double, double)
 SimTK_NTRAITS_CONJ_SPEC (long double, long double)
 SimTK_DEFINE_REAL_NTRAITS (float)
 SimTK_DEFINE_REAL_NTRAITS (double)
 SimTK_DEFINE_REAL_NTRAITS (long double)


Define Documentation

#define SimTK_BNTCMPLX_SPEC ( T1,
T2   ) 

Value:

template<> template<> struct NTraits< complex<T1> >::Result<T2> {      \
    typedef Widest< complex<T1>,T2 >::Type W;                      \
    typedef W Mul; typedef W Dvd; typedef W Add; typedef W Sub;         \
};                                                                      \
template<> template<> struct NTraits< complex<T1> >::Result< complex<T2> > {  \
    typedef Widest< complex<T1>,complex<T2> >::Type W;        \
    typedef W Mul; typedef W Dvd; typedef W Add; typedef W Sub;         \
};                                                                      \
template<> template<> struct NTraits< complex<T1> >::Result< conjugate<T2> > {  \
    typedef Widest< complex<T1>,complex<T2> >::Type W;        \
    typedef W Mul; typedef W Dvd; typedef W Add; typedef W Sub;         \
}

#define SimTK_DEFINE_REAL_NTRAITS (  ) 

#define SimTK_NTRAITS_CONJ_SPEC ( T1,
T2   ) 

Value:

template<> template<> struct NTraits< conjugate<T1> >::Result<T2> {         \
  typedef conjugate<Widest<T1,T2>::Type> W;                                 \
  typedef W Mul; typedef W Dvd; typedef W Add; typedef W Sub;               \
};                                                                          \
template<> template<> struct NTraits< conjugate<T1> >::Result<complex<T2> >{\
  typedef Widest<complex<T1>,complex<T2> >::Type W;               \
  typedef W Mul; typedef W Dvd; typedef W Add; typedef negator<W> Sub;      \
};                                                                          \
template<> template<> struct NTraits< conjugate<T1> >::Result<conjugate<T2> >{\
    typedef Widest<T1,T2>::Type W; typedef complex<W> WC;              \
    typedef negator<WC> Mul; typedef WC Dvd; typedef conjugate<W> Add; typedef WC Sub;\
}


Generated on Fri Sep 26 07:44:21 2008 for SimTKcore by  doxygen 1.5.6