Teuchos - Trilinos Tools Package
Version of the Day
|
This structure defines some basic traits for a scalar field type. More...
#include <Teuchos_ScalarTraitsDecl.hpp>
Public Types | |
typedef T | magnitudeType |
Mandatory typedef for result of magnitude. More... | |
typedef T | halfPrecision |
Typedef for half precision. More... | |
typedef T | doublePrecision |
Typedef for double precision. More... | |
typedef T | coordinateType |
Typedef for coordinates. More... | |
Static Public Member Functions | |
static magnitudeType | eps () |
Returns relative machine precision. More... | |
static magnitudeType | sfmin () |
Returns safe minimum (sfmin), such that 1/sfmin does not overflow. More... | |
static magnitudeType | base () |
Returns the base of the machine. More... | |
static magnitudeType | prec () |
Returns eps*base . More... | |
static magnitudeType | t () |
Returns the number of (base) digits in the mantissa. More... | |
static magnitudeType | rnd () |
Returns 1.0 when rounding occurs in addition, 0.0 otherwise. More... | |
static magnitudeType | emin () |
Returns the minimum exponent before (gradual) underflow. More... | |
static magnitudeType | rmin () |
Returns the underflow threshold - base^ (emin-1) More... | |
static magnitudeType | emax () |
Returns the largest exponent before overflow. More... | |
static magnitudeType | rmax () |
Overflow theshold - (base^emax)*(1-eps) More... | |
static magnitudeType | magnitude (T a) |
Returns the magnitudeType of the scalar type a . More... | |
static T | zero () |
Returns representation of zero for this scalar type. More... | |
static T | one () |
Returns representation of one for this scalar type. More... | |
static magnitudeType | real (T a) |
Returns the real part of the scalar type a . More... | |
static magnitudeType | imag (T a) |
Returns the imaginary part of the scalar type a . More... | |
static T | conjugate (T a) |
Returns the conjugate of the scalar type a . More... | |
static T | nan () |
Returns a number that represents NaN. More... | |
static bool | isnaninf (const T &x) |
Returns true if x is NaN or Inf. More... | |
static void | seedrandom (unsigned int s) |
Seed the random number generator returned by random() . More... | |
static T | random () |
Returns a random number (between -one() and +one()) of this scalar type. More... | |
static std::string | name () |
Returns the name of this scalar type. More... | |
static T | squareroot (T x) |
Returns a number of magnitudeType that is the square root of this scalar type x . More... | |
static T | pow (T x, T y) |
Returns the result of raising one scalar x to the power y . More... | |
static T | pi () |
Returns the value of PI. More... | |
Static Public Attributes | |
static const bool | isComplex = false |
Determines if scalar type is std::complex. More... | |
static const bool | isOrdinal = false |
Determines if scalar type is an ordinal type. More... | |
static const bool | isComparable = false |
Determines if scalar type supports relational operators such as <, >, <=, >=. More... | |
static const bool | hasMachineParameters = false |
Determines if scalar type have machine-specific parameters (i.e. eps(), sfmin(), base(), prec(), t(), rnd(), emin(), rmin(), emax(), rmax() are supported). More... | |
This structure defines some basic traits for a scalar field type.
Scalar traits are an essential part of templated codes. This structure offers the basic traits of the templated scalar type, like defining zero and one, and basic functions on the templated scalar type, like performing a square root.
The functions in the templated base unspecialized struct are designed not to compile (giving a nice compile-time error message) and therefore specializations must be written for Scalar types actually used.
The default defined specializations are provided for int
, float
, and double
.
If Teuchos is configured with Teuchos_ENABLE_COMPLEX=ON then ScalarTraits also has a partial specialization for all std::complex
numbers of the form std::complex<T>
.
Definition at line 58 of file Teuchos_ScalarTraitsDecl.hpp.
typedef T Teuchos::ScalarTraits< T >::magnitudeType |
Mandatory typedef for result of magnitude.
Definition at line 61 of file Teuchos_ScalarTraitsDecl.hpp.
typedef T Teuchos::ScalarTraits< T >::halfPrecision |
Typedef for half precision.
Definition at line 63 of file Teuchos_ScalarTraitsDecl.hpp.
typedef T Teuchos::ScalarTraits< T >::doublePrecision |
Typedef for double precision.
Definition at line 65 of file Teuchos_ScalarTraitsDecl.hpp.
typedef T Teuchos::ScalarTraits< T >::coordinateType |
Typedef for coordinates.
Definition at line 67 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns relative machine precision.
Definition at line 80 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns safe minimum (sfmin), such that 1/sfmin does not overflow.
Definition at line 82 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the base of the machine.
Definition at line 84 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns eps*base
.
Definition at line 86 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the number of (base) digits in the mantissa.
Definition at line 88 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns 1.0 when rounding occurs in addition, 0.0 otherwise.
Definition at line 90 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the minimum exponent before (gradual) underflow.
Definition at line 92 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the underflow threshold - base^
(emin-1)
Definition at line 94 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the largest exponent before overflow.
Definition at line 96 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Overflow theshold - (base^emax)*(1-eps)
Definition at line 98 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the magnitudeType of the scalar type a
.
Definition at line 100 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns representation of zero for this scalar type.
Definition at line 102 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns representation of one for this scalar type.
Definition at line 104 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the real part of the scalar type a
.
Definition at line 106 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the imaginary part of the scalar type a
.
Definition at line 108 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the conjugate of the scalar type a
.
Definition at line 110 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns a number that represents NaN.
Definition at line 112 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns true
if x
is NaN or Inf.
Definition at line 114 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Seed the random number generator returned by random()
.
Definition at line 116 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns a random number (between -one() and +one()) of this scalar type.
Definition at line 118 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the name of this scalar type.
Definition at line 120 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns a number of magnitudeType that is the square root of this scalar type x
.
Definition at line 122 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the result of raising one scalar x
to the power y
.
Definition at line 124 of file Teuchos_ScalarTraitsDecl.hpp.
|
inlinestatic |
Returns the value of PI.
Definition at line 126 of file Teuchos_ScalarTraitsDecl.hpp.
|
static |
Determines if scalar type is std::complex.
Definition at line 69 of file Teuchos_ScalarTraitsDecl.hpp.
|
static |
Determines if scalar type is an ordinal type.
Definition at line 71 of file Teuchos_ScalarTraitsDecl.hpp.
|
static |
Determines if scalar type supports relational operators such as <, >, <=, >=.
Definition at line 73 of file Teuchos_ScalarTraitsDecl.hpp.
|
static |