From Jason Turner

[simd.math]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpog7drklb/{from.md → to.md} +285 -0
tmp/tmpog7drklb/{from.md → to.md} RENAMED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Mathematical functions <a id="simd.math">[[simd.math]]</a>
2
+
3
+ ``` cpp
4
+ template<math-floating-point V>
5
+ constexpr rebind_t<int, deduced-vec-t<V>> ilogb(const V& x);
6
+ template<math-floating-point V>
7
+ constexpr deduced-vec-t<V> ldexp(const V& x, const rebind_t<int, deduced-vec-t<V>>& exp);
8
+ template<math-floating-point V>
9
+ constexpr deduced-vec-t<V> scalbn(const V& x, const rebind_t<int, deduced-vec-t<V>>& n);
10
+ template<math-floating-point V>
11
+ constexpr deduced-vec-t<V>
12
+ scalbln(const V& x, const rebind_t<long int, deduced-vec-t<V>>& n);
13
+ template<signed_integral T, class Abi>
14
+ constexpr basic_vec<T, Abi> abs(const basic_vec<T, Abi>& j);
15
+ template<math-floating-point V>
16
+ constexpr deduced-vec-t<V> abs(const V& j);
17
+ template<math-floating-point V>
18
+ constexpr deduced-vec-t<V> fabs(const V& x);
19
+ template<math-floating-point V>
20
+ constexpr deduced-vec-t<V> ceil(const V& x);
21
+ template<math-floating-point V>
22
+ constexpr deduced-vec-t<V> floor(const V& x);
23
+ template<math-floating-point V>
24
+ deduced-vec-t<V> nearbyint(const V& x);
25
+ template<math-floating-point V>
26
+ deduced-vec-t<V> rint(const V& x);
27
+ template<math-floating-point V>
28
+ rebind_t<long int, deduced-vec-t<V>> lrint(const V& x);
29
+ template<math-floating-point V>
30
+ rebind_t<long long int, deduced-vec-t<V>> llrint(const V& x);
31
+ template<math-floating-point V>
32
+ constexpr deduced-vec-t<V> round(const V& x);
33
+ template<math-floating-point V>
34
+ constexpr rebind_t<long int, deduced-vec-t<V>> lround(const V& x);
35
+ template<math-floating-point V>
36
+ constexpr rebind_t<long long int, deduced-vec-t<V>> llround(const V& x);
37
+ template<class V0, class V1>
38
+ constexpr math-common-simd-t<V0, V1> fmod(const V0& x, const V1& y);
39
+ template<math-floating-point V>
40
+ constexpr deduced-vec-t<V> trunc(const V& x);
41
+ template<class V0, class V1>
42
+ constexpr math-common-simd-t<V0, V1> remainder(const V0& x, const V1& y);
43
+ template<class V0, class V1>
44
+ constexpr math-common-simd-t<V0, V1> copysign(const V0& x, const V1& y);
45
+ template<class V0, class V1>
46
+ constexpr math-common-simd-t<V0, V1> nextafter(const V0& x, const V1& y);
47
+ template<class V0, class V1>
48
+ constexpr math-common-simd-t<V0, V1> fdim(const V0& x, const V1& y);
49
+ template<class V0, class V1>
50
+ constexpr math-common-simd-t<V0, V1> fmax(const V0& x, const V1& y);
51
+ template<class V0, class V1>
52
+ constexpr math-common-simd-t<V0, V1> fmin(const V0& x, const V1& y);
53
+ template<class V0, class V1, class V2>
54
+ constexpr math-common-simd-t<V0, V1, V2> fma(const V0& x, const V1& y, const V2& z);
55
+ template<math-floating-point V>
56
+ constexpr rebind_t<int, deduced-vec-t<V>> fpclassify(const V& x);
57
+ template<math-floating-point V>
58
+ constexpr typename deduced-vec-t<V>::mask_type isfinite(const V& x);
59
+ template<math-floating-point V>
60
+ constexpr typename deduced-vec-t<V>::mask_type isinf(const V& x);
61
+ template<math-floating-point V>
62
+ constexpr typename deduced-vec-t<V>::mask_type isnan(const V& x);
63
+ template<math-floating-point V>
64
+ constexpr typename deduced-vec-t<V>::mask_type isnormal(const V& x);
65
+ template<math-floating-point V>
66
+ constexpr typename deduced-vec-t<V>::mask_type signbit(const V& x);
67
+ template<class V0, class V1>
68
+ constexpr typename math-common-simd-t<V0, V1>::mask_type isgreater(const V0& x, const V1& y);
69
+ template<class V0, class V1>
70
+ constexpr typename math-common-simd-t<V0, V1>::mask_type
71
+ isgreaterequal(const V0& x, const V1& y);
72
+ template<class V0, class V1>
73
+ constexpr typename math-common-simd-t<V0, V1>::mask_type isless(const V0& x, const V1& y);
74
+ template<class V0, class V1>
75
+ constexpr typename math-common-simd-t<V0, V1>::mask_type islessequal(const V0& x, const V1& y);
76
+ template<class V0, class V1>
77
+ constexpr typename math-common-simd-t<V0, V1>::mask_type islessgreater(const V0& x, const V1& y);
78
+ template<class V0, class V1>
79
+ constexpr typename math-common-simd-t<V0, V1>::mask_type isunordered(const V0& x, const V1& y);
80
+ ```
81
+
82
+ Let `Ret` denote the return type of the specialization of a function
83
+ template with the name *`math-func`*. Let *`math-func-vec`* denote:
84
+
85
+ ``` cpp
86
+ template<class... Args>
87
+ Ret math-func-vec(Args... args) {
88
+ return Ret([&](simd-size-type i) {
89
+ return math-func(make-compatible-simd-t<Ret, Args>(args)[i]...);
90
+ });
91
+ }
92
+ ```
93
+
94
+ *Returns:* A value `ret` of type `Ret`, that is element-wise equal to
95
+ the result of calling *`math-func-vec`* with the arguments of the above
96
+ functions. If in an invocation of a scalar overload of *`math-func`* for
97
+ index `i` in *`math-func-vec`* a domain, pole, or range error would
98
+ occur, the value of `ret[i]` is unspecified.
99
+
100
+ *Remarks:* It is unspecified whether `errno` [[errno]] is accessed.
101
+
102
+ ``` cpp
103
+ template<math-floating-point V> constexpr deduced-vec-t<V> acos(const V& x);
104
+ template<math-floating-point V> constexpr deduced-vec-t<V> asin(const V& x);
105
+ template<math-floating-point V> constexpr deduced-vec-t<V> atan(const V& x);
106
+ template<class V0, class V1>
107
+ constexpr math-common-simd-t<V0, V1> atan2(const V0& y, const V1& x);
108
+ template<math-floating-point V> constexpr deduced-vec-t<V> cos(const V& x);
109
+ template<math-floating-point V> constexpr deduced-vec-t<V> sin(const V& x);
110
+ template<math-floating-point V> constexpr deduced-vec-t<V> tan(const V& x);
111
+ template<math-floating-point V> constexpr deduced-vec-t<V> acosh(const V& x);
112
+ template<math-floating-point V> constexpr deduced-vec-t<V> asinh(const V& x);
113
+ template<math-floating-point V> constexpr deduced-vec-t<V> atanh(const V& x);
114
+ template<math-floating-point V> constexpr deduced-vec-t<V> cosh(const V& x);
115
+ template<math-floating-point V> constexpr deduced-vec-t<V> sinh(const V& x);
116
+ template<math-floating-point V> constexpr deduced-vec-t<V> tanh(const V& x);
117
+ template<math-floating-point V> constexpr deduced-vec-t<V> exp(const V& x);
118
+ template<math-floating-point V> constexpr deduced-vec-t<V> exp2(const V& x);
119
+ template<math-floating-point V> constexpr deduced-vec-t<V> expm1(const V& x);
120
+ template<math-floating-point V> constexpr deduced-vec-t<V> log(const V& x);
121
+ template<math-floating-point V> constexpr deduced-vec-t<V> log10(const V& x);
122
+ template<math-floating-point V> constexpr deduced-vec-t<V> log1p(const V& x);
123
+ template<math-floating-point V> constexpr deduced-vec-t<V> log2(const V& x);
124
+ template<math-floating-point V> constexpr deduced-vec-t<V> logb(const V& x);
125
+ template<math-floating-point V> constexpr deduced-vec-t<V> cbrt(const V& x);
126
+ template<class V0, class V1>
127
+ constexpr math-common-simd-t<V0, V1> hypot(const V0& x, const V1& y);
128
+ template<class V0, class V1, class V2>
129
+ constexpr math-common-simd-t<V0, V1, V2> hypot(const V0& x, const V1& y, const V2& z);
130
+ template<class V0, class V1>
131
+ constexpr math-common-simd-t<V0, V1> pow(const V0& x, const V1& y);
132
+ template<math-floating-point V> constexpr deduced-vec-t<V> sqrt(const V& x);
133
+ template<math-floating-point V> constexpr deduced-vec-t<V> erf(const V& x);
134
+ template<math-floating-point V> constexpr deduced-vec-t<V> erfc(const V& x);
135
+ template<math-floating-point V> constexpr deduced-vec-t<V> lgamma(const V& x);
136
+ template<math-floating-point V> constexpr deduced-vec-t<V> tgamma(const V& x);
137
+ template<class V0, class V1, class V2>
138
+ constexpr math-common-simd-t<V0, V1, V2> lerp(const V0& a, const V1& b, const V2& t) noexcept;
139
+ template<math-floating-point V>
140
+ deduced-vec-t<V> assoc_laguerre(const rebind_t<unsigned, deduced-vec-t<V>>& n, const
141
+ rebind_t<unsigned, deduced-vec-t<V>>& m, const V& x);
142
+ template<math-floating-point V>
143
+ deduced-vec-t<V> assoc_legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l, const
144
+ rebind_t<unsigned, deduced-vec-t<V>>& m, const V& x);
145
+ template<class V0, class V1>
146
+ math-common-simd-t<V0, V1> beta(const V0& x, const V1& y);
147
+ template<math-floating-point V> deduced-vec-t<V> comp_ellint_1(const V& k);
148
+ template<math-floating-point V> deduced-vec-t<V> comp_ellint_2(const V& k);
149
+ template<class V0, class V1>
150
+ math-common-simd-t<V0, V1> comp_ellint_3(const V0& k, const V1& nu);
151
+ template<class V0, class V1>
152
+ math-common-simd-t<V0, V1> cyl_bessel_i(const V0& nu, const V1& x);
153
+ template<class V0, class V1>
154
+ math-common-simd-t<V0, V1> cyl_bessel_j(const V0& nu, const V1& x);
155
+ template<class V0, class V1>
156
+ math-common-simd-t<V0, V1> cyl_bessel_k(const V0& nu, const V1& x);
157
+ template<class V0, class V1>
158
+ math-common-simd-t<V0, V1> cyl_neumann(const V0& nu, const V1& x);
159
+ template<class V0, class V1>
160
+ math-common-simd-t<V0, V1> ellint_1(const V0& k, const V1& phi);
161
+ template<class V0, class V1>
162
+ math-common-simd-t<V0, V1> ellint_2(const V0& k, const V1& phi);
163
+ template<class V0, class V1, class V2>
164
+ math-common-simd-t<V0, V1, V2> ellint_3(const V0& k, const V1& nu, const V2& phi);
165
+ template<math-floating-point V> deduced-vec-t<V> expint(const V& x);
166
+ template<math-floating-point V> deduced-vec-t<V> hermite(const rebind_t<unsigned,
167
+ deduced-vec-t<V>>& n, const V& x);
168
+ template<math-floating-point V> deduced-vec-t<V> laguerre(const rebind_t<unsigned,
169
+ deduced-vec-t<V>>& n, const V& x);
170
+ template<math-floating-point V> deduced-vec-t<V> legendre(const rebind_t<unsigned,
171
+ deduced-vec-t<V>>& l, const V& x);
172
+ template<math-floating-point V> deduced-vec-t<V> riemann_zeta(const V& x);
173
+ template<math-floating-point V> deduced-vec-t<V> sph_bessel(const rebind_t<unsigned,
174
+ deduced-vec-t<V>>& n, const V& x);
175
+ template<math-floating-point V>
176
+ deduced-vec-t<V> sph_legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l,
177
+ const rebind_t<unsigned, deduced-vec-t<V>>& m,
178
+ const V& theta);
179
+ template<math-floating-point V> deduced-vec-t<V> sph_neumann(const rebind_t<unsigned,
180
+ deduced-vec-t<V>>& n, const V& x);
181
+ ```
182
+
183
+ Let `Ret` denote the return type of the specialization of a function
184
+ template with the name *`math-func`*. Let *`math-func-vec`* denote:
185
+
186
+ ``` cpp
187
+ template<class... Args>
188
+ Ret math-func-vec(Args... args) {
189
+ return Ret([&](simd-size-type i) {
190
+ return math-func(make-compatible-simd-t<Ret, Args>(args)[i]...);
191
+ });
192
+ }
193
+ ```
194
+
195
+ *Returns:* A value `ret` of type `Ret`, that is element-wise
196
+ approximately equal to the result of calling *`math-func-vec`* with the
197
+ arguments of the above functions. If in an invocation of a scalar
198
+ overload of *`math-func`* for index `i` in *`math-func-vec`* a domain,
199
+ pole, or range error would occur, the value of `ret[i]` is unspecified.
200
+
201
+ *Remarks:* It is unspecified whether `errno` [[errno]] is accessed.
202
+
203
+ ``` cpp
204
+ template<math-floating-point V>
205
+ constexpr deduced-vec-t<V> frexp(const V& value, rebind_t<int, deduced-vec-t<V>>* exp);
206
+ ```
207
+
208
+ Let `Ret` be *`deduced-vec-t`*`<V>`. Let *`frexp-vec`* denote:
209
+
210
+ ``` cpp
211
+ template<class V>
212
+ pair<Ret, rebind_t<int, Ret>> frexp-vec(const V& x) {
213
+ int r1[Ret::size()];
214
+ Ret r0([&](simd-size-type i) {
215
+ return frexp(make-compatible-simd-t<Ret, V>(x)[i], &r1[i]);
216
+ });
217
+ return {r0, rebind_t<int, Ret>(r1)};
218
+ }
219
+ ```
220
+
221
+ Let `ret` be a value of type `pair<Ret, rebind_t<int, Ret>>` that is the
222
+ same value as the result of calling *`frexp-vec`*`(x)`.
223
+
224
+ *Effects:* Sets `*exp` to `ret.second`.
225
+
226
+ *Returns:* `ret.first`.
227
+
228
+ ``` cpp
229
+ template<class V0, class V1>
230
+ constexpr math-common-simd-t<V0, V1> remquo(const V0& x, const V1& y,
231
+ rebind_t<int, math-common-simd-t<V0, V1>>* quo);
232
+ ```
233
+
234
+ Let `Ret` be *`math-common-simd-t`*`<V0, V1>`. Let *`remquo-vec`*
235
+ denote:
236
+
237
+ ``` cpp
238
+ template<class V0, class V1>
239
+ pair<Ret, rebind_t<int, Ret>> remquo-vec(const V0& x, const V1& y) {
240
+ int r1[Ret::size()];
241
+ Ret r0([&](simd-size-type i) {
242
+ return remquo(make-compatible-simd-t<Ret, V0>(x)[i],
243
+ make-compatible-simd-t<Ret, V1>(y)[i], &r1[i]);
244
+ });
245
+ return {r0, rebind_t<int, Ret>(r1)};
246
+ }
247
+ ```
248
+
249
+ Let `ret` be a value of type `pair<Ret, rebind_t<int, Ret>>` that is the
250
+ same value as the result of calling *`remquo-vec`*`(x, y)`. If in an
251
+ invocation of a scalar overload of `remquo` for index `i` in
252
+ *`remquo-vec`* a domain, pole, or range error would occur, the value of
253
+ `ret[i]` is unspecified.
254
+
255
+ *Effects:* Sets `*quo` to `ret.second`.
256
+
257
+ *Returns:* `ret.first`.
258
+
259
+ *Remarks:* It is unspecified whether `errno` [[errno]] is accessed.
260
+
261
+ ``` cpp
262
+ template<class T, class Abi>
263
+ constexpr basic_vec<T, Abi> modf(const type_identity_t<basic_vec<T, Abi>>& value,
264
+ basic_vec<T, Abi>* iptr);
265
+ ```
266
+
267
+ Let `V` be `basic_vec<T, Abi>`. Let *`modf-vec`* denote:
268
+
269
+ ``` cpp
270
+ pair<V, V> modf-vec(const V& x) {
271
+ T r1[Ret::size()];
272
+ V r0([&](simd-size-type i) {
273
+ return modf(V(x)[i], &r1[i]);
274
+ });
275
+ return {r0, V(r1)};
276
+ }
277
+ ```
278
+
279
+ Let `ret` be a value of type `pair<V, V>` that is the same value as the
280
+ result of calling *`modf-vec`*`(value)`.
281
+
282
+ *Effects:* Sets `*iptr` to `ret.second`.
283
+
284
+ *Returns:* `ret.first`.
285
+