1 #ifndef SimTK_SIMMATRIX_NEGATOR_H_     2 #define SimTK_SIMMATRIX_NEGATOR_H_    63 template <
class T> 
class CNT;
    65 template <
class N> 
class negator;   
    74 template <
class NUMBER> 
   155         SignInterpretation  = -1 
   183     inline bool isNaN() 
const;
   186     inline bool isInf() 
const;
   229     template <
class P> 
negator(
const std::complex<P>& t) {v = -N(t);}
   237     {   
return reinterpret_cast<const negator<N>&
>(val); }
   243     operator N()
 const { 
return N(-v); } 
   245     template <
class P> 
negator& operator =(
const P& t) { v = -t; 
return *
this; }
   256     {   v =  -t; 
return *
this; }
   258     {   v += -t; 
return *
this; } 
   260     {   v -= -t; 
return *
this; }
   276 template <
class P> 
inline bool   278 template <
class P> 
inline bool   290 template <
class P> 
inline bool   292 template <
class P> 
inline bool   304 template <
class P> 
inline bool   306 template <
class P> 
inline bool   311 template <
class N> 
inline bool   313 template <
class N> 
inline bool   315 template <
class N> 
inline bool   329 template <
class DEST, 
class SRC> 
static inline const DEST&
   330 negRecast(
const SRC& s) { 
return reinterpret_cast<const DEST&
>(s); }
   335   {
return negRecast<typename negator<A>::template Result<B>::Add>(r-(-l));}
   336 template <
class A, 
class B> 
inline typename CNT<A>::template Result<negator<B> >::Add
   338   {
return negRecast<typename CNT<A>::template Result<negator<B> >::Add>(l-(-r));}
   342   {
return negRecast<typename negator<A>::template Result<negator<B> >::Add>(r-(-l)); }
   347   {
return negRecast<typename negator<A>::template Result<B>::Sub>(r+(-l));}
   348 template <
class A, 
class B> 
inline typename CNT<A>::template Result<negator<B> >::Sub
   350   {
return negRecast<typename CNT<A>::template Result<negator<B> >::Sub>(l+(-r));}
   354   {
return negRecast<typename negator<A>::template Result<negator<B> >::Sub>(r+(-l));}
   359   {
return negRecast<typename negator<A>::template Result<B>::Mul>((-l)*r);}
   360 template <
class A, 
class B> 
inline typename CNT<A>::template Result<negator<B> >::Mul
   362   {
return negRecast<typename CNT<A>::template Result<negator<B> >::Mul>(l*(-r));}
   366   {
return negRecast<typename negator<A>::template Result<negator<B> >::Mul>((-l)*r);}
   371   {
return negRecast<typename negator<A>::template Result<B>::Dvd>((-l)/r);}
   372 template <
class A, 
class B> 
inline typename CNT<A>::template Result<negator<B> >::Dvd
   374   {
return negRecast<typename CNT<A>::template Result<negator<B> >::Dvd>(l/(-r));}
   378   {
return negRecast<typename negator<A>::template Result<negator<B> >::Dvd>((-l)/r);}
   381 template <
class A, 
class B> 
inline bool   383 template <
class A, 
class B> 
inline bool   385 template <
class A, 
class B> 
inline bool   389 template <
class A, 
class B> 
inline bool   391 template <
class A, 
class B> 
inline bool   393 template <
class A, 
class B> 
inline bool   397 template <
class NUM, 
class CHAR, 
class TRAITS> 
inline std::basic_istream<CHAR,TRAITS>&
   399     NUM z; is >> z; nn=z;
   402 template <
class NUM, 
class CHAR, 
class TRAITS> 
inline std::basic_ostream<CHAR,TRAITS>&
   403 operator<<(std::basic_ostream<CHAR,TRAITS>& os, 
const negator<NUM>& nn) {
   404     return os << NUM(nn);
   409 #endif //SimTK_SIMMATRIX_NEGATOR_H_ Matrix_< E > operator/(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:613
 
TImag & imag()
Definition: negator.h:163
 
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:218
 
NUMBER TWithoutNegator
Definition: negator.h:85
 
negator & operator/=(const P &t)
Definition: negator.h:249
 
negator< N > TElement
Definition: negator.h:93
 
PAdd Add
Definition: negator.h:130
 
negator< N > TCol
Definition: negator.h:95
 
CNT< PDvd >::TNeg Dvd
Definition: negator.h:129
 
static negator< N > getInfinity()
Definition: negator.h:178
 
negator< N > ULessScalar
Definition: negator.h:105
 
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
 
NTraits< N >::StdNumber StdNumber
Definition: negator.h:107
 
SimTK::conjugate<R> should be instantiated only for float, double, long double. 
Definition: String.h:45
 
negator< N > * updData()
Definition: negator.h:158
 
Matrix_< typename CNT< E1 >::template Result< E2 >::Sub > operator-(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:584
 
negator(int t)
Definition: negator.h:222
 
TReal & real()
Definition: negator.h:161
 
negator(const long double &t)
Definition: negator.h:225
 
const TImag & imag() const 
Definition: negator.h:162
 
NUMBER TNeg
Definition: negator.h:84
 
std::basic_istream< CHAR, TRAITS > & operator>>(std::basic_istream< CHAR, TRAITS > &is, conjugate< R > &c)
Definition: conjugate.h:800
 
negator< N > TRow
Definition: negator.h:94
 
negator<N>, where N is a number type (real, complex, conjugate), is represented in memory identically...
Definition: String.h:44
 
NUMBER Number
Definition: negator.h:106
 
static negator< N > getNaN()
Definition: negator.h:177
 
bool operator==(const PhiMatrix &p1, const PhiMatrix &p2)
Definition: SpatialAlgebra.h:774
 
ScalarNormSq scalarNormSqr() const 
Definition: negator.h:165
 
static bool isNumericallyEqual(const K &t1, const K2 &t2)
CNTs are expected to support an "==" operator for exact, bitwise equality. 
Definition: CompositeNumericalTypes.h:264
 
negator(const std::complex< P > &t)
Definition: negator.h:229
 
NTraits< N >::ScalarNormSq ScalarNormSq
Definition: negator.h:109
 
bool isFinite(const negator< float > &x)
Definition: negator.h:287
 
Definition: CompositeNumericalTypes.h:116
 
CNT< NImag >::TNeg TImag
Definition: negator.h:87
 
bool isInf() const 
Returns true if the negated value contains an Inf or -Inf and does not contain a NaN. 
Definition: negator.h:316
 
NTraits< N >::TSqHermT TSqHermT
Definition: negator.h:91
 
TNormalize normalize() const 
Definition: negator.h:169
 
Matrix_< E > operator*(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:605
 
static const DEST & negRecast(const SRC &s)
Definition: negator.h:330
 
CNT< NHerm >::TNeg THerm
Definition: negator.h:89
 
const negator< N > * getData() const 
Definition: negator.h:157
 
negator & operator+=(const P &t)
Definition: negator.h:246
 
bool isNaN() const 
Returns true if the negated value contains a NaN. 
Definition: negator.h:314
 
const TReal & real() const 
Definition: negator.h:160
 
negator< N > TPosTrans
Definition: negator.h:90
 
bool isNumericallyEqual(const negator< N2 > &t2) const 
In this partial specialization we know that both types have negators so we can just compare the under...
Definition: negator.h:198
 
NTraits< N >::TAbs TAbs
Definition: negator.h:98
 
negator()
Definition: negator.h:211
 
Definition: negator.h:135
 
CNT< NReal >::TNeg TReal
Definition: negator.h:86
 
const float & real(const conjugate< float > &c)
Definition: conjugate.h:771
 
negator & operator*=(const P &t)
Definition: negator.h:248
 
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 t...
Definition: negator.h:192
 
RowVectorBase< typename CNT< ELEM >::TAbs > abs(const RowVectorBase< ELEM > &v)
Definition: VectorMath.h:120
 
bool isNaN(const negator< float > &x)
Definition: negator.h:273
 
bool operator!=(const conjugate< R > &a, const float &b)
Definition: conjugate.h:859
 
negator(const negator &n)
Definition: negator.h:216
 
negator< N > Scalar
Definition: negator.h:104
 
Definition: negator.h:119
 
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
 
bool isNumericallyEqual(const negator< N2 > &t2, double tol) const 
This is the partially specialized case again (see above) but with an explicitly-provided tolerance...
Definition: negator.h:207
 
bool isInf(const negator< float > &x)
Definition: negator.h:301
 
NTraits< N >::TStandard TNormalize
Definition: negator.h:101
 
const N & operator-() const 
Definition: negator.h:239
 
static const negator< N > & recast(const N &val)
Definition: negator.h:236
 
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
 
CNT< NInvert >::TNeg TInvert
Definition: negator.h:100
 
Matrix_< typename CNT< E1 >::template Result< E2 >::Add > operator+(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:568
 
CNT< PMul >::TNeg Mul
Definition: negator.h:128
 
NTraits< N >::TStandard TStandard
Definition: negator.h:99
 
negator & operator+=(const negator< NN > &t)
Definition: negator.h:257
 
NTraits< N >::TSqTHerm TSqTHerm
Definition: negator.h:92
 
negator(const float &t)
Definition: negator.h:223
 
const negator< float > & imag(const conjugate< float > &c)
Definition: conjugate.h:772
 
CNT< NComplex >::TNeg TComplex
Definition: negator.h:88
 
N operator+() const 
Definition: negator.h:241
 
TStandard standardize() const 
Definition: negator.h:168
 
bool isFinite() const 
Returns true if the negated value is finite (i.e., not NaN or Inf). 
Definition: negator.h:312
 
TInvert invert() const 
Definition: negator.h:175
 
negator(const double &t)
Definition: negator.h:224
 
CNT< PSub >::TNeg Sub
Definition: negator.h:131
 
TAbs abs() const 
Definition: negator.h:167
 
bool isNumericallyEqual(const T2 &t2, double tol) const 
This is the generic case (see above) but with an explicitly-provided tolerance. 
Definition: negator.h:202
 
static double getDefaultTolerance()
Definition: negator.h:188
 
negator & operator-=(const P &t)
Definition: negator.h:247
 
TSqrt sqrt() const 
Definition: negator.h:166
 
negator< N > T
Definition: negator.h:83
 
N & operator-()
Definition: negator.h:240
 
NTraits< N >::Precision Precision
Definition: negator.h:108
 
negator & operator-=(const negator< NN > &t)
Definition: negator.h:259
 
negator(const conjugate< P > &t)
Definition: negator.h:230
 
bool isNumericallyEqual(const float &a, const float &b, double tol=RTraits< float >::getDefaultTolerance())
Compare two floats for approximate equality. 
Definition: NTraits.h:313
 
NTraits< N >::TSqrt TSqrt
Definition: negator.h:97
 
negator & operator=(const negator &n)
Definition: negator.h:217
 
P Type
Definition: negator.h:136