vSMC  v3.0.0
Scalable Monte Carlo
vmath.hpp
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/math/vmath.hpp
3 //----------------------------------------------------------------------------
4 // vSMC: Scalable Monte Carlo
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013-2016, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef VSMC_MATH_VMATH_HPP
33 #define VSMC_MATH_VMATH_HPP
34 
35 #include <vsmc/internal/basic.hpp>
36 #include <vsmc/math/constants.hpp>
37 
38 #if VSMC_USE_MKL_VML
39 #include <mkl_vml.h>
40 #elif VSMC_USE_ACCELERATE
41 #include <Accelerate/Accelerate.h>
42 #endif
43 
44 #if VSMC_USE_MKL_VML
45 
46 #define VSMC_DEFINE_MATH_VMATH_VML_1(func, name) \
47  inline void name(std::size_t n, const float *a, float *y) \
48  { \
49  internal::size_check<MKL_INT>(n, #name); \
50  ::vs##func(static_cast<MKL_INT>(n), a, y); \
51  } \
52  inline void name(std::size_t n, const double *a, double *y) \
53  { \
54  internal::size_check<MKL_INT>(n, #name); \
55  ::vd##func(static_cast<MKL_INT>(n), a, y); \
56  }
57 
58 #define VSMC_DEFINE_MATH_VMATH_VML_2(func, name) \
59  inline void name(std::size_t n, const float *a, const float *b, float *y) \
60  { \
61  internal::size_check<MKL_INT>(n, #name); \
62  ::vs##func(static_cast<MKL_INT>(n), a, b, y); \
63  } \
64  inline void name( \
65  std::size_t n, const double *a, const double *b, double *y) \
66  { \
67  internal::size_check<MKL_INT>(n, #name); \
68  ::vd##func(static_cast<MKL_INT>(n), a, b, y); \
69  }
70 
71 namespace vsmc
72 {
73 
79 inline void linear_frac(std::size_t n, const float *a, const float *b,
80  float beta_a, float beta_b, float mu_a, float mu_b, float *y)
81 {
82  internal::size_check<MKL_INT>(n, "linear_frac");
83  ::vsLinearFrac(
84  static_cast<MKL_INT>(n), a, b, beta_a, beta_b, mu_a, mu_b, y);
85 }
86 inline void linear_frac(std::size_t n, const double *a, const double *b,
87  double beta_a, double beta_b, double mu_a, double mu_b, double *y)
88 {
89  internal::size_check<MKL_INT>(n, "linear_frac");
90  ::vdLinearFrac(
91  static_cast<MKL_INT>(n), a, b, beta_a, beta_b, mu_a, mu_b, y);
92 }
93 
103 inline void pow(std::size_t n, const float *a, float b, float *y)
104 {
105  internal::size_check<MKL_INT>(n, "pow");
106  ::vsPowx(static_cast<MKL_INT>(n), a, b, y);
107 }
108 inline void pow(std::size_t n, const double *a, double b, double *y)
109 {
110  internal::size_check<MKL_INT>(n, "pow");
111  ::vdPowx(static_cast<MKL_INT>(n), a, b, y);
112 }
114 
120 
123 inline void sincos(std::size_t n, const float *a, float *y, float *z)
124 {
125  internal::size_check<MKL_INT>(n, "sincos");
126  ::vsSinCos(static_cast<MKL_INT>(n), a, y, z);
127 }
128 inline void sincos(std::size_t n, const double *a, double *y, double *z)
129 {
130  internal::size_check<MKL_INT>(n, "sincos");
131  ::vdSinCos(static_cast<MKL_INT>(n), a, y, z);
132 }
138 
145 
154 
159 inline void modf(std::size_t n, const float *a, float *y, float *z)
160 {
161  internal::size_check<MKL_INT>(n, "modf");
162  ::vsModf(static_cast<MKL_INT>(n), a, y, z);
163 }
164 inline void modf(std::size_t n, const double *a, double *y, double *z)
165 {
166  internal::size_check<MKL_INT>(n, "modf");
167  ::vdModf(static_cast<MKL_INT>(n), a, y, z);
168 }
169 
170 } // namespace vsmc
171 
172 #elif VSMC_USE_ACCELERATE
173 
174 #define VSMC_DEFINE_MATH_VMATH_VFORCE_1(func, name) \
175  inline void name(std::size_t n, const float *a, float *y) \
176  { \
177  internal::size_check<int>(n, #name); \
178  int m = static_cast<int>(n); \
179  ::vv##func##f(y, a, &m); \
180  } \
181  inline void name(std::size_t n, const double *a, double *y) \
182  { \
183  internal::size_check<int>(n, #name); \
184  int m = static_cast<int>(n); \
185  ::vv##func(y, a, &m); \
186  }
187 
188 #define VSMC_DEFINE_MATH_VMATH_VFORCE_2(func, name) \
189  inline void name(std::size_t n, const float *a, const float *b, float *y) \
190  { \
191  internal::size_check<int>(n, #name); \
192  int m = static_cast<int>(n); \
193  ::vv##func##f(y, a, b, &m); \
194  } \
195  inline void name( \
196  std::size_t n, const double *a, const double *b, double *y) \
197  { \
198  internal::size_check<int>(n, #name); \
199  int m = static_cast<int>(n); \
200  ::vv##func(y, a, b, &m); \
201  }
202 
203 namespace vsmc
204 {
205 
206 VSMC_DEFINE_MATH_VMATH_VFORCE_1(fabs, abs)
207 
208 VSMC_DEFINE_MATH_VMATH_VFORCE_2(div, div)
209 VSMC_DEFINE_MATH_VMATH_VFORCE_1(sqrt, sqrt)
210 VSMC_DEFINE_MATH_VMATH_VFORCE_1(cbrt, cbrt)
211 VSMC_DEFINE_MATH_VMATH_VFORCE_2(pow, pow)
212 
213 VSMC_DEFINE_MATH_VMATH_VFORCE_1(exp, exp)
214 VSMC_DEFINE_MATH_VMATH_VFORCE_1(expm1, expm1)
215 VSMC_DEFINE_MATH_VMATH_VFORCE_1(log, log)
216 VSMC_DEFINE_MATH_VMATH_VFORCE_1(log10, log10)
217 VSMC_DEFINE_MATH_VMATH_VFORCE_1(log1p, log1p)
218 
219 VSMC_DEFINE_MATH_VMATH_VFORCE_1(cos, cos)
220 VSMC_DEFINE_MATH_VMATH_VFORCE_1(sin, sin)
221 inline void sincos(std::size_t n, const float *a, float *y, float *z)
222 {
223  internal::size_check<int>(n, "sincos");
224  const int m = static_cast<int>(n);
225  ::vvsincosf(y, z, a, &m);
226 }
227 inline void sincos(std::size_t n, const double *a, double *y, double *z)
228 {
229  internal::size_check<int>(n, "sincos");
230  const int m = static_cast<int>(n);
231  ::vvsincos(y, z, a, &m);
232 }
233 VSMC_DEFINE_MATH_VMATH_VFORCE_1(tan, tan)
234 VSMC_DEFINE_MATH_VMATH_VFORCE_1(acos, acos)
235 VSMC_DEFINE_MATH_VMATH_VFORCE_1(asin, asin)
236 VSMC_DEFINE_MATH_VMATH_VFORCE_1(atan, atan)
237 VSMC_DEFINE_MATH_VMATH_VFORCE_2(atan2, atan2)
238 
239 VSMC_DEFINE_MATH_VMATH_VFORCE_1(cosh, cosh)
240 VSMC_DEFINE_MATH_VMATH_VFORCE_1(sinh, sinh)
241 VSMC_DEFINE_MATH_VMATH_VFORCE_1(tanh, tanh)
242 VSMC_DEFINE_MATH_VMATH_VFORCE_1(acosh, acosh)
243 VSMC_DEFINE_MATH_VMATH_VFORCE_1(asinh, asinh)
244 VSMC_DEFINE_MATH_VMATH_VFORCE_1(atanh, atanh)
245 
246 VSMC_DEFINE_MATH_VMATH_VFORCE_1(floor, floor)
247 VSMC_DEFINE_MATH_VMATH_VFORCE_1(ceil, ceil)
248 
249 } // namespace vsmc
250 
251 #endif // VSMC_USE_MKL_VML
252 
253 #define VSMC_DEFINE_MATH_VMATH_1(func, name) \
254  template <typename T> \
255  inline void name(std::size_t n, const T *a, T *y) \
256  { \
257  for (std::size_t i = 0; i != n; ++i) \
258  y[i] = func(a[i]); \
259  }
260 
261 #define VSMC_DEFINE_MATH_VMATH_2(func, name) \
262  template <typename T> \
263  inline void name(std::size_t n, const T *a, const T *b, T *y) \
264  { \
265  for (std::size_t i = 0; i != n; ++i) \
266  y[i] = func(a[i], b[i]); \
267  }
268 
269 #define VSMC_DEFINE_MATH_VMATH_B(op, name) \
270  template <typename T> \
271  inline void name(std::size_t n, const T *a, const T *b, T *y) \
272  { \
273  for (std::size_t i = 0; i != n; ++i) \
274  y[i] = a[i] op b[i]; \
275  }
276 
277 #define VSMC_DEFINE_MATH_VMATH_VS(op, name) \
278  template <typename T> \
279  inline void name(std::size_t n, const T *a, T b, T *y) \
280  { \
281  for (std::size_t i = 0; i != n; ++i) \
282  y[i] = a[i] op b; \
283  }
284 
285 #define VSMC_DEFINE_MATH_VMATH_SV(op, name) \
286  template <typename T> \
287  inline void name(std::size_t n, T a, const T *b, T *y) \
288  { \
289  for (std::size_t i = 0; i != n; ++i) \
290  y[i] = a op b[i]; \
291  }
292 
293 namespace vsmc
294 {
295 
299 
302 
305 
308 
311 
313 VSMC_DEFINE_MATH_VMATH_VS(-, sub)
314 
317 
319 template <typename T>
320 inline void sqr(std::size_t n, const T *a, T *y)
321 {
322  for (std::size_t i = 0; i != n; ++i)
323  y[i] = a[i] * a[i];
324 }
325 
328 
331 
334 
337 
340 template <typename T>
341 inline void linear_frac(std::size_t n, const T *a, const T *b, T beta_a,
342  T beta_b, T mu_a, T mu_b, T *y)
343 {
344  const std::size_t k = internal::BufferSize<T>::value;
345  const std::size_t m = n / k;
346  const std::size_t l = n % k;
347  for (std::size_t i = 0; i != m; ++i, a += k, y += k) {
348  for (std::size_t j = 0; j != k; ++j)
349  y[j] = beta_a * a[j] + mu_a;
350  for (std::size_t j = 0; j != k; ++j)
351  y[j] /= beta_b * b[j] + mu_b;
352  }
353  for (std::size_t i = 0; i != l; ++i)
354  y[i] = beta_a * a[i] + mu_a;
355  for (std::size_t i = 0; i != l; ++i)
356  y[i] /= beta_b * b[i] + mu_b;
357 }
358 
360 template <typename T>
361 inline void fma(std::size_t n, const T *a, const T *b, const T *c, T *y)
362 {
363  for (std::size_t i = 0; i != n; ++i)
364  y[i] = a[i] * b[i] + c[i];
365 }
366 
368 template <typename T>
369 inline void fma(std::size_t n, const T *a, const T *b, T c, T *y)
370 {
371  if (internal::is_zero(c)) {
372  mul(n, a, b, y);
373  } else {
374  for (std::size_t i = 0; i != n; ++i)
375  y[i] = a[i] * b[i] + c;
376  }
377 }
378 
380 template <typename T>
381 inline void fma(std::size_t n, const T *a, T b, const T *c, T *y)
382 {
383  if (internal::is_one(b)) {
384  add(n, a, c, y);
385  } else {
386  for (std::size_t i = 0; i != n; ++i)
387  y[i] = a[i] * b + c[i];
388  }
389 }
390 
392 template <typename T>
393 inline void fma(std::size_t n, const T *a, T b, T c, T *y)
394 {
395  if (internal::is_one(b) && internal::is_zero(c)) {
396  std::copy_n(a, n, y);
397  } else if (internal::is_one(b)) {
398  add(n, a, c, y);
399  } else if (internal::is_zero(c)) {
400  mul(n, a, b, y);
401  } else {
402  for (std::size_t i = 0; i != n; ++i)
403  y[i] = a[i] * b + c;
404  }
405 }
406 
408 template <typename T>
409 inline void fma(std::size_t n, T a, const T *b, const T *c, T *y)
410 {
411  if (internal::is_one(a)) {
412  add(n, b, c, y);
413  } else {
414  for (std::size_t i = 0; i != n; ++i)
415  y[i] = a * b[i] + c[i];
416  }
417 }
418 
420 template <typename T>
421 inline void fma(std::size_t n, T a, const T *b, T c, T *y)
422 {
423  if (internal::is_zero(c)) {
424  mul(n, a, b, y);
425  } else {
426  for (std::size_t i = 0; i != n; ++i)
427  y[i] = a * b[i] + c;
428  }
429 }
430 
432 template <typename T>
433 inline void fma(std::size_t n, T a, T b, const T *c, T *y)
434 {
435  add(n, a * b, c, y);
436 }
437 
439 
443 
445 template <typename T>
446 inline void inv(std::size_t n, const T *a, T *y)
447 {
448  for (std::size_t i = 0; i != n; ++i)
449  y[i] = static_cast<T>(1) / a[i];
450 }
451 
454 
457 
460 
463 
465 template <typename T>
466 inline void invsqrt(std::size_t n, const T *a, T *y)
467 {
468  const std::size_t k = internal::BufferSize<T>::value;
469  const std::size_t m = n / k;
470  const std::size_t l = n % k;
471  for (std::size_t i = 0; i != m; ++i, a += k, y += k) {
472  sqrt(k, a, y);
473  inv(k, y, y);
474  }
475  sqrt(l, a, y);
476  inv(l, y, y);
477 }
478 
481 
482 template <typename T>
484 inline void invcbrt(std::size_t n, const T *a, T *y)
485 {
486  const std::size_t k = internal::BufferSize<T>::value;
487  const std::size_t m = n / k;
488  const std::size_t l = n % k;
489  for (std::size_t i = 0; i != m; ++i, a += k, y += k) {
490  cbrt(k, a, y);
491  inv(k, y, y);
492  }
493  cbrt(l, a, y);
494  inv(l, y, y);
495 }
496 
498 template <typename T>
499 inline void pow2o3(std::size_t n, const T *a, T *y)
500 {
501  const std::size_t k = internal::BufferSize<T>::value;
502  const std::size_t m = n / k;
503  const std::size_t l = n % k;
504  for (std::size_t i = 0; i != m; ++i, a += k, y += k) {
505  cbrt(k, a, y);
506  sqr(k, y, y);
507  }
508  cbrt(l, a, y);
509  sqr(l, y, y);
510 }
511 
513 template <typename T>
514 inline void pow3o2(std::size_t n, const T *a, T *y)
515 {
516  const std::size_t k = internal::BufferSize<T>::value;
517  const std::size_t m = n / k;
518  const std::size_t l = n % k;
519  for (std::size_t i = 0; i != m; ++i, a += k, y += k) {
520  sqrt(k, a, y);
521  for (std::size_t j = 0; j != k; ++j)
522  y[j] = y[j] * y[j] * y[j];
523  }
524  sqrt(l, a, y);
525  for (std::size_t i = 0; i != l; ++i)
526  y[i] = y[i] * y[i] * y[i];
527 }
528 
531 
532 template <typename T>
534 inline void pow(std::size_t n, const T *a, T b, T *y)
535 {
536  for (std::size_t i = 0; i != n; ++i)
537  y[i] = std::pow(a[i], b);
538 }
539 
542 
543 
548 
551 
554 
556 template <typename T>
557 inline void exp10(std::size_t n, const T *a, T *y)
558 {
559  const std::size_t k = internal::BufferSize<T>::value;
560  const std::size_t m = n / k;
561  const std::size_t l = n % k;
562  for (std::size_t i = 0; i != m; ++i, a += k, y += k) {
563  mul(k, const_ln_10<T>(), a, y);
564  exp(k, y, y);
565  }
566  mul(l, const_ln_10<T>(), a, y);
567  exp(l, y, y);
568 }
569 
572 
575 
578 
581 
584 
586 
590 
593 
596 
599 template <typename T>
600 inline void sincos(std::size_t n, const T *a, T *y, T *z)
601 {
602  const std::size_t k = internal::BufferSize<T>::value;
603  const std::size_t m = n / k;
604  const std::size_t l = n % k;
605  for (std::size_t i = 0; i != m; ++i, a += k, y += k, z += k) {
606  sin(k, a, y);
607  cos(k, a, z);
608  }
609  sin(l, a, y);
610  cos(l, a, z);
611 }
612 
615 
618 
621 
624 
628 
630 
634 
637 
640 
643 
646 
649 
652 
654 
658 
661 
665 
668 template <typename T>
669 inline void cdfnorm(std::size_t n, const T *a, T *y)
670 {
671  const std::size_t k = internal::BufferSize<T>::value;
672  const std::size_t m = n / k;
673  const std::size_t l = n % k;
674  for (std::size_t i = 0; i != m; ++i, a += k, y += k) {
675  mul(k, static_cast<T>(1) / const_sqrt_2<T>(), a, y);
676  erf(k, y, y);
677  fma(k, static_cast<T>(0.5), static_cast<T>(0.5), y, y);
678  }
679  mul(l, static_cast<T>(1) / const_sqrt_2<T>(), a, y);
680  erf(l, y, y);
681  fma(l, static_cast<T>(0.5), static_cast<T>(0.5), y, y);
682 }
683 
686 
689 
692 
695 
699 
702 
704 template <typename T>
705 inline void modf(std::size_t n, const T *a, T *y, T *z)
706 {
707  for (std::size_t i = 0; i != n; ++i, ++a, ++y, ++z)
708  *z = std::modf(*a, y);
709 }
710 
712 
713 } // namespace vsmc
714 
715 #endif // VSMC_MATH_VMATH_HPP
void cdfnorm(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:148
Definition: monitor.hpp:48
void trunc(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:157
void erfcinv(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:150
void cbrt(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:480
#define VSMC_DEFINE_MATH_VMATH_1(func, name)
Definition: vmath.hpp:253
void mul(std::size_t n, const float *a, const float *b, float *y)
Definition: vmath.hpp:77
void log1p(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:119
void acosh(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:142
void sqrt(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:96
void modf(std::size_t n, const T *a, T *y, T *z)
For , compute integeral and fraction parts.
Definition: vmath.hpp:705
void sinh(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:140
void invsqrt(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:97
void pow3o2(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:101
void pow2o3(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:100
void asin(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:135
STL namespace.
void tan(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:614
void cdfnorminv(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:151
void exp2(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:553
void log2(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:577
void tanh(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:141
void erfinv(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:149
void linear_frac(std::size_t n, const float *a, const float *b, float beta_a, float beta_b, float mu_a, float mu_b, float *y)
Definition: vmath.hpp:79
#define VSMC_DEFINE_MATH_VMATH_2(func, name)
Definition: vmath.hpp:261
#define VSMC_DEFINE_MATH_VMATH_SV(op, name)
Definition: vmath.hpp:285
void invcbrt(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:99
void erf(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:146
void expm1(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:116
void pow(std::size_t n, const float *a, const float *b, float *y)
Definition: vmath.hpp:102
void cos(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:121
void lgamma(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:152
void exp(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:115
void atanh(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:144
void inv(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:94
void asinh(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:143
#define VSMC_DEFINE_MATH_VMATH_VML_2(func, name)
Definition: vmath.hpp:58
void atan2(std::size_t n, const float *a, const float *b, float *y)
Definition: vmath.hpp:137
void ceil(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:156
void round(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:158
void div(std::size_t n, const float *a, const float *b, float *y)
Definition: vmath.hpp:95
void sub(std::size_t n, const float *a, const float *b, float *y)
Definition: vmath.hpp:75
bool is_one(const T &a)
Definition: basic.hpp:107
void fma(std::size_t n, const T *a, const T *b, const T *c, T *y)
For , compute .
Definition: vmath.hpp:361
void tgamma(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:688
void sincos(std::size_t n, const float *a, float *y, float *z)
Definition: vmath.hpp:123
void sin(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:122
bool is_zero(const T &a)
Definition: basic.hpp:101
void cosh(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:139
void acos(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:134
void add(std::size_t n, const float *a, const float *b, float *y)
Definition: vmath.hpp:74
void tgamm(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:153
void atan(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:136
#define VSMC_DEFINE_MATH_VMATH_VS(op, name)
Definition: vmath.hpp:277
void exp10(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:557
void pow(std::size_t n, const T *a, T b, T *y)
For , compute .
Definition: vmath.hpp:534
void erfc(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:147
void tan(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:133
void hypot(std::size_t n, const T *a, const T *b, T *y)
For , compute .
Definition: vmath.hpp:541
void hypot(std::size_t n, const float *a, const float *b, float *y)
Definition: vmath.hpp:113
void cbrt(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:98
void floor(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:155
#define VSMC_DEFINE_MATH_VMATH_VML_1(func, name)
Definition: vmath.hpp:46
#define VSMC_DEFINE_MATH_VMATH_B(op, name)
Definition: vmath.hpp:269
void log(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:117
void modf(std::size_t n, const float *a, float *y, float *z)
Definition: vmath.hpp:159
void lgamma(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:685
void sqr(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:76
void log10(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:118
void abs(std::size_t n, const float *a, float *y)
Definition: vmath.hpp:78
void expm1(std::size_t n, const T *a, T *y)
For , compute .
Definition: vmath.hpp:571