GEOSX
LvArray::math Namespace Reference

Contains protable wrappers around cmath functions and some cuda specific functions. More...

Functions

General purpose functions
template<typename T >
constexpr std::enable_if_t< std::is_arithmetic< T >::value, T > max (T const a, T const b)
 
template<typename T >
constexpr std::enable_if_t< std::is_arithmetic< T >::value, T > min (T const a, T const b)
 
float abs (float const x)
 
double abs (double const x)
 
template<typename T >
std::enable_if_t< std::is_integral< T >::value, T > abs (T const x)
 
Square root and inverse square root.
float sqrt (float const x)
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, double > sqrt (T const x)
 
float invSqrt (float const x)
 
template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, double > invSqrt (T const x)
 
Trigonometric functions
float sin (float const theta)
 
double sin (double const theta)
 
float cos (float const theta)
 
double cos (double const theta)
 
float tan (float const theta)
 
double tan (double const theta)
 
void sincos (float const theta, float &sinTheta, float &cosTheta)
 Compute the sine and cosine of theta. More...
 
void sincos (double const theta, double &sinTheta, double &cosTheta)
 Compute the sine and cosine of theta. More...
 
Inverse trigonometric functions
float asin (float const x)
 
double asin (double const x)
 
float acos (float const x)
 
double acos (double const x)
 
float atan2 (float const y, float const x)
 
double atan2 (double const y, double const x)
 

Detailed Description

Contains protable wrappers around cmath functions and some cuda specific functions.

Function Documentation

◆ abs() [1/3]

float LvArray::math::abs ( float const  x)
inline
Returns
The absolute value of x.
Parameters
xThe number to get the absolute value of.
Note
This set of overloads is valid for any numeric type.

Definition at line 81 of file math.hpp.

◆ abs() [2/3]

double LvArray::math::abs ( double const  x)
inline

Returns
The absolute value of x.
Parameters
xThe number to get the absolute value of.
Note
This set of overloads is valid for any numeric type.

Definition at line 86 of file math.hpp.

◆ abs() [3/3]

template<typename T >
std::enable_if_t< std::is_integral< T >::value, T > LvArray::math::abs ( T const  x)
inline

Returns
The absolute value of x.
Parameters
xThe number to get the absolute value of.
Note
This set of overloads is valid for any numeric type.
Template Parameters
TAn integral type.

Definition at line 96 of file math.hpp.

◆ acos() [1/2]

float LvArray::math::acos ( float const  x)
inline
Returns
The arccosine of the value x.
Parameters
xThe value to get the arccosine of, must be in [-1, 1].

Definition at line 272 of file math.hpp.

◆ acos() [2/2]

double LvArray::math::acos ( double const  x)
inline

Returns
The arccosine of the value x.
Parameters
xThe value to get the arccosine of, must be in [-1, 1].

Definition at line 277 of file math.hpp.

◆ asin() [1/2]

float LvArray::math::asin ( float const  x)
inline
Returns
The arcsine of the value x.
Parameters
xThe value to get the arcsine of, must be in [-1, 1].

Definition at line 259 of file math.hpp.

◆ asin() [2/2]

double LvArray::math::asin ( double const  x)
inline

Returns
The arcsine of the value x.
Parameters
xThe value to get the arcsine of, must be in [-1, 1].

Definition at line 264 of file math.hpp.

◆ atan2() [1/2]

float LvArray::math::atan2 ( float const  y,
float const  x 
)
inline
Returns
The angle corresponding to the point (x, y).
Parameters
yThe y coordinate.
xThe x coordinate.

Definition at line 286 of file math.hpp.

◆ atan2() [2/2]

double LvArray::math::atan2 ( double const  y,
double const  x 
)
inline

Returns
The angle corresponding to the point (x, y).
Parameters
yThe y coordinate.
xThe x coordinate.

Definition at line 291 of file math.hpp.

◆ cos() [1/2]

float LvArray::math::cos ( float const  theta)
inline
Returns
The cosine of theta.
Parameters
thetaThe angle in radians.

Definition at line 197 of file math.hpp.

◆ cos() [2/2]

double LvArray::math::cos ( double const  theta)
inline

Returns
The cosine of theta.
Parameters
thetaThe angle in radians.

Definition at line 202 of file math.hpp.

◆ invSqrt() [1/2]

float LvArray::math::invSqrt ( float const  x)
inline
Returns
One over the square root of x.
Parameters
xThe number to get the inverse square root of.
Note
This set of overloads is valid for any numeric type. If x is not a float it is converted to a double and the return type is double.

Definition at line 147 of file math.hpp.

◆ invSqrt() [2/2]

template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, double > LvArray::math::invSqrt ( T const  x)
inline

Returns
One over the square root of x.
Parameters
xThe number to get the inverse square root of.
Note
This set of overloads is valid for any numeric type. If x is not a float it is converted to a double and the return type is double.
Template Parameters
TAn integral type.

Definition at line 163 of file math.hpp.

◆ max()

template<typename T >
constexpr std::enable_if_t< std::is_arithmetic< T >::value, T > LvArray::math::max ( T const  a,
T const  b 
)
inline
Returns
Return the maximum of the numbers a and b.
Template Parameters
TA numeric type.
Parameters
aThe first number.
bThe second number.

Definition at line 46 of file math.hpp.

◆ min()

template<typename T >
constexpr std::enable_if_t< std::is_arithmetic< T >::value, T > LvArray::math::min ( T const  a,
T const  b 
)
inline
Returns
Return the minimum of the numbers a and b.
Template Parameters
TA numeric type.
Parameters
aThe first number.
bThe second number.

Definition at line 65 of file math.hpp.

◆ sin() [1/2]

float LvArray::math::sin ( float const  theta)
inline
Returns
The sine of theta.
Parameters
thetaThe angle in radians.

Definition at line 184 of file math.hpp.

◆ sin() [2/2]

double LvArray::math::sin ( double const  theta)
inline

Returns
The sine of theta.
Parameters
thetaThe angle in radians.

Definition at line 189 of file math.hpp.

◆ sincos() [1/2]

void LvArray::math::sincos ( float const  theta,
float &  sinTheta,
float &  cosTheta 
)
inline

Compute the sine and cosine of theta.

Parameters
thetaThe angle in radians.
sinThetaThe sine of theta.
cosThetaThe cosine of theta.

Definition at line 225 of file math.hpp.

◆ sincos() [2/2]

void LvArray::math::sincos ( double const  theta,
double &  sinTheta,
double &  cosTheta 
)
inline

Compute the sine and cosine of theta.

Parameters
thetaThe angle in radians.
sinThetaThe sine of theta.
cosThetaThe cosine of theta.

Definition at line 237 of file math.hpp.

◆ sqrt() [1/2]

float LvArray::math::sqrt ( float const  x)
inline
Returns
The square root of x.
Parameters
xThe number to get the square root of.
Note
This set of overloads is valid for any numeric type. If x is not a float it is converted to a double and the return type is double.

Definition at line 121 of file math.hpp.

◆ sqrt() [2/2]

template<typename T >
std::enable_if_t< std::is_arithmetic< T >::value, double > LvArray::math::sqrt ( T const  x)
inline

Returns
The square root of x.
Parameters
xThe number to get the square root of.
Note
This set of overloads is valid for any numeric type. If x is not a float it is converted to a double and the return type is double.
Template Parameters
TAn integral type.

Definition at line 131 of file math.hpp.

◆ tan() [1/2]

float LvArray::math::tan ( float const  theta)
inline
Returns
The tangent of theta.
Parameters
thetaThe angle in radians.

Definition at line 210 of file math.hpp.

◆ tan() [2/2]

double LvArray::math::tan ( double const  theta)
inline

Returns
The tangent of theta.
Parameters
thetaThe angle in radians.

Definition at line 215 of file math.hpp.