Gromacs  2019
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
functions.h File Reference
#include <cmath>
#include <cstdint>
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/real.h"
+ Include dependency graph for functions.h:
+ This graph shows which files directly or indirectly include this file:

Description

Declares simple math functions.

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

Classes

struct  gmx::StaticLog2< n >
 Evaluate log2(n) for integer n statically at compile time. More...
 
struct  gmx::StaticLog2< 1 >
 Specialization of StaticLog2<n> for n==1. More...
 
struct  gmx::StaticLog2< 0 >
 Specialization of StaticLog2<n> for n==0. More...
 

Functions

unsigned int gmx::log2I (std::int32_t x)
 Compute floor of logarithm to base 2, 32 bit signed argument. More...
 
unsigned int gmx::log2I (std::int64_t x)
 Compute floor of logarithm to base 2, 64 bit signed argument. More...
 
unsigned int gmx::log2I (std::uint32_t x)
 Compute floor of logarithm to base 2, 32 bit unsigned argument. More...
 
unsigned int gmx::log2I (std::uint64_t x)
 Compute floor of logarithm to base 2, 64 bit unsigned argument. More...
 
std::int64_t gmx::greatestCommonDivisor (std::int64_t p, std::int64_t q)
 Find greatest common divisor of two numbers. More...
 
static float gmx::invsqrt (float x)
 Calculate 1.0/sqrt(x) in single precision. More...
 
static double gmx::invsqrt (double x)
 Calculate 1.0/sqrt(x) in double precision, but single range. More...
 
static double gmx::invsqrt (int x)
 Calculate 1.0/sqrt(x) for integer x in double precision. More...
 
static float gmx::invcbrt (float x)
 Calculate inverse cube root of x in single precision. More...
 
static double gmx::invcbrt (double x)
 Calculate inverse sixth root of x in double precision. More...
 
static double gmx::invcbrt (int x)
 Calculate inverse sixth root of integer x in double precision. More...
 
static float gmx::sixthroot (float x)
 Calculate sixth root of x in single precision. More...
 
static double gmx::sixthroot (double x)
 Calculate sixth root of x in double precision. More...
 
static double gmx::sixthroot (int x)
 Calculate sixth root of integer x, return double. More...
 
static float gmx::invsixthroot (float x)
 Calculate inverse sixth root of x in single precision. More...
 
static double gmx::invsixthroot (double x)
 Calculate inverse sixth root of x in double precision. More...
 
static double gmx::invsixthroot (int x)
 Calculate inverse sixth root of integer x in double precision. More...
 
template<typename T >
gmx::square (T x)
 calculate x^2 More...
 
template<typename T >
gmx::power3 (T x)
 calculate x^3 More...
 
template<typename T >
gmx::power4 (T x)
 calculate x^4 More...
 
template<typename T >
gmx::power5 (T x)
 calculate x^5 More...
 
template<typename T >
gmx::power6 (T x)
 calculate x^6 More...
 
template<typename T >
gmx::power12 (T x)
 calculate x^12 More...
 
static real gmx::series_sinhx (real x)
 Maclaurin series for sinh(x)/x. More...
 
double gmx::erfinv (double x)
 Inverse error function, double precision. More...
 
float gmx::erfinv (float x)
 Inverse error function, single precision. More...
 
constexpr int32_t gmx::exactDiv (int32_t a, int32_t b)
 Exact integer division, 32bit. More...
 
constexpr int64_t gmx::exactDiv (int64_t a, int64_t b)
 Exact integer division, 64bit.
 
static int gmx::roundToInt (float x)
 Round float to int. More...
 
static int gmx::roundToInt (double x)
 Round double to int.
 
static int64_t gmx::roundToInt64 (float x)
 Round float to int64_t.
 
static int64_t gmx::roundToInt64 (double x)
 Round double to int64_t.