negator.h File Reference


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

#include <iostream>

Go to the source code of this file.

Namespaces

namespace  SimTK

Classes

class  negator
 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  negator::Result
struct  negator::Substitute

Functions

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)


Generated on Thu Feb 28 01:34:34 2008 for SimTKcommon by  doxygen 1.4.7