Gromacs  2021-beta2-UNCHECKED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
scalar_math.h File Reference
#include <cmath>
#include "gromacs/math/functions.h"
#include "gromacs/math/utilities.h"
#include "gromacs/simd/scalar/scalar.h"
+ Include dependency graph for scalar_math.h:
+ This graph shows which files directly or indirectly include this file:

Description

Scalar math functions mimicking GROMACS SIMD math functions.

These versions make it possible to write functions that are templated with either a SIMD or scalar type. While some of these functions might not appear SIMD-specific, we have placed them here because the only reason to use these instead of generic function is in templated combined SIMD/non-SIMD code. It is important that these functions match the SIMD versions exactly in their arguments and template arguments so that overload resolution works correctly.

Author
Erik Lindahl erik..nosp@m.lind.nosp@m.ahl@g.nosp@m.mail.nosp@m..com

Functions

static float gmx::copysign (float x, float y)
 Composes single value with the magnitude of x and the sign of y. More...
 
static void gmx::invsqrtPair (float x0, float x1, float *out0, float *out1)
 Calculate 1/sqrt(x) for two floats. More...
 
static float gmx::inv (float x)
 Calculate 1/x for float. More...
 
static float gmx::maskzInvsqrt (float x, bool m)
 Calculate 1/sqrt(x) for masked entry of float. More...
 
static float gmx::maskzInv (float x, bool m)
 Calculate 1/x for masked entry of float. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static float gmx::sqrt (float x)
 Float sqrt(x). This is the square root. More...
 
static float gmx::log (float x)
 Float log(x). This is the natural logarithm. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static float gmx::exp2 (float x)
 Float 2^x. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static float gmx::exp (float x)
 Float exp(x). More...
 
static float gmx::erf (float x)
 Float erf(x). More...
 
static float gmx::erfc (float x)
 Float erfc(x). More...
 
static void gmx::sincos (float x, float *sinval, float *cosval)
 Float sin & cos. More...
 
static float gmx::sin (float x)
 Float sin. More...
 
static float gmx::cos (float x)
 Float cos. More...
 
static float gmx::tan (float x)
 Float tan. More...
 
static float gmx::asin (float x)
 float asin. More...
 
static float gmx::acos (float x)
 Float acos. More...
 
static float gmx::atan (float x)
 Float atan. More...
 
static float gmx::atan2 (float y, float x)
 Float atan2(y,x). More...
 
static float gmx::pmeForceCorrection (float z2)
 Calculate the force correction due to PME analytically in float. More...
 
static float gmx::pmePotentialCorrection (float z2)
 Calculate the potential correction due to PME analytically in float. More...
 
static double gmx::copysign (double x, double y)
 Composes double value with the magnitude of x and the sign of y. More...
 
static void gmx::invsqrtPair (double x0, double x1, double *out0, double *out1)
 Calculate 1/sqrt(x) for two doubles. More...
 
static double gmx::inv (double x)
 Calculate 1/x for double. More...
 
static double gmx::maskzInvsqrt (double x, bool m)
 Calculate 1/sqrt(x) for masked entry of double. More...
 
static double gmx::maskzInv (double x, bool m)
 Calculate 1/x for masked entry of double. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static double gmx::sqrt (double x)
 Double sqrt(x). This is the square root. More...
 
static double gmx::log (double x)
 Double log(x). This is the natural logarithm. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static double gmx::exp2 (double x)
 Double 2^x. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static double gmx::exp (double x)
 Double exp(x). More...
 
static double gmx::erf (double x)
 Double erf(x). More...
 
static double gmx::erfc (double x)
 Double erfc(x). More...
 
static void gmx::sincos (double x, double *sinval, double *cosval)
 Double sin & cos. More...
 
static double gmx::sin (double x)
 Double sin. More...
 
static double gmx::cos (double x)
 Double cos. More...
 
static double gmx::tan (double x)
 Double tan. More...
 
static double gmx::asin (double x)
 Double asin. More...
 
static double gmx::acos (double x)
 Double acos. More...
 
static double gmx::atan (double x)
 Double atan. More...
 
static double gmx::atan2 (double y, double x)
 Double atan2(y,x). More...
 
static double gmx::pmeForceCorrection (double z2)
 Calculate the force correction due to PME analytically in double. More...
 
static double gmx::pmePotentialCorrection (double z2)
 Calculate the potential correction due to PME analytically in double. More...
 
static double gmx::invsqrtSingleAccuracy (double x)
 Calculate 1/sqrt(x) for double, but with single accuracy. More...
 
static void gmx::invsqrtPairSingleAccuracy (double x0, double x1, double *out0, double *out1)
 Calculate 1/sqrt(x) for two doubles, but with single accuracy. More...
 
static double gmx::invSingleAccuracy (double x)
 Calculate 1/x for double, but with single accuracy. More...
 
static double gmx::maskzInvsqrtSingleAccuracy (double x, bool m)
 Calculate 1/sqrt(x) for masked entry of double, but with single accuracy. More...
 
static double gmx::maskzInvSingleAccuracy (double x, bool m)
 Calculate 1/x for masked entry of double, but with single accuracy. More...
 
static double gmx::sqrtSingleAccuracy (double x)
 Calculate sqrt(x) for double, but with single accuracy. More...
 
static double gmx::logSingleAccuracy (double x)
 Double log(x), but with single accuracy. This is the natural logarithm. More...
 
static double gmx::exp2SingleAccuracy (double x)
 Double 2^x, but with single accuracy. More...
 
static double gmx::expSingleAccuracy (double x)
 Double exp(x), but with single accuracy. More...
 
static double gmx::erfSingleAccuracy (double x)
 Double erf(x), but with single accuracy. More...
 
static double gmx::erfcSingleAccuracy (double x)
 Double erfc(x), but with single accuracy. More...
 
static void gmx::sincosSingleAccuracy (double x, double *sinval, double *cosval)
 Double sin & cos, but with single accuracy. More...
 
static double gmx::sinSingleAccuracy (double x)
 Double sin, but with single accuracy. More...
 
static double gmx::cosSingleAccuracy (double x)
 Double cos, but with single accuracy. More...
 
static double gmx::tanSingleAccuracy (double x)
 Double tan, but with single accuracy. More...
 
static double gmx::asinSingleAccuracy (double x)
 Double asin, but with single accuracy. More...
 
static double gmx::acosSingleAccuracy (double x)
 Double acos, but with single accuracy. More...
 
static double gmx::atanSingleAccuracy (double x)
 Double atan, but with single accuracy. More...
 
static double gmx::atan2SingleAccuracy (double y, double x)
 Double atan2(y,x), but with single accuracy. More...
 
static double gmx::pmeForceCorrectionSingleAccuracy (double z2)
 Force correction due to PME in double, but with single accuracy. More...
 
static double gmx::pmePotentialCorrectionSingleAccuracy (double z2)
 Potential correction due to PME in double, but with single accuracy. More...