Simbody  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
negator.h File Reference

This file defines the negator<N> template which is an adaptor for the numeric types N (Real, Complex, conjugate). More...

#include <iostream>

Go to the source code of this file.

Classes

class  SimTK::CNT< K >
 Specialized information about Composite Numerical Types which allows us to define appropriate templatized classes using them. More...
 
class  SimTK::NTraits< 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. More...
 
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. More...
 
struct  SimTK::negator< N >::Result< P >
 
struct  SimTK::negator< N >::Substitute< P >
 

Namespaces

 SimTK
 This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with other symbols.
 

Functions

bool SimTK::isNaN (const negator< float > &x)
 
bool SimTK::isNaN (const negator< double > &x)
 
bool SimTK::isNaN (const negator< long double > &x)
 
template<class P >
bool SimTK::isNaN (const negator< std::complex< P > > &x)
 
template<class P >
bool SimTK::isNaN (const negator< conjugate< P > > &x)
 
bool SimTK::isFinite (const negator< float > &x)
 
bool SimTK::isFinite (const negator< double > &x)
 
bool SimTK::isFinite (const negator< long double > &x)
 
template<class P >
bool SimTK::isFinite (const negator< std::complex< P > > &x)
 
template<class P >
bool SimTK::isFinite (const negator< conjugate< P > > &x)
 
bool SimTK::isInf (const negator< float > &x)
 
bool SimTK::isInf (const negator< double > &x)
 
bool SimTK::isInf (const negator< long double > &x)
 
template<class P >
bool SimTK::isInf (const negator< std::complex< P > > &x)
 
template<class P >
bool SimTK::isInf (const negator< conjugate< P > > &x)
 
template<class DEST , class SRC >
static const DEST & SimTK::negRecast (const SRC &s)
 
template<class A , class B >
negator< A >::template Result
< B >::Add 
SimTK::operator+ (const negator< A > &l, const B &r)
 
template<class A , class B >
CNT< A >::template Result
< negator< B > >::Add 
SimTK::operator+ (const A &l, const negator< B > &r)
 
template<class A , class B >
negator< A >::template Result
< negator< B > >::Add 
SimTK::operator+ (const negator< A > &l, const negator< B > &r)
 
template<class A , class B >
negator< A >::template Result
< B >::Sub 
SimTK::operator- (const negator< A > &l, const B &r)
 
template<class A , class B >
CNT< A >::template Result
< negator< B > >::Sub 
SimTK::operator- (const A &l, const negator< B > &r)
 
template<class A , class B >
negator< A >::template Result
< negator< B > >::Sub 
SimTK::operator- (const negator< A > &l, const negator< B > &r)
 
template<class A , class B >
negator< A >::template Result
< B >::Mul 
SimTK::operator* (const negator< A > &l, const B &r)
 
template<class A , class B >
CNT< A >::template Result
< negator< B > >::Mul 
SimTK::operator* (const A &l, const negator< B > &r)
 
template<class A , class B >
negator< A >::template Result
< negator< B > >::Mul 
SimTK::operator* (const negator< A > &l, const negator< B > &r)
 
template<class A , class B >
negator< A >::template Result
< B >::Dvd 
SimTK::operator/ (const negator< A > &l, const B &r)
 
template<class A , class B >
CNT< A >::template Result
< negator< B > >::Dvd 
SimTK::operator/ (const A &l, const negator< B > &r)
 
template<class A , class B >
negator< A >::template Result
< negator< B > >::Dvd 
SimTK::operator/ (const negator< A > &l, const negator< B > &r)
 
template<class A , class B >
bool SimTK::operator== (const negator< A > &l, const B &r)
 
template<class A , class B >
bool SimTK::operator== (const A &l, const negator< B > &r)
 
template<class A , class B >
bool SimTK::operator== (const negator< A > &l, const negator< B > &r)
 
template<class A , class B >
bool SimTK::operator!= (const negator< A > &l, const B &r)
 
template<class A , class B >
bool SimTK::operator!= (const A &l, const negator< B > &r)
 
template<class A , class B >
bool SimTK::operator!= (const negator< A > &l, const negator< B > &r)
 
template<class NUM , class CHAR , class TRAITS >
std::basic_istream< CHAR,
TRAITS > & 
SimTK::operator>> (std::basic_istream< CHAR, TRAITS > &is, negator< NUM > &nn)
 
template<class NUM , class CHAR , class TRAITS >
std::basic_ostream< CHAR,
TRAITS > & 
SimTK::operator<< (std::basic_ostream< CHAR, TRAITS > &os, const negator< NUM > &nn)
 

Detailed Description

This file defines the negator<N> template which is an adaptor for the numeric types N (Real, Complex, conjugate).

negator must NOT be instantiated for anything other than these three types (each of which comes in three precisions). negator<N> is guaranteed to have the same memory layout as N, except that the stored values represent the *negative* value of that number.

This is part of the SimTK Scalar package, which forms the basis for composite numerical types like vectors and matrices. The negator class allows negation to be performed by reinterpretation rather than by computation.

*
* 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>   ::= std::complex< <real> >
* <conjugate> ::= SimTK::conjugate< <real> >
*
*