Gromacs
5.1
|
#include "config.h"
#include <math.h>
#include "gromacs/math/utilities.h"
#include "gromacs/simd/simd.h"
Math functions for SIMD datatypes.
SIMD4 math functions | |
#define | gmx_simd4_sum4_r gmx_simd4_sum4_f |
SIMD4 utility function to sum a+b+c+d for SIMD4 reals. More... | |
#define | gmx_simd4_invsqrt_r gmx_simd4_invsqrt_f |
Calculate 1/sqrt(x) for SIMD4 real. More... | |
#define | gmx_simd4_invsqrt_singleaccuracy_r gmx_simd4_invsqrt_f |
1/sqrt(x) for SIMD4 real. Single accuracy, even for double prec. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd4_sum4_f (gmx_simd_float_t a, gmx_simd_float_t b, gmx_simd_float_t c, gmx_simd_float_t d) |
SIMD4 utility function to sum a+b+c+d for SIMD4 floats. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd4_rsqrt_iter_f (gmx_simd_float_t lu, gmx_simd_float_t x) |
Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD4 float. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd4_invsqrt_f (gmx_simd_float_t x) |
Calculate 1/sqrt(x) for SIMD4 float. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd4_sum4_d (gmx_simd_double_t a, gmx_simd_double_t b, gmx_simd_double_t c, gmx_simd_double_t d) |
SIMD4 utility function to sum a+b+c+d for SIMD4 doubles. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd4_rsqrt_iter_d (gmx_simd_double_t lu, gmx_simd_double_t x) |
Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD4 double. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd4_invsqrt_d (gmx_simd_double_t x) |
Calculate 1/sqrt(x) for SIMD4 double. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd4_invsqrt_singleaccuracy_d (gmx_simd_double_t x) |
Calculate 1/sqrt(x) for SIMD4 double, but in single accuracy. More... | |
Macros | |
Real-precision SIMD math functions | |
These are the ones you should typically call in Gromacs. | |
#define | gmx_simd_sum4_r gmx_simd_sum4_f |
SIMD utility function to sum a+b+c+d for SIMD reals. More... | |
#define | gmx_simd_xor_sign_r gmx_simd_xor_sign_f |
Return -a if b is negative, SIMD real. More... | |
#define | gmx_simd_invsqrt_r gmx_simd_invsqrt_f |
Calculate 1/sqrt(x) for SIMD real. More... | |
#define | gmx_simd_invsqrt_pair_r gmx_simd_invsqrt_pair_f |
Calculate 1/sqrt(x) for two SIMD reals. More... | |
#define | gmx_simd_sqrt_r gmx_simd_sqrt_f |
Calculate sqrt(x) correctly for SIMD real, including argument 0.0. More... | |
#define | gmx_simd_inv_r gmx_simd_inv_f |
Calculate 1/x for SIMD real. More... | |
#define | gmx_simd_log_r gmx_simd_log_f |
SIMD real log(x). This is the natural logarithm. More... | |
#define | gmx_simd_exp2_r gmx_simd_exp2_f |
SIMD real 2^x. More... | |
#define | gmx_simd_exp_r gmx_simd_exp_f |
SIMD real e^x. More... | |
#define | gmx_simd_erf_r gmx_simd_erf_f |
SIMD real erf(x). More... | |
#define | gmx_simd_erfc_r gmx_simd_erfc_f |
SIMD real erfc(x). More... | |
#define | gmx_simd_sincos_r gmx_simd_sincos_f |
SIMD real sin & cos. More... | |
#define | gmx_simd_sin_r gmx_simd_sin_f |
SIMD real sin(x). More... | |
#define | gmx_simd_cos_r gmx_simd_cos_f |
SIMD real cos(x). More... | |
#define | gmx_simd_tan_r gmx_simd_tan_f |
SIMD real tan(x). More... | |
#define | gmx_simd_asin_r gmx_simd_asin_f |
SIMD real asin(x). More... | |
#define | gmx_simd_acos_r gmx_simd_acos_f |
SIMD real acos(x). More... | |
#define | gmx_simd_atan_r gmx_simd_atan_f |
SIMD real atan(x). More... | |
#define | gmx_simd_atan2_r gmx_simd_atan2_f |
SIMD real atan2(y,x). More... | |
#define | gmx_simd_pmecorrF_r gmx_simd_pmecorrF_f |
SIMD Analytic PME force correction. More... | |
#define | gmx_simd_pmecorrV_r gmx_simd_pmecorrV_f |
SIMD Analytic PME potential correction. More... | |
#define | gmx_simd_invsqrt_singleaccuracy_r gmx_simd_invsqrt_f |
Calculate 1/sqrt(x) for SIMD, only targeting single accuracy. More... | |
#define | gmx_simd_invsqrt_pair_singleaccuracy_r gmx_simd_invsqrt_pair_f |
Calculate 1/sqrt(x) for SIMD pair, only targeting single accuracy. More... | |
#define | gmx_simd_sqrt_singleaccuracy_r gmx_simd_sqrt_f |
Calculate sqrt(x), only targeting single accuracy. More... | |
#define | gmx_simd_inv_singleaccuracy_r gmx_simd_inv_f |
Calculate 1/x for SIMD real, only targeting single accuracy. More... | |
#define | gmx_simd_log_singleaccuracy_r gmx_simd_log_f |
SIMD real log(x), only targeting single accuracy. More... | |
#define | gmx_simd_exp2_singleaccuracy_r gmx_simd_exp2_f |
SIMD real 2^x, only targeting single accuracy. More... | |
#define | gmx_simd_exp_singleaccuracy_r gmx_simd_exp_f |
SIMD real e^x, only targeting single accuracy. More... | |
#define | gmx_simd_erf_singleaccuracy_r gmx_simd_erf_f |
SIMD real erf(x), only targeting single accuracy. More... | |
#define | gmx_simd_erfc_singleaccuracy_r gmx_simd_erfc_f |
SIMD real erfc(x), only targeting single accuracy. More... | |
#define | gmx_simd_sincos_singleaccuracy_r gmx_simd_sincos_f |
SIMD real sin & cos, only targeting single accuracy. More... | |
#define | gmx_simd_sin_singleaccuracy_r gmx_simd_sin_f |
SIMD real sin(x), only targeting single accuracy. More... | |
#define | gmx_simd_cos_singleaccuracy_r gmx_simd_cos_f |
SIMD real cos(x), only targeting single accuracy. More... | |
#define | gmx_simd_tan_singleaccuracy_r gmx_simd_tan_f |
SIMD real tan(x), only targeting single accuracy. More... | |
#define | gmx_simd_asin_singleaccuracy_r gmx_simd_asin_f |
SIMD real asin(x), only targeting single accuracy. More... | |
#define | gmx_simd_acos_singleaccuracy_r gmx_simd_acos_f |
SIMD real acos(x), only targeting single accuracy. More... | |
#define | gmx_simd_atan_singleaccuracy_r gmx_simd_atan_f |
SIMD real atan(x), only targeting single accuracy. More... | |
#define | gmx_simd_atan2_singleaccuracy_r gmx_simd_atan2_f |
SIMD real atan2(y,x), only targeting single accuracy. More... | |
#define | gmx_simd_pmecorrF_singleaccuracy_r gmx_simd_pmecorrF_f |
SIMD Analytic PME force corr., only targeting single accuracy. More... | |
#define | gmx_simd_pmecorrV_singleaccuracy_r gmx_simd_pmecorrV_f |
SIMD Analytic PME potential corr., only targeting single accuracy. More... | |
Functions | |
Single precision SIMD math functions | |
| |
static gmx_simd_float_t gmx_simdcall | gmx_simd_sum4_f (gmx_simd_float_t a, gmx_simd_float_t b, gmx_simd_float_t c, gmx_simd_float_t d) |
SIMD float utility to sum a+b+c+d. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_xor_sign_f (gmx_simd_float_t a, gmx_simd_float_t b) |
Return -a if b is negative, SIMD float. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_rsqrt_iter_f (gmx_simd_float_t lu, gmx_simd_float_t x) |
Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD float. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_invsqrt_f (gmx_simd_float_t x) |
Calculate 1/sqrt(x) for SIMD float. More... | |
static gmx_simd_float_t | gmx_simd_invsqrt_maskfpe_f (gmx_simd_float_t x, gmx_simd_fbool_t m) |
Calculate 1/sqrt(x) for masked entries of SIMD float. More... | |
static gmx_simd_float_t | gmx_simd_invsqrt_notmaskfpe_f (gmx_simd_float_t x, gmx_simd_fbool_t m) |
Calculate 1/sqrt(x) for non-masked entries of SIMD float. More... | |
static void gmx_simdcall | gmx_simd_invsqrt_pair_f (gmx_simd_float_t x0, gmx_simd_float_t x1, gmx_simd_float_t *out0, gmx_simd_float_t *out1) |
Calculate 1/sqrt(x) for two SIMD floats. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_rcp_iter_f (gmx_simd_float_t lu, gmx_simd_float_t x) |
Perform one Newton-Raphson iteration to improve 1/x for SIMD float. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_inv_f (gmx_simd_float_t x) |
Calculate 1/x for SIMD float. More... | |
static gmx_simd_float_t | gmx_simd_inv_maskfpe_f (gmx_simd_float_t x, gmx_simd_fbool_t m) |
Calculate 1/x for masked entries of SIMD float. More... | |
static gmx_simd_float_t | gmx_simd_inv_notmaskfpe_f (gmx_simd_float_t x, gmx_simd_fbool_t m) |
Calculate 1/x for non-masked entries of SIMD float. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_sqrt_f (gmx_simd_float_t x) |
Calculate sqrt(x) correctly for SIMD floats, including argument 0.0. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_log_f (gmx_simd_float_t x) |
SIMD float log(x). This is the natural logarithm. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_exp2_f (gmx_simd_float_t x) |
SIMD float 2^x. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_exp_f (gmx_simd_float_t x) |
SIMD float exp(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_erf_f (gmx_simd_float_t x) |
SIMD float erf(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_erfc_f (gmx_simd_float_t x) |
SIMD float erfc(x). More... | |
static void gmx_simdcall | gmx_simd_sincos_f (gmx_simd_float_t x, gmx_simd_float_t *sinval, gmx_simd_float_t *cosval) |
SIMD float sin & cos. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_sin_f (gmx_simd_float_t x) |
SIMD float sin(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_cos_f (gmx_simd_float_t x) |
SIMD float cos(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_tan_f (gmx_simd_float_t x) |
SIMD float tan(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_asin_f (gmx_simd_float_t x) |
SIMD float asin(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_acos_f (gmx_simd_float_t x) |
SIMD float acos(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_atan_f (gmx_simd_float_t x) |
SIMD float asin(x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_atan2_f (gmx_simd_float_t y, gmx_simd_float_t x) |
SIMD float atan2(y,x). More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_pmecorrF_f (gmx_simd_float_t z2) |
Calculate the force correction due to PME analytically in SIMD float. More... | |
static gmx_simd_float_t gmx_simdcall | gmx_simd_pmecorrV_f (gmx_simd_float_t z2) |
Calculate the potential correction due to PME analytically in SIMD float. More... | |
Double precision SIMD math functions | |
| |
static gmx_simd_double_t gmx_simdcall | gmx_simd_sum4_d (gmx_simd_double_t a, gmx_simd_double_t b, gmx_simd_double_t c, gmx_simd_double_t d) |
SIMD utility function to sum a+b+c+d for SIMD doubles. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_xor_sign_d (gmx_simd_double_t a, gmx_simd_double_t b) |
Return -a if b is negative, SIMD double. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_rsqrt_iter_d (gmx_simd_double_t lu, gmx_simd_double_t x) |
Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD double. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_invsqrt_d (gmx_simd_double_t x) |
Calculate 1/sqrt(x) for SIMD double. More... | |
static gmx_simd_double_t | gmx_simd_invsqrt_maskfpe_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
Calculate 1/sqrt(x) for masked entries of SIMD double. More... | |
static gmx_simd_double_t | gmx_simd_invsqrt_notmaskfpe_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
Calculate 1/sqrt(x) for non-masked entries of SIMD double. More... | |
static void gmx_simdcall | gmx_simd_invsqrt_pair_d (gmx_simd_double_t x0, gmx_simd_double_t x1, gmx_simd_double_t *out0, gmx_simd_double_t *out1) |
Calculate 1/sqrt(x) for two SIMD doubles. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_rcp_iter_d (gmx_simd_double_t lu, gmx_simd_double_t x) |
Perform one Newton-Raphson iteration to improve 1/x for SIMD double. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_inv_d (gmx_simd_double_t x) |
Calculate 1/x for SIMD double. More... | |
static gmx_simd_double_t | gmx_simd_inv_maskfpe_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
Calculate 1/x for masked entries of SIMD double. More... | |
static gmx_simd_double_t | gmx_simd_inv_notmaskfpe_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
Calculate 1/x for non-masked entries of SIMD double. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_sqrt_d (gmx_simd_double_t x) |
Calculate sqrt(x) correctly for SIMD doubles, including argument 0.0. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_log_d (gmx_simd_double_t x) |
SIMD double log(x). This is the natural logarithm. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_exp2_d (gmx_simd_double_t x) |
SIMD double 2^x. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_exp_d (gmx_simd_double_t x) |
SIMD double exp(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_erf_d (gmx_simd_double_t x) |
SIMD double erf(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_erfc_d (gmx_simd_double_t x) |
SIMD double erfc(x). More... | |
static void gmx_simdcall | gmx_simd_sincos_d (gmx_simd_double_t x, gmx_simd_double_t *sinval, gmx_simd_double_t *cosval) |
SIMD double sin & cos. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_sin_d (gmx_simd_double_t x) |
SIMD double sin(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_cos_d (gmx_simd_double_t x) |
SIMD double cos(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_tan_d (gmx_simd_double_t x) |
SIMD double tan(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_asin_d (gmx_simd_double_t x) |
SIMD double asin(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_acos_d (gmx_simd_double_t x) |
SIMD double acos(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_atan_d (gmx_simd_double_t x) |
SIMD double atan(x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_atan2_d (gmx_simd_double_t y, gmx_simd_double_t x) |
SIMD double atan2(y,x). More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_pmecorrF_d (gmx_simd_double_t z2) |
Calculate the force correction due to PME analytically for SIMD double. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_pmecorrV_d (gmx_simd_double_t z2) |
Calculate the potential correction due to PME analytically for SIMD double. More... | |
SIMD math functions for double prec. data, single prec. accuracy | |
| |
static gmx_simd_double_t gmx_simdcall | gmx_simd_invsqrt_singleaccuracy_d (gmx_simd_double_t x) |
Calculate 1/sqrt(x) for SIMD double, but in single accuracy. More... | |
static gmx_simd_double_t | gmx_simd_invsqrt_maskfpe_singleaccuracy_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
1/sqrt(x) for masked entries of SIMD double, but in single accuracy. More... | |
static gmx_simd_double_t | gmx_simd_invsqrt_notmaskfpe_singleaccuracy_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
1/sqrt(x) for non-masked entries of SIMD double, in single accuracy. More... | |
static void gmx_simdcall | gmx_simd_invsqrt_pair_singleaccuracy_d (gmx_simd_double_t x0, gmx_simd_double_t x1, gmx_simd_double_t *out0, gmx_simd_double_t *out1) |
Calculate 1/sqrt(x) for two SIMD doubles, but single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_inv_singleaccuracy_d (gmx_simd_double_t x) |
Calculate 1/x for SIMD double, but in single accuracy. More... | |
static gmx_simd_double_t | gmx_simd_inv_maskfpe_singleaccuracy_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
1/x for masked entries of SIMD double, single accuracy. More... | |
static gmx_simd_double_t | gmx_simd_inv_notmaskfpe_singleaccuracy_d (gmx_simd_double_t x, gmx_simd_dbool_t m) |
1/x for non-masked entries of SIMD double, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_sqrt_singleaccuracy_d (gmx_simd_double_t x) |
Calculate sqrt(x) (correct for 0.0) for SIMD double, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_log_singleaccuracy_d (gmx_simd_double_t x) |
SIMD log(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_exp2_singleaccuracy_d (gmx_simd_double_t x) |
SIMD 2^x. Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_exp_singleaccuracy_d (gmx_simd_double_t x) |
SIMD exp(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_erf_singleaccuracy_d (gmx_simd_double_t x) |
SIMD erf(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_erfc_singleaccuracy_d (gmx_simd_double_t x) |
SIMD erfc(x). Double precision SIMD data, single accuracy. More... | |
static void gmx_simdcall | gmx_simd_sincos_singleaccuracy_d (gmx_simd_double_t x, gmx_simd_double_t *sinval, gmx_simd_double_t *cosval) |
SIMD sin & cos. Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_sin_singleaccuracy_d (gmx_simd_double_t x) |
SIMD sin(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_cos_singleaccuracy_d (gmx_simd_double_t x) |
SIMD cos(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_tan_singleaccuracy_d (gmx_simd_double_t x) |
SIMD tan(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_asin_singleaccuracy_d (gmx_simd_double_t x) |
SIMD asin(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_acos_singleaccuracy_d (gmx_simd_double_t x) |
SIMD acos(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_atan_singleaccuracy_d (gmx_simd_double_t x) |
SIMD asin(x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_atan2_singleaccuracy_d (gmx_simd_double_t y, gmx_simd_double_t x) |
SIMD atan2(y,x). Double precision SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_pmecorrF_singleaccuracy_d (gmx_simd_double_t z2) |
Analytical PME force correction, double SIMD data, single accuracy. More... | |
static gmx_simd_double_t gmx_simdcall | gmx_simd_pmecorrV_singleaccuracy_d (gmx_simd_double_t z2) |
Analytical PME potential correction, double SIMD data, single accuracy. More... | |