1 #ifndef SimTK_SIMMATRIX_COMPOSITE_NUMERICAL_TYPES_H_
2 #define SimTK_SIMMATRIX_COMPOSITE_NUMERICAL_TYPES_H_
136 template <
class K>
class CNT :
private K {
200 static const Scalar*
getData(
const T& t) {
return t.getData(); }
201 static Scalar*
updData(T& t) {
return t.updData(); }
203 static const TReal&
real(
const T& t) {
return t.real(); }
204 static TReal&
real(T& t) {
return t.real(); }
205 static const TImag&
imag(
const T& t) {
return t.imag(); }
206 static TImag&
imag(T& t) {
return t.imag(); }
212 {
return reinterpret_cast<const TNeg&
>(t); }
214 {
return reinterpret_cast<TNeg&
>(t); }
217 {
return reinterpret_cast<const THerm&
>(t); }
219 {
return reinterpret_cast<THerm&
>(t); }
222 {
return reinterpret_cast<const TPosTrans&
>(t); }
224 {
return reinterpret_cast<TPosTrans&
>(t); }
233 {
return reinterpret_cast<const TWithoutNegator&
>(t);}
235 {
return reinterpret_cast<TWithoutNegator&
>(t);}
239 static TSqrt
sqrt(
const K& t) {
return t.sqrt();}
240 static TAbs
abs(
const K& t) {
return t.abs();}
241 static TStandard
standardize(
const K& t) {
return t.standardize();}
242 static TNormalize
normalize(
const K& t) {
return t.normalize();}
243 static TInvert
invert(
const K& t) {
return t.invert();}
249 static bool isNaN(
const K& t) {
return t.isNaN();}
252 static bool isInf(
const K& t) {
return t.isInf();}
254 static bool isFinite(
const K& t) {
return t.isFinite();}
263 template <
class K2>
static bool
265 {
return t1.isNumericallyEqual(t2);}
266 template <
class K2>
static bool
268 {
return t1.isNumericallyEqual(t2,tol);}
275 #endif // SimTK_SIMMATRIX_COMPOSITE_NUMERICAL_TYPES_H_
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
K::ULessScalar ULessScalar
Definition: CompositeNumericalTypes.h:161
K::TReal TReal
Definition: CompositeNumericalTypes.h:141
Definition: CompositeNumericalTypes.h:117
static TNormalize normalize(const K &t)
Definition: CompositeNumericalTypes.h:242
static THerm & transpose(K &t)
Definition: CompositeNumericalTypes.h:218
static const THerm & transpose(const K &t)
Definition: CompositeNumericalTypes.h:216
Definition: CompositeNumericalTypes.h:195
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
K::TSqrt TSqrt
Definition: CompositeNumericalTypes.h:154
static TImag & imag(T &t)
Definition: CompositeNumericalTypes.h:206
static K getInfinity()
Definition: CompositeNumericalTypes.h:245
static TSqrt sqrt(const K &t)
Definition: CompositeNumericalTypes.h:239
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
Definition: CompositeNumericalTypes.h:188
K::template Result< P >::Mul Mul
Definition: CompositeNumericalTypes.h:170
K::TNormalize TNormalize
Definition: CompositeNumericalTypes.h:158
Definition: CompositeNumericalTypes.h:193
K::template Result< P >::Sub Sub
Definition: CompositeNumericalTypes.h:173
static TPosTrans & positionalTranspose(K &t)
Definition: CompositeNumericalTypes.h:223
K::TImag TImag
Definition: CompositeNumericalTypes.h:142
static TInvert invert(const K &t)
Definition: CompositeNumericalTypes.h:243
Definition: CompositeNumericalTypes.h:120
K::TCol TCol
Definition: CompositeNumericalTypes.h:150
static ScalarNormSq scalarNormSqr(const K &t)
Definition: CompositeNumericalTypes.h:237
static double getDefaultTolerance()
Definition: CompositeNumericalTypes.h:269
K::TElement TElement
Definition: CompositeNumericalTypes.h:148
static TStandard standardize(const K &t)
Definition: CompositeNumericalTypes.h:241
static bool isNumericallyEqual(const K &t1, const K2 &t2)
CNTs are expected to support an "==" operator for exact, bitwise equality.
Definition: CompositeNumericalTypes.h:264
static bool isInf(const K &t)
This is true if at least one element contains a +Infinity or -Infinity and no element contains a NaN...
Definition: CompositeNumericalTypes.h:252
Definition: CompositeNumericalTypes.h:184
static Scalar * updData(T &t)
Definition: CompositeNumericalTypes.h:201
Definition: CompositeNumericalTypes.h:116
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
static bool isNaN(const K &t)
This is true if any element contains a NaN anywhere.
Definition: CompositeNumericalTypes.h:249
Definition: CompositeNumericalTypes.h:189
K::Precision Precision
Definition: CompositeNumericalTypes.h:164
K::template Result< P >::Dvd Dvd
Definition: CompositeNumericalTypes.h:171
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
static bool isNumericallyEqual(const K &t1, const K2 &t2, double tol)
Definition: CompositeNumericalTypes.h:267
K::template Result< P >::Add Add
Definition: CompositeNumericalTypes.h:172
Definition: CompositeNumericalTypes.h:196
Definition: CompositeNumericalTypes.h:183
Definition: CompositeNumericalTypes.h:169
K::template Substitute< P >::Type Type
Definition: CompositeNumericalTypes.h:178
Definition: CompositeNumericalTypes.h:191
static const TPosTrans & positionalTranspose(const K &t)
Definition: CompositeNumericalTypes.h:221
K::TPosTrans TPosTrans
Definition: CompositeNumericalTypes.h:145
Definition: CompositeNumericalTypes.h:182
static TNeg & negate(T &t)
Definition: CompositeNumericalTypes.h:213
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
Definition: CompositeNumericalTypes.h:187
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
static TWithoutNegator & updCastAwayNegatorIfAny(T &t)
Definition: CompositeNumericalTypes.h:234
static TReal & real(T &t)
Definition: CompositeNumericalTypes.h:204
K T
Definition: CompositeNumericalTypes.h:138
Definition: CompositeNumericalTypes.h:177
Mandatory first inclusion for any Simbody source or header file.
static const TWithoutNegator & castAwayNegatorIfAny(const T &t)
Definition: CompositeNumericalTypes.h:232
Definition: CompositeNumericalTypes.h:197
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
Definition: CompositeNumericalTypes.h:185
K::TWithoutNegator TWithoutNegator
Definition: CompositeNumericalTypes.h:140
static bool isFinite(const K &t)
This is true only if no element has any entry that it NaN or Infinity.
Definition: CompositeNumericalTypes.h:254
Definition: CompositeNumericalTypes.h:194
Definition: CompositeNumericalTypes.h:190
K::TRow TRow
Definition: CompositeNumericalTypes.h:149
static const TImag & imag(const T &t)
Definition: CompositeNumericalTypes.h:205
K::TComplex TComplex
Definition: CompositeNumericalTypes.h:143
Definition: CompositeNumericalTypes.h:192
K::Number Number
Definition: CompositeNumericalTypes.h:162
static TAbs abs(const K &t)
Definition: CompositeNumericalTypes.h:240
Definition: CompositeNumericalTypes.h:118
static K getNaN()
Definition: CompositeNumericalTypes.h:246
static const Scalar * getData(const T &t)
Definition: CompositeNumericalTypes.h:200
static const TNeg & negate(const T &t)
Definition: CompositeNumericalTypes.h:211
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
static const TReal & real(const T &t)
Definition: CompositeNumericalTypes.h:203
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
Definition: CompositeNumericalTypes.h:119
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
Definition: CompositeNumericalTypes.h:186