Logo ROOT   6.18/05
Reference Guide
RVec.cxx
Go to the documentation of this file.
1#include "ROOT/RVec.hxx"
2
3#if (_VECOPS_USE_EXTERN_TEMPLATES)
4
5namespace ROOT {
6namespace VecOps {
7
8#define RVEC_DECLARE_UNARY_OPERATOR(T, OP) \
9 template RVec<T> operator OP(const RVec<T> &);
10
11#define RVEC_DECLARE_BINARY_OPERATOR(T, OP) \
12 template auto operator OP(const RVec<T> &v, const T &y) -> RVec<decltype(v[0] OP y)>; \
13 template auto operator OP(const T &x, const RVec<T> &v) -> RVec<decltype(x OP v[0])>; \
14 template auto operator OP(const RVec<T> &v0, const RVec<T> &v1) -> RVec<decltype(v0[0] OP v1[0])>;
15
16#define RVEC_DECLARE_LOGICAL_OPERATOR(T, OP) \
17 template RVec<int> operator OP(const RVec<T> &, const T &); \
18 template RVec<int> operator OP(const T &, const RVec<T> &); \
19 template RVec<int> operator OP(const RVec<T> &, const RVec<T> &);
20
21#define RVEC_DECLARE_ASSIGN_OPERATOR(T, OP) \
22 template RVec<T> &operator OP(RVec<T> &, const T &); \
23 template RVec<T> &operator OP(RVec<T> &, const RVec<T> &);
24
25#define RVEC_DECLARE_FLOAT_TEMPLATE(T) \
26 template class RVec<T>; \
27 RVEC_DECLARE_UNARY_OPERATOR(T, +) \
28 RVEC_DECLARE_UNARY_OPERATOR(T, -) \
29 RVEC_DECLARE_UNARY_OPERATOR(T, !) \
30 RVEC_DECLARE_BINARY_OPERATOR(T, +) \
31 RVEC_DECLARE_BINARY_OPERATOR(T, -) \
32 RVEC_DECLARE_BINARY_OPERATOR(T, *) \
33 RVEC_DECLARE_BINARY_OPERATOR(T, /) \
34 RVEC_DECLARE_ASSIGN_OPERATOR(T, +=) \
35 RVEC_DECLARE_ASSIGN_OPERATOR(T, -=) \
36 RVEC_DECLARE_ASSIGN_OPERATOR(T, *=) \
37 RVEC_DECLARE_ASSIGN_OPERATOR(T, /=) \
38 RVEC_DECLARE_LOGICAL_OPERATOR(T, <) \
39 RVEC_DECLARE_LOGICAL_OPERATOR(T, >) \
40 RVEC_DECLARE_LOGICAL_OPERATOR(T, ==) \
41 RVEC_DECLARE_LOGICAL_OPERATOR(T, !=) \
42 RVEC_DECLARE_LOGICAL_OPERATOR(T, <=) \
43 RVEC_DECLARE_LOGICAL_OPERATOR(T, >=) \
44 RVEC_DECLARE_LOGICAL_OPERATOR(T, &&) \
45 RVEC_DECLARE_LOGICAL_OPERATOR(T, ||)
46
47#define RVEC_DECLARE_INTEGER_TEMPLATE(T) \
48 template class RVec<T>; \
49 RVEC_DECLARE_UNARY_OPERATOR(T, +) \
50 RVEC_DECLARE_UNARY_OPERATOR(T, -) \
51 RVEC_DECLARE_UNARY_OPERATOR(T, ~) \
52 RVEC_DECLARE_UNARY_OPERATOR(T, !) \
53 RVEC_DECLARE_BINARY_OPERATOR(T, +) \
54 RVEC_DECLARE_BINARY_OPERATOR(T, -) \
55 RVEC_DECLARE_BINARY_OPERATOR(T, *) \
56 RVEC_DECLARE_BINARY_OPERATOR(T, /) \
57 RVEC_DECLARE_BINARY_OPERATOR(T, %) \
58 RVEC_DECLARE_BINARY_OPERATOR(T, &) \
59 RVEC_DECLARE_BINARY_OPERATOR(T, |) \
60 RVEC_DECLARE_BINARY_OPERATOR(T, ^) \
61 RVEC_DECLARE_ASSIGN_OPERATOR(T, +=) \
62 RVEC_DECLARE_ASSIGN_OPERATOR(T, -=) \
63 RVEC_DECLARE_ASSIGN_OPERATOR(T, *=) \
64 RVEC_DECLARE_ASSIGN_OPERATOR(T, /=) \
65 RVEC_DECLARE_ASSIGN_OPERATOR(T, %=) \
66 RVEC_DECLARE_ASSIGN_OPERATOR(T, &=) \
67 RVEC_DECLARE_ASSIGN_OPERATOR(T, |=) \
68 RVEC_DECLARE_ASSIGN_OPERATOR(T, ^=) \
69 RVEC_DECLARE_ASSIGN_OPERATOR(T, >>=) \
70 RVEC_DECLARE_ASSIGN_OPERATOR(T, <<=) \
71 RVEC_DECLARE_LOGICAL_OPERATOR(T, <) \
72 RVEC_DECLARE_LOGICAL_OPERATOR(T, >) \
73 RVEC_DECLARE_LOGICAL_OPERATOR(T, ==) \
74 RVEC_DECLARE_LOGICAL_OPERATOR(T, !=) \
75 RVEC_DECLARE_LOGICAL_OPERATOR(T, <=) \
76 RVEC_DECLARE_LOGICAL_OPERATOR(T, >=) \
77 RVEC_DECLARE_LOGICAL_OPERATOR(T, &&) \
78 RVEC_DECLARE_LOGICAL_OPERATOR(T, ||)
79
80RVEC_DECLARE_INTEGER_TEMPLATE(char)
81RVEC_DECLARE_INTEGER_TEMPLATE(short)
82RVEC_DECLARE_INTEGER_TEMPLATE(int)
83RVEC_DECLARE_INTEGER_TEMPLATE(long)
84RVEC_DECLARE_INTEGER_TEMPLATE(long long)
85
86RVEC_DECLARE_INTEGER_TEMPLATE(unsigned char)
87RVEC_DECLARE_INTEGER_TEMPLATE(unsigned short)
88RVEC_DECLARE_INTEGER_TEMPLATE(unsigned int)
89RVEC_DECLARE_INTEGER_TEMPLATE(unsigned long)
90RVEC_DECLARE_INTEGER_TEMPLATE(unsigned long long)
91
92RVEC_DECLARE_FLOAT_TEMPLATE(float)
93RVEC_DECLARE_FLOAT_TEMPLATE(double)
94
95#define RVEC_DECLARE_UNARY_FUNCTION(T, NAME, FUNC) \
96 template RVec<PromoteType<T>> NAME(const RVec<T> &);
97
98#define RVEC_DECLARE_STD_UNARY_FUNCTION(T, F) RVEC_DECLARE_UNARY_FUNCTION(T, F, ::std::F)
99
100#define RVEC_DECLARE_BINARY_FUNCTION(T0, T1, NAME, FUNC) \
101 template RVec<PromoteTypes<T0, T1>> NAME(const RVec<T0> &v, const T1 &y); \
102 template RVec<PromoteTypes<T0, T1>> NAME(const T0 &x, const RVec<T1> &v); \
103 template RVec<PromoteTypes<T0, T1>> NAME(const RVec<T0> &v0, const RVec<T1> &v1);
104
105#define RVEC_DECLARE_STD_BINARY_FUNCTION(T, F) RVEC_DECLARE_BINARY_FUNCTION(T, T, F, ::std::F)
106
107#define RVEC_DECLARE_STD_FUNCTIONS(T) \
108 RVEC_DECLARE_STD_UNARY_FUNCTION(T, abs) \
109 RVEC_DECLARE_STD_BINARY_FUNCTION(T, fdim) \
110 RVEC_DECLARE_STD_BINARY_FUNCTION(T, fmod) \
111 RVEC_DECLARE_STD_BINARY_FUNCTION(T, remainder) \
112 RVEC_DECLARE_STD_UNARY_FUNCTION(T, exp) \
113 RVEC_DECLARE_STD_UNARY_FUNCTION(T, exp2) \
114 RVEC_DECLARE_STD_UNARY_FUNCTION(T, expm1) \
115 RVEC_DECLARE_STD_UNARY_FUNCTION(T, log) \
116 RVEC_DECLARE_STD_UNARY_FUNCTION(T, log10) \
117 RVEC_DECLARE_STD_UNARY_FUNCTION(T, log2) \
118 RVEC_DECLARE_STD_UNARY_FUNCTION(T, log1p) \
119 RVEC_DECLARE_STD_BINARY_FUNCTION(T, pow) \
120 RVEC_DECLARE_STD_UNARY_FUNCTION(T, sqrt) \
121 RVEC_DECLARE_STD_UNARY_FUNCTION(T, cbrt) \
122 RVEC_DECLARE_STD_BINARY_FUNCTION(T, hypot) \
123 RVEC_DECLARE_STD_UNARY_FUNCTION(T, sin) \
124 RVEC_DECLARE_STD_UNARY_FUNCTION(T, cos) \
125 RVEC_DECLARE_STD_UNARY_FUNCTION(T, tan) \
126 RVEC_DECLARE_STD_UNARY_FUNCTION(T, asin) \
127 RVEC_DECLARE_STD_UNARY_FUNCTION(T, acos) \
128 RVEC_DECLARE_STD_UNARY_FUNCTION(T, atan) \
129 RVEC_DECLARE_STD_BINARY_FUNCTION(T, atan2) \
130 RVEC_DECLARE_STD_UNARY_FUNCTION(T, sinh) \
131 RVEC_DECLARE_STD_UNARY_FUNCTION(T, cosh) \
132 RVEC_DECLARE_STD_UNARY_FUNCTION(T, tanh) \
133 RVEC_DECLARE_STD_UNARY_FUNCTION(T, asinh) \
134 RVEC_DECLARE_STD_UNARY_FUNCTION(T, acosh) \
135 RVEC_DECLARE_STD_UNARY_FUNCTION(T, atanh) \
136 RVEC_DECLARE_STD_UNARY_FUNCTION(T, floor) \
137 RVEC_DECLARE_STD_UNARY_FUNCTION(T, ceil) \
138 RVEC_DECLARE_STD_UNARY_FUNCTION(T, trunc) \
139 RVEC_DECLARE_STD_UNARY_FUNCTION(T, round) \
140 RVEC_DECLARE_STD_UNARY_FUNCTION(T, lround) \
141 RVEC_DECLARE_STD_UNARY_FUNCTION(T, llround) \
142 RVEC_DECLARE_STD_UNARY_FUNCTION(T, erf) \
143 RVEC_DECLARE_STD_UNARY_FUNCTION(T, erfc) \
144 RVEC_DECLARE_STD_UNARY_FUNCTION(T, lgamma) \
145 RVEC_DECLARE_STD_UNARY_FUNCTION(T, tgamma) \
146
147RVEC_DECLARE_STD_FUNCTIONS(float)
148RVEC_DECLARE_STD_FUNCTIONS(double)
149#undef RVEC_DECLARE_STD_UNARY_FUNCTION
150#undef RVEC_DECLARE_STD_BINARY_FUNCTION
151#undef RVEC_DECLARE_STD_UNARY_FUNCTIONS
152
153#ifdef R__HAS_VDT
154
155#define RVEC_DECLARE_VDT_UNARY_FUNCTION(T, F) \
156 RVEC_DECLARE_UNARY_FUNCTION(T, F, vdt::F)
157
158RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_expf)
159RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_logf)
160RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_sinf)
161RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_cosf)
162RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_tanf)
163RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_asinf)
164RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_acosf)
165RVEC_DECLARE_VDT_UNARY_FUNCTION(float, fast_atanf)
166
167RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_exp)
168RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_log)
169RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_sin)
170RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_cos)
171RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_tan)
172RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_asin)
173RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_acos)
174RVEC_DECLARE_VDT_UNARY_FUNCTION(double, fast_atan)
175
176#endif // R__HAS_VDT
177
178} // namespace VecOps
179} // namespace ROOT
180
181#endif // _VECOPS_USE_EXTERN_TEMPLATES
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21