summaryrefslogtreecommitdiffstats
path: root/mathfuncs_base.h
blob: 22df2225b0e740a1656f0c3b43eea10ee371efd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// -*-C++-*-

#ifndef MATHFUNCS_BASE_H
#define MATHFUNCS_BASE_H

#include "floatprops.h"
#include "vec_base.h"



namespace vecmathlib {
  
  template<typename realvec_t>
  struct mathfuncs {
    typedef floatprops<typename realvec_t::real_t> FP;
    
    typedef typename FP::real_t real_t;
    typedef typename FP::int_t int_t;
    typedef typename FP::uint_t uint_t;
    
    static int const size = realvec_t::size;
    
    // typedef realvec<real_t, size> realvec_t;
    typedef typename realvec_t::intvec_t intvec_t;
    typedef typename realvec_t::boolvec_t boolvec_t;
    
    // Short names for type casts
    typedef real_t R;
    typedef int_t I;
    typedef uint_t U;
    typedef realvec_t RV;
    typedef intvec_t IV;
    typedef boolvec_t BV;
    // static real_t R(double a) { return real_t(a); }
    // static int_t I(int a) { return int_t(a); }
    // static uint_t U(int a) { return uint_t(a); }
    // static realvec_t RV(real_t a) { return realvec_t(a); }
    // static intvec_t IV(int_t a) { return intvec_t(a); }
    // static boolvec_t BV(bool a) { return boolvec_t(a); }
    
    // asin
    static realvec_t vml_acos(realvec_t x);
    static realvec_t vml_asin(realvec_t x);
    static realvec_t vml_atan(realvec_t x);
    
    // asinh
    static realvec_t vml_acosh(realvec_t x);
    static realvec_t vml_asinh(realvec_t x);
    static realvec_t vml_atanh(realvec_t x);
    
    // convert
    static realvec_t vml_antitrunc(realvec_t x);
    static realvec_t vml_ceil(realvec_t x);
    static realvec_t vml_convert_float(intvec_t x);
    static intvec_t vml_convert_int(realvec_t x);
    static realvec_t vml_floor(realvec_t x);
    static realvec_t vml_rint(realvec_t x);
    static realvec_t vml_round(realvec_t x);
    static realvec_t vml_trunc(realvec_t x);
    
    // fabs
    static realvec_t vml_copysign(realvec_t x, realvec_t y);
    static realvec_t vml_fabs(realvec_t x);
    static realvec_t vml_fdim(realvec_t x, realvec_t y);
    static realvec_t vml_fma(realvec_t x, realvec_t y, realvec_t z);
    static realvec_t vml_fmax(realvec_t x, realvec_t y);
    static realvec_t vml_fmin(realvec_t x, realvec_t y);
    static intvec_t vml_ilogb(realvec_t x);
    static boolvec_t vml_ieee_isfinite(realvec_t x);
    static boolvec_t vml_ieee_isinf(realvec_t x);
    static boolvec_t vml_ieee_isnan(realvec_t x);
    static boolvec_t vml_ieee_isnormal(realvec_t x);
    static boolvec_t vml_isfinite(realvec_t x);
    static boolvec_t vml_isinf(realvec_t x);
    static boolvec_t vml_isnan(realvec_t x);
    static boolvec_t vml_isnormal(realvec_t x);
    static realvec_t vml_ldexp(realvec_t x, intvec_t n);
    static boolvec_t vml_signbit(realvec_t x);
    
    // exp
    static realvec_t vml_exp(realvec_t x);
    static realvec_t vml_exp10(realvec_t x);
    static realvec_t vml_exp2(realvec_t x);
    static realvec_t vml_expm1(realvec_t x);
    
    // log
    static realvec_t vml_log(realvec_t x);
    static realvec_t vml_log10(realvec_t x);
    static realvec_t vml_log1p(realvec_t x);
    static realvec_t vml_log2(realvec_t x);
    
    // pow
    static realvec_t vml_pow(realvec_t x, realvec_t y);
    
    // rcp
    static realvec_t vml_fmod(realvec_t x, realvec_t y);
    static realvec_t vml_rcp(realvec_t x);
    static realvec_t vml_remainder(realvec_t x, realvec_t y);
    
    // sin
    static realvec_t vml_cos(realvec_t x);
    static realvec_t vml_sin(realvec_t x);
    static realvec_t vml_tan(realvec_t x);
    
    // sinh
    static realvec_t vml_cosh(realvec_t x);
    static realvec_t vml_sinh(realvec_t x);
    static realvec_t vml_tanh(realvec_t x);
    
    // sqrt
    static realvec_t vml_cbrt(realvec_t x);
    static realvec_t vml_hypot(realvec_t x, realvec_t y);
    static realvec_t vml_rsqrt(realvec_t x);
    static realvec_t vml_sqrt(realvec_t x);
  };
  
} // namespace vecmathlib

#endif  // #ifndef MATHFUNCS_BASE_H
OpenPOWER on IntegriCloud