Simbody  3.7
Scalar.h File Reference

This is a user-includable header which includes everything needed to make use of SimMatrix Scalar code. More...

Go to the source code of this file.

Namespaces

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

Typedefs

typedef conjugate< Real > SimTK::Conjugate
 

Functions

bool SimTK::atMostOneBitIsSet (unsigned char v)
 
bool SimTK::atMostOneBitIsSet (unsigned short v)
 
bool SimTK::atMostOneBitIsSet (unsigned int v)
 
bool SimTK::atMostOneBitIsSet (unsigned long v)
 
bool SimTK::atMostOneBitIsSet (unsigned long long v)
 
bool SimTK::atMostOneBitIsSet (signed char v)
 
bool SimTK::atMostOneBitIsSet (char v)
 
bool SimTK::atMostOneBitIsSet (short v)
 
bool SimTK::atMostOneBitIsSet (int v)
 
bool SimTK::atMostOneBitIsSet (long v)
 
bool SimTK::atMostOneBitIsSet (long long v)
 
bool SimTK::exactlyOneBitIsSet (unsigned char v)
 
bool SimTK::exactlyOneBitIsSet (unsigned short v)
 
bool SimTK::exactlyOneBitIsSet (unsigned int v)
 
bool SimTK::exactlyOneBitIsSet (unsigned long v)
 
bool SimTK::exactlyOneBitIsSet (unsigned long long v)
 
bool SimTK::exactlyOneBitIsSet (signed char v)
 
bool SimTK::exactlyOneBitIsSet (char v)
 
bool SimTK::exactlyOneBitIsSet (short v)
 
bool SimTK::exactlyOneBitIsSet (int v)
 
bool SimTK::exactlyOneBitIsSet (long v)
 
bool SimTK::exactlyOneBitIsSet (long long v)
 
bool SimTK::signBit (unsigned char u)
 
bool SimTK::signBit (unsigned short u)
 
bool SimTK::signBit (unsigned int u)
 
bool SimTK::signBit (unsigned long u)
 
bool SimTK::signBit (unsigned long long u)
 
bool SimTK::signBit (signed char i)
 
bool SimTK::signBit (short i)
 
bool SimTK::signBit (int i)
 
bool SimTK::signBit (long long i)
 
bool SimTK::signBit (long i)
 
bool SimTK::signBit (const float &f)
 
bool SimTK::signBit (const double &d)
 
bool SimTK::signBit (const negator< float > &nf)
 
bool SimTK::signBit (const negator< double > &nd)
 
unsigned int SimTK::sign (unsigned char u)
 
unsigned int SimTK::sign (unsigned short u)
 
unsigned int SimTK::sign (unsigned int u)
 
unsigned int SimTK::sign (unsigned long u)
 
unsigned int SimTK::sign (unsigned long long u)
 
int SimTK::sign (signed char i)
 
int SimTK::sign (short i)
 
int SimTK::sign (int i)
 
int SimTK::sign (long i)
 
int SimTK::sign (long long i)
 
int SimTK::sign (const float &x)
 
int SimTK::sign (const double &x)
 
int SimTK::sign (const negator< float > &x)
 
int SimTK::sign (const negator< double > &x)
 
unsigned char SimTK::square (unsigned char u)
 
unsigned short SimTK::square (unsigned short u)
 
unsigned int SimTK::square (unsigned int u)
 
unsigned long SimTK::square (unsigned long u)
 
unsigned long long SimTK::square (unsigned long long u)
 
char SimTK::square (char c)
 
signed char SimTK::square (signed char i)
 
short SimTK::square (short i)
 
int SimTK::square (int i)
 
long SimTK::square (long i)
 
long long SimTK::square (long long i)
 
float SimTK::square (const float &x)
 
double SimTK::square (const double &x)
 
float SimTK::square (const negator< float > &x)
 
double SimTK::square (const negator< double > &x)
 
template<class P >
std::complex< P > SimTK::square (const std::complex< P > &x)
 
template<class P >
std::complex< P > SimTK::square (const conjugate< P > &x)
 
template<class P >
std::complex< P > SimTK::square (const negator< std::complex< P > > &x)
 
template<class P >
std::complex< P > SimTK::square (const negator< conjugate< P > > &x)
 
unsigned char SimTK::cube (unsigned char u)
 
unsigned short SimTK::cube (unsigned short u)
 
unsigned int SimTK::cube (unsigned int u)
 
unsigned long SimTK::cube (unsigned long u)
 
unsigned long long SimTK::cube (unsigned long long u)
 
char SimTK::cube (char c)
 
signed char SimTK::cube (signed char i)
 
short SimTK::cube (short i)
 
int SimTK::cube (int i)
 
long SimTK::cube (long i)
 
long long SimTK::cube (long long i)
 
float SimTK::cube (const float &x)
 
double SimTK::cube (const double &x)
 
negator< float > SimTK::cube (const negator< float > &x)
 
negator< double > SimTK::cube (const negator< double > &x)
 
template<class P >
std::complex< P > SimTK::cube (const std::complex< P > &x)
 
template<class P >
std::complex< P > SimTK::cube (const negator< std::complex< P > > &x)
 
template<class P >
std::complex< P > SimTK::cube (const conjugate< P > &x)
 
template<class P >
std::complex< P > SimTK::cube (const negator< conjugate< P > > &x)
 
double & SimTK::clampInPlace (double low, double &v, double high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range. More...
 
float & SimTK::clampInPlace (float low, float &v, float high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
double & SimTK::clampInPlace (int low, double &v, int high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range. More...
 
float & SimTK::clampInPlace (int low, float &v, int high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range. More...
 
double & SimTK::clampInPlace (int low, double &v, double high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range. More...
 
float & SimTK::clampInPlace (int low, float &v, float high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range. More...
 
double & SimTK::clampInPlace (double low, double &v, int high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range. More...
 
float & SimTK::clampInPlace (float low, float &v, int high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range. More...
 
unsigned char & SimTK::clampInPlace (unsigned char low, unsigned char &v, unsigned char high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
unsigned short & SimTK::clampInPlace (unsigned short low, unsigned short &v, unsigned short high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
unsigned int & SimTK::clampInPlace (unsigned int low, unsigned int &v, unsigned int high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
unsigned long & SimTK::clampInPlace (unsigned long low, unsigned long &v, unsigned long high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
unsigned long long & SimTK::clampInPlace (unsigned long long low, unsigned long long &v, unsigned long long high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
char & SimTK::clampInPlace (char low, char &v, char high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
signed char & SimTK::clampInPlace (signed char low, signed char &v, signed char high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
short & SimTK::clampInPlace (short low, short &v, short high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
int & SimTK::clampInPlace (int low, int &v, int high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
long & SimTK::clampInPlace (long low, long &v, long high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
long long & SimTK::clampInPlace (long long low, long long &v, long long high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
negator< float > & SimTK::clampInPlace (float low, negator< float > &v, float high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
negator< double > & SimTK::clampInPlace (double low, negator< double > &v, double high)
 Check that low <= v <= high and modify v in place if necessary to bring it into that range.
More...
 
double SimTK::clamp (double low, double v, double high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
float SimTK::clamp (float low, float v, float high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
double SimTK::clamp (int low, double v, int high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
float SimTK::clamp (int low, float v, int high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
double SimTK::clamp (int low, double v, double high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
float SimTK::clamp (int low, float v, float high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
double SimTK::clamp (double low, double v, int high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
float SimTK::clamp (float low, float v, int high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
unsigned char SimTK::clamp (unsigned char low, unsigned char v, unsigned char high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
unsigned short SimTK::clamp (unsigned short low, unsigned short v, unsigned short high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
unsigned int SimTK::clamp (unsigned int low, unsigned int v, unsigned int high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
unsigned long SimTK::clamp (unsigned long low, unsigned long v, unsigned long high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
unsigned long long SimTK::clamp (unsigned long long low, unsigned long long v, unsigned long long high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
char SimTK::clamp (char low, char v, char high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
signed char SimTK::clamp (signed char low, signed char v, signed char high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
short SimTK::clamp (short low, short v, short high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
int SimTK::clamp (int low, int v, int high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
long SimTK::clamp (long low, long v, long high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
long long SimTK::clamp (long long low, long long v, long long high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v.
More...
 
float SimTK::clamp (float low, negator< float > v, float high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
double SimTK::clamp (double low, negator< double > v, double high)
 If v is in range low <= v <= high then return v, otherwise return the nearest bound; this function does not modify the input variable v. More...
 
double SimTK::stepUp (double x)
 Interpolate smoothly from 0 up to 1 as the input argument goes from 0 to 1, with first and second derivatives zero at either end of the interval. More...
 
double SimTK::stepDown (double x)
 Interpolate smoothly from 1 down to 0 as the input argument goes from 0 to 1, with first and second derivatives zero at either end of the interval. More...
 
double SimTK::stepAny (double y0, double yRange, double x0, double oneOverXRange, double x)
 Interpolate smoothly from y0 to y1 as the input argument goes from x0 to x1, with first and second derivatives zero at either end of the interval. More...
 
double SimTK::dstepUp (double x)
 First derivative of stepUp(): d/dx stepUp(x). More...
 
double SimTK::dstepDown (double x)
 First derivative of stepDown(): d/dx stepDown(x). More...
 
double SimTK::dstepAny (double yRange, double x0, double oneOverXRange, double x)
 First derivative of stepAny(): d/dx stepAny(x). More...
 
double SimTK::d2stepUp (double x)
 Second derivative of stepUp(): d^2/dx^2 stepUp(x). More...
 
double SimTK::d2stepDown (double x)
 Second derivative of stepDown(): d^2/dx^2 stepDown(x). More...
 
double SimTK::d2stepAny (double yRange, double x0, double oneOverXRange, double x)
 Second derivative of stepAny(): d^2/dx^2 stepAny(x). More...
 
double SimTK::d3stepUp (double x)
 Third derivative of stepUp(): d^3/dx^3 stepUp(x). More...
 
double SimTK::d3stepDown (double x)
 Third derivative of stepDown(): d^3/dx^3 stepDown(x). More...
 
double SimTK::d3stepAny (double yRange, double x0, double oneOverXRange, double x)
 Third derivative of stepAny(): d^3/dx^3 stepAny(x). More...
 
float SimTK::stepUp (float x)
 Interpolate smoothly from 0 up to 1 as the input argument goes from 0 to 1, with first and second derivatives zero at either end of the interval.
More...
 
float SimTK::stepDown (float x)
 Interpolate smoothly from 1 down to 0 as the input argument goes from 0 to 1, with first and second derivatives zero at either end of the interval.
More...
 
float SimTK::stepAny (float y0, float yRange, float x0, float oneOverXRange, float x)
 Interpolate smoothly from y0 to y1 as the input argument goes from x0 to x1, with first and second derivatives zero at either end of the interval.
More...
 
float SimTK::dstepUp (float x)
 First derivative of stepUp(): d/dx stepUp(x).
More...
 
float SimTK::dstepDown (float x)
 First derivative of stepDown(): d/dx stepDown(x).
More...
 
float SimTK::dstepAny (float yRange, float x0, float oneOverXRange, float x)
 First derivative of stepAny(): d/dx stepAny(x).
More...
 
float SimTK::d2stepUp (float x)
 Second derivative of stepUp(): d^2/dx^2 stepUp(x).
More...
 
float SimTK::d2stepDown (float x)
 Second derivative of stepDown(): d^2/dx^2 stepDown(x).
More...
 
float SimTK::d2stepAny (float yRange, float x0, float oneOverXRange, float x)
 Second derivative of stepAny(): d^2/dx^2 stepAny(x).
More...
 
float SimTK::d3stepUp (float x)
 Third derivative of stepUp(): d^3/dx^3 stepUp(x).
More...
 
float SimTK::d3stepDown (float x)
 Third derivative of stepDown(): d^3/dx^3 stepDown(x).
More...
 
float SimTK::d3stepAny (float yRange, float x0, float oneOverXRange, float x)
 Third derivative of stepAny(): d^3/dx^3 stepAny(x).
More...
 
double SimTK::stepUp (int x)
 Interpolate smoothly from 0 up to 1 as the input argument goes from 0 to 1, with first and second derivatives zero at either end of the interval. More...
 
double SimTK::stepDown (int x)
 Interpolate smoothly from 1 down to 0 as the input argument goes from 0 to 1, with first and second derivatives zero at either end of the interval. More...
 
std::pair< double, double > SimTK::approxCompleteEllipticIntegralsKE (double m)
 Given 0<=m<=1, return complete elliptic integrals of the first and second kinds, K(m) and E(m), approximated but with a maximum error of 2e-8 so at least 7 digits are correct (same in float or double precision). See Elliptic integrals for a discussion. More...
 
std::pair< float, float > SimTK::approxCompleteEllipticIntegralsKE (float m)
 This is the single precision (float) version of the approximate calculation of elliptic integrals, still yielding about 7 digits of accuracy even though all calculations are done in float precision. More...
 
std::pair< double, double > SimTK::approxCompleteEllipticIntegralsKE (int m)
 This integer overload is present to prevent ambiguity; it converts its argument to double precision and then calls approxCompleteEllipticIntegralsKE(double). More...
 
std::pair< double, double > SimTK::completeEllipticIntegralsKE (double m)
 Given 0<=m<=1, return complete elliptic integrals of the first and second kinds, K(m) and E(m), calculated to (roughly) machine precision (float or double). See Elliptic integrals for a discussion. More...
 
std::pair< float, float > SimTK::completeEllipticIntegralsKE (float m)
 This is the single precision (float) version of the machine-precision calculation of elliptic integrals, providing accuracy to float precision (about 7 digits) which is no better than you'll get with the much faster approximate version, so use that instead! More...
 
std::pair< double, double > SimTK::completeEllipticIntegralsKE (int m)
 This integer overload is present to prevent ambiguity; it converts its argument to double precision and then calls completeEllipticIntegralsKE(double). More...
 

Variables

const Real SimTK::NaN
 This is the IEEE "not a number" constant for this implementation of the default-precision Real type; be very careful using this because it has many strange properties such as not comparing equal to itself. More...
 
const Real SimTK::Infinity
 This is the IEEE positive infinity constant for this implementation of the default-precision Real type; -Infinity will produce the negative infinity constant. More...
 
const Real SimTK::Eps
 Epsilon is the size of roundoff noise; it is the smallest positive number of default-precision type Real such that 1+Eps != 1. More...
 
const Real SimTK::SqrtEps
 This is the square root of Eps, ~1e-8 if Real is double, ~3e-4 if Real is float. More...
 
const Real SimTK::TinyReal
 TinyReal is a floating point value smaller than the floating point precision; it is defined as Eps^(5/4) which is ~1e-20 for Real==double and ~1e-9 for float. More...
 
const Real SimTK::SignificantReal
 SignificantReal is the smallest value that we consider to be clearly distinct from roundoff error when it is the result of a computation; it is defined as Eps^(7/8) which is ~1e-14 when Real==double, ~1e-6 when Real==float. More...
 
const Real SimTK::LeastPositiveReal
 This is the smallest positive real number that can be expressed in the type Real; it is ~1e-308 when Real==double, ~1e-38 when Real==float. More...
 
const Real SimTK::MostPositiveReal
 This is the largest finite positive real number that can be expressed in the Real type; ~1e+308 when Real==double, ~1e+38 when Real==float. Note that there is also a value Infinity that will test larger than this one. More...
 
const Real SimTK::LeastNegativeReal
 This is the largest negative real number (that is, closest to zero) that can be expressed in values of type Real. More...
 
const Real SimTK::MostNegativeReal
 This is the smallest finite negative real number that can be expressed in values of type Real. Note that -Infinity is a value that will still test smaller than this one. More...
 
const int SimTK::NumDigitsReal
 This is the number of decimal digits that can be reliably stored and retrieved in the default Real precision (typically log10(1/eps)-1), that is, about 15 digits when Real==double and 6 digits when Real==float. More...
 
const int SimTK::LosslessNumDigitsReal
 This is the smallest number of decimal digits you should store in a text file if you want to be able to get exactly the same bit pattern back when you read it back in and convert the text to a Real value. More...
 
const Real SimTK::Zero
 Real(0) More...
 
const Real SimTK::One
 Real(1) More...
 
const Real SimTK::MinusOne
 Real(-1) More...
 
const Real SimTK::Two
 Real(2) More...
 
const Real SimTK::Three
 Real(3) More...
 
const Real SimTK::OneHalf
 Real(1)/2. More...
 
const Real SimTK::OneThird
 Real(1)/3. More...
 
const Real SimTK::OneFourth
 Real(1)/4. More...
 
const Real SimTK::OneFifth
 Real(1)/5. More...
 
const Real SimTK::OneSixth
 Real(1)/6. More...
 
const Real SimTK::OneSeventh
 Real(1)/7. More...
 
const Real SimTK::OneEighth
 Real(1)/8. More...
 
const Real SimTK::OneNinth
 Real(1)/9. More...
 
const Real SimTK::Pi
 Real(pi) More...
 
const Real SimTK::OneOverPi
 1/Real(pi) More...
 
const Real SimTK::E
 e = Real(exp(1)) More...
 
const Real SimTK::Log2E
 Real(log2(e)) (log base 2) More...
 
const Real SimTK::Log10E
 Real(log10(e)) (log base 10) More...
 
const Real SimTK::Sqrt2
 Real(sqrt(2)) More...
 
const Real SimTK::OneOverSqrt2
 1/sqrt(2)==sqrt(2)/2 as Real More...
 
const Real SimTK::Sqrt3
 Real(sqrt(3)) More...
 
const Real SimTK::OneOverSqrt3
 Real(1/sqrt(3)) More...
 
const Real SimTK::CubeRoot2
 Real(2^(1/3)) (cube root of 2) More...
 
const Real SimTK::CubeRoot3
 Real(3^(1/3)) (cube root of 3) More...
 
const Real SimTK::Ln2
 Real(ln(2)) (natural log of 2) More...
 
const Real SimTK::Ln10
 Real(ln(10)) (natural log of 10) More...
 
const Complex SimTK::I
 We only need one complex constant, i = sqrt(-1). For the rest just multiply the real constant by i, or convert with Complex(the Real constant), or if you need an address you can use NTraits<Complex>::getPi(), etc. More...
 

Detailed Description

This is a user-includable header which includes everything needed to make use of SimMatrix Scalar code.

More commonly, this will be included from within Matrix code.