vSMC
vSMC: Scalable Monte Carlo
mkl.hpp
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/utility/mkl.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_UTILITY_MKL_HPP
33 #define VSMC_UTILITY_MKL_HPP
34 
36 #include <vsmc/internal/common.hpp>
37 #include <mkl.h>
38 
39 namespace vsmc
40 {
41 
42 namespace internal
43 {
44 
45 #if VSMC_NO_RUNTIME_ASSERT
46 inline void mkl_error_check(int, const char *, const char *) {}
47 #else
48 inline void mkl_error_check(int status, const char *func, const char *mklf)
49 {
50  if (status == 0)
51  return;
52 
53  std::string msg("**");
54  msg += func;
55  msg += "** failure";
56  msg += "; MKL function: ";
57  msg += mklf;
58  msg += "; Error code: ";
59  msg += itos(status);
60 
61  VSMC_RUNTIME_ASSERT((status == 0), msg.c_str());
62 }
63 #endif
64 
65 } // namespace vsmc::internal
66 
69 template <typename MKLPtr, typename Derived>
70 class MKLBase
71 {
72  public:
73  using pointer = MKLPtr;
74  using element_type = typename std::remove_pointer<MKLPtr>::type;
75 
77  {
78  public:
79  void operator()(MKLPtr ptr) { status_ = Derived::release(ptr); }
80 
81  int status() const { return status_; }
82 
83  private:
84  int status_;
85  }; // class deleter_type
86 
87  MKLBase() = default;
88  MKLBase(const MKLBase<MKLPtr, Derived> &) = delete;
89  MKLBase<MKLPtr, Derived> &operator=(
90  const MKLBase<MKLPtr, Derived> &) = delete;
91  MKLBase(MKLBase<MKLPtr, Derived> &&) = default;
92  MKLBase<MKLPtr, Derived> &operator=(MKLBase<MKLPtr, Derived> &&) = default;
93 
94  int release() { return Derived::release(ptr_.get()); }
95 
96  void reset(pointer ptr)
97  {
98  if (ptr != ptr_.get())
99  ptr_.reset(ptr);
100  }
101 
102  void swap(MKLBase<MKLPtr, Derived> &other) { ptr_.swap(other.ptr_); }
103 
104  pointer get() const { return ptr_.get(); }
105 
106  deleter_type &get_deleter() { return ptr_.get_deleter(); }
107  const deleter_type &get_deleter() const { return ptr_.get_deleter(); }
108 
109  explicit operator bool() const { return bool(ptr_); }
110 
111  protected:
112  void reset_ptr(pointer ptr) { reset(ptr); }
113 
114  private:
115  std::unique_ptr<element_type, deleter_type> ptr_;
116 }; // class MKLBase
117 
120 template <typename MKLPtr, typename Derived>
121 inline bool operator==(
122  const MKLBase<MKLPtr, Derived> &ptr1, const MKLBase<MKLPtr, Derived> &ptr2)
123 {
124  return ptr1.get() == ptr2.get();
125 }
126 
129 template <typename MKLPtr, typename Derived>
130 inline bool operator!=(
131  const MKLBase<MKLPtr, Derived> &ptr1, const MKLBase<MKLPtr, Derived> &ptr2)
132 {
133  return ptr1.get() == ptr2.get();
134 }
135 
138 template <typename MKLPtr, typename Derived>
139 inline void swap(
140  const MKLBase<MKLPtr, Derived> &ptr1, const MKLBase<MKLPtr, Derived> &ptr2)
141 {
142  ptr1.swap(ptr2);
143 }
144 
147 class MKLStream : public MKLBase<::VSLStreamStatePtr, MKLStream>
148 {
149  public:
151  MKLStream(MKL_INT brng, MKL_UINT seed) { reset(brng, seed); }
152 
154  MKLStream(MKL_INT brng, MKL_INT n, unsigned *params)
155  {
156  reset(brng, n, params);
157  }
158 
160  MKLStream(const MKLStream &other)
161  : MKLBase<::VSLStreamStatePtr, MKLStream>()
162  {
163  ::VSLStreamStatePtr ptr = nullptr;
164  internal::mkl_error_check(::vslCopyStream(&ptr, other.get()),
165  "MKLStream::MKLStream", "::vslCopyStream");
166  this->reset_ptr(ptr);
167  }
168 
171  {
172  if (this != &other) {
173  if (this->get() == nullptr) {
174  ::VSLStreamStatePtr ptr = nullptr;
175  internal::mkl_error_check(::vslCopyStream(&ptr, other.get()),
176  "MKLStream::operator=", "::vslCopyStream");
177  this->reset_ptr(ptr);
178  } else {
180  ::vslCopyStreamState(this->get(), other.get()),
181  "MKLStream::operator=", "::vslCopyStreamState");
182  }
183  }
184 
185  return *this;
186  }
187 
188  MKLStream(MKLStream &&) = default;
189  MKLStream &operator=(MKLStream &&) = default;
190 
192  int reset(MKL_INT brng, MKL_UINT seed)
193  {
194  ::VSLStreamStatePtr ptr = nullptr;
195  int status = ::vslNewStream(&ptr, brng, seed);
197  status, "MKLStream::reset", "::vslNewStream");
198  this->reset_ptr(ptr);
199 
200  return status;
201  }
202 
204  int reset(MKL_INT brng, MKL_INT n, unsigned *params)
205  {
206  ::VSLStreamStatePtr ptr = nullptr;
207  int status = ::vslNewStreamEx(&ptr, brng, n, params);
209  status, "MKLStream::reset", "::vslNewStreamEx");
210  this->reset_ptr(ptr);
211 
212  return status;
213  }
214 
216  static int release(::VSLStreamStatePtr ptr)
217  {
218  if (ptr == nullptr)
219  return 0;
220 
221  int status = ::vslDeleteStream(&ptr);
223  status, "MKLStream::release", "::vslDeleteStream");
224 
225  return status;
226  }
227 
229  int save_f(const std::string &fname) const
230  {
231  int status = ::vslSaveStreamF(this->get(), fname.c_str());
233  status, "MKLStream::save_f", "::vslSaveStreamF");
234 
235  return status;
236  }
237 
239  int load_f(const std::string &fname)
240  {
241  ::VSLStreamStatePtr ptr = nullptr;
242  int status = ::vslSaveStreamF(&ptr, fname.c_str());
244  status, "MKLStream::load_f", "::vslSaveStreamF");
245  this->reset_ptr(ptr);
246 
247  return status;
248  }
249 
251  int save_m(char *memptr) const
252  {
253  int status = ::vslSaveStreamM(this->get(), memptr);
255  status, "MKLStream::save_m", "::vslSaveStreamM");
256 
257  return status;
258  }
259 
261  int load_m(const char *memptr)
262  {
263  ::VSLStreamStatePtr ptr = nullptr;
264  int status = ::vslLoadStreamM(&ptr, memptr);
266  status, "MKLStream::load_m", "::vslLoadStreamM");
267  this->reset_ptr(ptr);
268 
269  return status;
270  }
271 
273  int get_size() const { return ::vslGetStreamSize(this->get()); }
274 
276  int leapfrog(MKL_INT k, MKL_INT nstreams)
277  {
278  int status = ::vslLeapfrogStream(this->get(), k, nstreams);
280  status, "MKLStream::leapfrog", "::vslLeapfrogStream");
281 
282  return status;
283  }
284 
286  int skip_ahead(long long nskip)
287  {
288  int status = ::vslSkipAheadStream(this->get(), nskip);
290  status, "MKLStream::skip_ahead", "::vslSkipAheadStream");
291 
292  return status;
293  }
294 
296  int get_brng() const { return ::vslGetStreamStateBrng(this->get()); }
297 
299  static int get_num_reg_brngs() { return ::vslGetNumRegBrngs(); }
300 
303  MKL_INT brng, ::VSLBRngProperties &properties)
304  {
305  int status = ::vslGetBrngProperties(brng, &properties);
306  internal::mkl_error_check(status, "MKLStream::get_brng_properties",
307  "::vslGetBrngProperties");
308 
309  return status;
310  }
311 
313  int uniform(MKL_INT n, float *r, float a, float b,
314  MKL_INT method = VSL_RNG_METHOD_UNIFORM_STD)
315  {
316  int status = ::vsRngUniform(method, this->get(), n, r, a, b);
318  status, "MKLStream::uniform", "::vsRngUniform");
319 
320  return status;
321  }
322 
324  int uniform(MKL_INT n, double *r, double a, double b,
325  MKL_INT method = VSL_RNG_METHOD_UNIFORM_STD)
326  {
327  int status = ::vdRngUniform(method, this->get(), n, r, a, b);
329  status, "MKLStream::uniform", "::vdRngUniform");
330 
331  return status;
332  }
333 
335  int gaussian(MKL_INT n, float *r, float a, float sigma,
336  MKL_INT method = VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2)
337  {
338  int status = ::vsRngGaussian(method, this->get(), n, r, a, sigma);
340  status, "MKLStream::gaussian", "::vsRngGaussian");
341 
342  return status;
343  }
344 
346  int gaussian(MKL_INT n, double *r, double a, double sigma,
347  MKL_INT method = VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2)
348  {
349  int status = ::vdRngGaussian(method, this->get(), n, r, a, sigma);
351  status, "MKLStream::gaussian", "::vdRngGaussian");
352 
353  return status;
354  }
355 
357  int gaussian_mv(MKL_INT n, float *r, MKL_INT dimen, MKL_INT mstorage,
358  const float *a, const float *t,
359  MKL_INT method = VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2)
360  {
361  int status = ::vsRngGaussianMV(
362  method, this->get(), n, r, dimen, mstorage, a, t);
364  status, "MKLStream::gaussian_mv", "::vsRngGaussianMV");
365 
366  return status;
367  }
368 
370  int gaussian_mv(MKL_INT n, double *r, MKL_INT dimen, MKL_INT mstorage,
371  const double *a, const double *t,
372  MKL_INT method = VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2)
373  {
374  int status = ::vdRngGaussianMV(
375  method, this->get(), n, r, dimen, mstorage, a, t);
377  status, "MKLStream::gaussian_mv", "::vdRngGaussianMV");
378 
379  return status;
380  }
381 
383  int exponential(MKL_INT n, float *r, float a, float beta,
384  MKL_INT method = VSL_RNG_METHOD_EXPONENTIAL_ICDF)
385  {
386  int status = ::vsRngExponential(method, this->get(), n, r, a, beta);
388  status, "MKLStream::exponential", "::vsRngExponential");
389 
390  return status;
391  }
392 
394  int exponential(MKL_INT n, double *r, double a, double beta,
395  MKL_INT method = VSL_RNG_METHOD_EXPONENTIAL_ICDF)
396  {
397  int status = ::vdRngExponential(method, this->get(), n, r, a, beta);
399  status, "MKLStream::exponential", "::vdRngExponential");
400 
401  return status;
402  }
403 
405  int laplace(MKL_INT n, float *r, float a, float beta,
406  MKL_INT method = VSL_RNG_METHOD_LAPLACE_ICDF)
407  {
408  int status = ::vsRngLaplace(method, this->get(), n, r, a, beta);
410  status, "MKLStream::laplace", "::vsRngLaplace");
411 
412  return status;
413  }
414 
416  int laplace(MKL_INT n, double *r, double a, double beta,
417  MKL_INT method = VSL_RNG_METHOD_LAPLACE_ICDF)
418  {
419  int status = ::vdRngLaplace(method, this->get(), n, r, a, beta);
421  status, "MKLStream::laplace", "::vdRngLaplace");
422 
423  return status;
424  }
425 
427  int weibull(MKL_INT n, float *r, float alpha, float a, float beta,
428  MKL_INT method = VSL_RNG_METHOD_WEIBULL_ICDF)
429  {
430  int status = ::vsRngWeibull(method, this->get(), n, r, alpha, a, beta);
432  status, "MKLStream::weibull", "::vsRngWeibull");
433 
434  return status;
435  }
436 
438  int weibull(MKL_INT n, double *r, double alpha, double a, double beta,
439  MKL_INT method = VSL_RNG_METHOD_WEIBULL_ICDF)
440  {
441  int status = ::vdRngWeibull(method, this->get(), n, r, alpha, a, beta);
443  status, "MKLStream::weibull", "::vdRngWeibull");
444 
445  return status;
446  }
447 
449  int cauchy(MKL_INT n, float *r, float a, float beta,
450  MKL_INT method = VSL_RNG_METHOD_CAUCHY_ICDF)
451  {
452  int status = ::vsRngCauchy(method, this->get(), n, r, a, beta);
454  status, "MKLStream::cauchy", "::vsRngCauchy");
455 
456  return status;
457  }
458 
460  int cauchy(MKL_INT n, double *r, double a, double beta,
461  MKL_INT method = VSL_RNG_METHOD_CAUCHY_ICDF)
462  {
463  int status = ::vdRngCauchy(method, this->get(), n, r, a, beta);
465  status, "MKLStream::cauchy", "::vdRngCauchy");
466 
467  return status;
468  }
469 
471  int rayleigh(MKL_INT n, float *r, float a, float beta,
472  MKL_INT method = VSL_RNG_METHOD_RAYLEIGH_ICDF)
473  {
474  int status = ::vsRngRayleigh(method, this->get(), n, r, a, beta);
476  status, "MKLStream::rayleigh", "::vsRngRayleigh");
477 
478  return status;
479  }
480 
482  int rayleigh(MKL_INT n, double *r, double a, double beta,
483  MKL_INT method = VSL_RNG_METHOD_RAYLEIGH_ICDF)
484  {
485  int status = ::vdRngRayleigh(method, this->get(), n, r, a, beta);
487  status, "MKLStream::rayleigh", "::vdRngRayleigh");
488 
489  return status;
490  }
491 
493  int lognormal(MKL_INT n, float *r, float a, float sigma, float b,
494  float beta, MKL_INT method = VSL_RNG_METHOD_LOGNORMAL_BOXMULLER2)
495  {
496  int status =
497  ::vsRngLognormal(method, this->get(), n, r, a, sigma, b, beta);
499  status, "MKLStream::lognormal", "::vsRngLognormal");
500 
501  return status;
502  }
503 
505  int lognormal(MKL_INT n, double *r, double a, double sigma, double b,
506  double beta, MKL_INT method = VSL_RNG_METHOD_LOGNORMAL_BOXMULLER2)
507  {
508  int status =
509  ::vdRngLognormal(method, this->get(), n, r, a, sigma, b, beta);
511  status, "MKLStream::lognormal", "::vdRngLognormal");
512 
513  return status;
514  }
515 
517  int gumbel(MKL_INT n, float *r, float a, float beta,
518  MKL_INT method = VSL_RNG_METHOD_GUMBEL_ICDF)
519  {
520  int status = ::vsRngGumbel(method, this->get(), n, r, a, beta);
522  status, "MKLStream::gumbel", "::vsRngGumbel");
523 
524  return status;
525  }
526 
528  int gumbel(MKL_INT n, double *r, double a, double beta,
529  MKL_INT method = VSL_RNG_METHOD_GUMBEL_ICDF)
530  {
531  int status = ::vdRngGumbel(method, this->get(), n, r, a, beta);
533  status, "MKLStream::gumbel", "::vdRngGumbel");
534 
535  return status;
536  }
537 
539  int gamma(MKL_INT n, float *r, float alpha, float a, float beta,
540  MKL_INT method = VSL_RNG_METHOD_GAMMA_GNORM)
541  {
542  int status = ::vsRngGamma(method, this->get(), n, r, alpha, a, beta);
543  internal::mkl_error_check(status, "MKLStream::gamma", "::vsRngGamma");
544 
545  return status;
546  }
547 
549  int gamma(MKL_INT n, double *r, double alpha, double a, double beta,
550  MKL_INT method = VSL_RNG_METHOD_GAMMA_GNORM)
551  {
552  int status = ::vdRngGamma(method, this->get(), n, r, alpha, a, beta);
553  internal::mkl_error_check(status, "MKLStream::gamma", "::vdRngGamma");
554 
555  return status;
556  }
557 
559  int beta(MKL_INT n, float *r, float p, float q, float a, float beta,
560  MKL_INT method = VSL_RNG_METHOD_BETA_CJA)
561  {
562  int status = ::vsRngBeta(method, this->get(), n, r, p, q, a, beta);
563  internal::mkl_error_check(status, "MKLStream::beta", "::vsRngBeta");
564 
565  return status;
566  }
567 
569  int beta(MKL_INT n, double *r, double p, double q, double a, double beta,
570  MKL_INT method = VSL_RNG_METHOD_BETA_CJA)
571  {
572  int status = ::vdRngBeta(method, this->get(), n, r, p, q, a, beta);
573  internal::mkl_error_check(status, "MKLStream::beta", "::vdRngBeta");
574 
575  return status;
576  }
577 
579  int uniform(MKL_INT n, int *r, int a, int b,
580  MKL_INT method = VSL_RNG_METHOD_UNIFORM_STD)
581  {
582  int status = ::viRngUniform(method, this->get(), n, r, a, b);
584  status, "MKLStream::uniform", "::viRngUniform");
585 
586  return status;
587  }
588 
590  int uniform_bits(MKL_INT n, unsigned *r,
591  MKL_INT method = VSL_RNG_METHOD_UNIFORMBITS_STD)
592  {
593  int status = ::viRngUniformBits(method, this->get(), n, r);
595  status, "MKLStream::uniform_bits", "::viRngUniformBits");
596 
597  return status;
598  }
599 
601  int uniform_bits32(MKL_INT n, unsigned *r,
602  MKL_INT method = VSL_RNG_METHOD_UNIFORMBITS32_STD)
603  {
604  int status = ::viRngUniformBits32(method, this->get(), n, r);
606  status, "MKLStream::uniform_bits32", "::viRngUniformBits32");
607 
608  return status;
609  }
610 
612  int uniform_bits64(MKL_INT n, unsigned MKL_INT64 *r,
613  MKL_INT method = VSL_RNG_METHOD_UNIFORMBITS64_STD)
614  {
615  int status = ::viRngUniformBits64(method, this->get(), n, r);
617  status, "MKLStream::uniform_bits64", "::viRngUniformBits64");
618 
619  return status;
620  }
621 
623  int bernoulli(MKL_INT n, int *r, double p,
624  MKL_INT method = VSL_RNG_METHOD_BERNOULLI_ICDF)
625  {
626  int status = ::viRngBernoulli(method, this->get(), n, r, p);
628  status, "MKLStream::bernoulli", "::viRngBernoulli");
629 
630  return status;
631  }
632 
634  int geometric(MKL_INT n, int *r, double p,
635  MKL_INT method = VSL_RNG_METHOD_GEOMETRIC_ICDF)
636  {
637  int status = ::viRngGeometric(method, this->get(), n, r, p);
639  status, "MKLStream::geometric", "::viRngGeometric");
640 
641  return status;
642  }
643 
645  int binomial(MKL_INT n, int *r, int ntrial, double p,
646  MKL_INT method = VSL_RNG_METHOD_BINOMIAL_BTPE)
647  {
648  int status = ::viRngBinomial(method, this->get(), n, r, ntrial, p);
650  status, "MKLStream::binomial", "::viRngBinomial");
651 
652  return status;
653  }
654 
656  int hypergeometric(MKL_INT n, int *r, int l, int s, int m,
657  MKL_INT method = VSL_RNG_METHOD_HYPERGEOMETRIC_H2PE)
658  {
659  int status = ::viRngHypergeometric(method, this->get(), n, r, l, s, m);
661  status, "MKLStream::hypergeometric", "::viRngHypergeometric");
662 
663  return status;
664  }
665 
667  int poisson(MKL_INT n, int *r, double lambda,
668  MKL_INT method = VSL_RNG_METHOD_POISSON_PTPE)
669  {
670  int status = ::viRngPoisson(method, this->get(), n, r, lambda);
672  status, "MKLStream::poisson", "::viRngPoisson");
673 
674  return status;
675  }
676 
678  int poisson_v(MKL_INT n, int *r, const double *lambda,
679  MKL_INT method = VSL_RNG_METHOD_POISSONV_POISNORM)
680  {
681  int status = ::viRngPoissonV(method, this->get(), n, r, lambda);
683  status, "MKLStream::poisson_v", "::viRngPoissonV");
684 
685  return status;
686  }
687 
689  int neg_binomial(MKL_INT n, int *r, double a, double p,
690  MKL_INT method = VSL_RNG_METHOD_NEGBINOMIAL_NBAR)
691  {
692  int status = ::viRngNegbinomial(method, this->get(), n, r, a, p);
694  status, "MKLStream::neg_binomial", "::viRngNegbinomial");
695 
696  return status;
697  }
698 }; // class MKLStream
699 
702 template <typename RealType = double>
703 class MKLSSTask : public MKLBase<::VSLSSTaskPtr, MKLSSTask<RealType>>
704 {
706  "**MKLSSTask** USED WITH RealType OTHER THAN float or double");
707 
708  public:
709  using result_type = RealType;
710 
712  MKLSSTask(const MKL_INT *p, const MKL_INT *n, const MKL_INT *xstorage,
713  const result_type *x, const result_type *w, const MKL_INT *indices)
714  {
715  reset(p, n, xstorage, x, w, indices);
716  }
717 
719  int reset(const MKL_INT *p, const MKL_INT *n, const MKL_INT *xstorage,
720  const result_type *x, const result_type *w, const MKL_INT *indices)
721  {
722  return reset_dispatch(p, n, xstorage, x, w, indices);
723  }
724 
726  static int release(::VSLSSTaskPtr ptr)
727  {
728  if (ptr == nullptr)
729  return 0;
730 
731  int status = ::vslSSDeleteTask(&ptr);
733  status, "MKLSSTask::release", "::vslSSDeleteTask");
734 
735  return status;
736  }
737 
739  int edit_task(MKL_INT parameter, const result_type *par_addr)
740  {
741  return edit_task_dispatch(parameter, par_addr);
742  }
743 
745  int edit_task(MKL_INT parameter, const MKL_INT *par_addr)
746  {
747  return edit_task_dispatch(parameter, par_addr);
748  }
749 
751  int edit_moments(const result_type *mean, const result_type *r2m,
752  const result_type *r3m, const result_type *r4m, const result_type *c2m,
753  const result_type *c3m, const result_type *c4m)
754  {
755  return edit_moments_dispatch(mean, r2m, r3m, r4m, c2m, c3m, c4m);
756  }
757 
759  int edit_sums(const result_type *sum, const result_type *r2s,
760  const result_type *r3s, const result_type *r4s, const result_type *c2s,
761  const result_type *c3s, const result_type *c4s)
762  {
763  return edit_moments_dispatch(sum, r2s, r3s, r4s, c2s, c3s, c4s);
764  }
765 
767  int edit_cov_cor(const result_type *mean, const result_type *cov,
768  const MKL_INT *cov_storage, const result_type *cor,
769  const MKL_INT *cor_storage)
770  {
771  return edit_cov_cor_dispatch(mean, cov, cov_storage, cor, cor_storage);
772  }
773 
775  int edit_cp(const result_type *mean, const result_type *sum,
776  const result_type *cp, const MKL_INT *cp_storage)
777  {
778  return edit_cp_dispatch(mean, sum, cp, cp_storage);
779  }
780 
782  int edit_partial_cov_cor(const MKL_INT *p_idx_array,
783  const result_type *cov, const MKL_INT *cov_storage,
784  const result_type *cor, const MKL_INT *cor_storage,
785  const result_type *p_cov, const MKL_INT *p_cov_storage,
786  const result_type *p_cor, const MKL_INT *p_cor_storage) const
787  {
788  return edit_partial_cov_cor_dispatch(p_idx_array, cov, cov_storage,
789  cor, cor_storage, p_cov, p_cov_storage, p_cor, p_cor_storage);
790  }
791 
793  int edit_quantiles(const MKL_INT *quant_order_n,
794  const result_type *quant_order, const result_type *quant,
795  const result_type *order_stats, const MKL_INT *order_stats_storage)
796  {
797  return edit_quantiles_dispatch(quant_order_n, quant_order, quant,
798  order_stats, order_stats_storage);
799  }
800 
802  int edit_stream_quantiles(const MKL_INT *quant_order_n,
803  const result_type *quant_order, const result_type *quants,
804  const MKL_INT *nparams, const result_type *params)
805  {
806  return edit_stream_quantiles_dispatch(
807  quant_order_n, quant_order, quants, nparams, params);
808  }
809 
811  int edit_pooled_covariance(const MKL_INT *grp_indices,
812  const result_type *pld_mean, const result_type *pld_cov,
813  const MKL_INT *req_grp_indices, const result_type *grp_means,
814  const result_type *grp_cov)
815  {
816  return edit_pooled_covariance_dispatch(grp_indices, pld_mean, pld_cov,
817  req_grp_indices, grp_means, grp_cov);
818  }
819 
821  int edit_robust_covariance(const MKL_INT *rcov_storage,
822  const MKL_INT *nparams, const result_type *params,
823  const result_type *rmean, const result_type *rcov)
824  {
825  return edit_robust_covariance_dispatch(
826  rcov_storage, nparams, params, rmean, rcov);
827  }
828 
830  int edit_outliers_detection(const MKL_INT *nparams,
831  const result_type *params, const result_type *w)
832  {
833  return edit_outliers_detection_dispatch(nparams, params, w);
834  }
835 
837  int edit_missing_values(const MKL_INT *nparams, const result_type *params,
838  const MKL_INT *init_estimates_n, const result_type *init_estimates,
839  const MKL_INT *prior_n, const result_type *prior,
840  const MKL_INT *simul_missing_vals_n,
841  const result_type *simul_missing_vals, const MKL_INT *estimates_n,
842  const result_type *estimates)
843  {
844  return edit_missing_values_dispatch(nparams, params, init_estimates_n,
845  init_estimates, prior_n, prior, simul_missing_vals_n,
846  simul_missing_vals, estimates_n, estimates);
847  }
848 
851  const MKL_INT *cor_storage, const result_type *pcor,
852  const MKL_INT *pcor_storage)
853  {
854  return edit_cor_parameterization_dispatch(
855  cor, cor_storage, pcor, pcor_storage);
856  }
857 
859  int compute(unsigned MKL_INT64 estimates, MKL_INT method)
860  {
861  return compute_dispatch(
862  estimates, method, static_cast<result_type *>(nullptr));
863  }
864 
865  private:
866  int reset_dispatch(const MKL_INT *p, const MKL_INT *n,
867  const MKL_INT *xstorage, const float *x, const float *w,
868  const MKL_INT *indices)
869  {
870  ::VSLSSTaskPtr ptr;
871  int status = ::vslsSSNewTask(&ptr, p, n, xstorage, x, w, indices);
873  status, "MKLSSTask::reset", "::vslsSSNewTask");
874  this->reset_ptr(ptr);
875 
876  return status;
877  }
878 
879  int reset_dispatch(const MKL_INT *p, const MKL_INT *n,
880  const MKL_INT *xstorage, const double *x, const double *w,
881  const MKL_INT *indices)
882  {
883  ::VSLSSTaskPtr ptr;
884  int status = ::vsldSSNewTask(&ptr, p, n, xstorage, x, w, indices);
886  status, "MKLSSTask::reset", "::vsldSSNewTask");
887  this->reset_ptr(ptr);
888 
889  return status;
890  }
891 
892  int edit_task_dispatch(MKL_INT parameter, const float *par_addr)
893  {
894  int status = ::vslsSSEditTask(this->get(), parameter, par_addr);
896  status, "MKLSSTask::edit_task", "::vslsSSEditTask");
897 
898  return status;
899  }
900 
901  int edit_task_dispatch(MKL_INT parameter, const double *par_addr)
902  {
903  int status = ::vsldSSEditTask(this->get(), parameter, par_addr);
905  status, "MKLSSTask::edit_task", "::vsldSSEditTask");
906 
907  return status;
908  }
909 
910  int edit_task_dispatch(MKL_INT parameter, const MKL_INT *par_addr)
911  {
912  int status = ::vsliSSEditTask(this->get(), parameter, par_addr);
914  status, "MKLSSTask::edit_task", "::vsliSSEditTask");
915 
916  return status;
917  }
918 
919  int edit_moments_dispatch(const float *mean, const float *r2m,
920  const float *r3m, const float *r4m, const float *c2m, const float *c3m,
921  const float *c4m)
922  {
923  int status = ::vslsSSEditMoments(
924  this->get(), mean, r2m, r3m, r4m, c2m, c3m, c4m);
926  status, "MKLSSTask::edit_moments", "::vslsSSEditMoments");
927 
928  return status;
929  }
930 
931  int edit_moments_dispatch(const double *mean, const double *r2m,
932  const double *r3m, const double *r4m, const double *c2m,
933  const double *c3m, const double *c4m)
934  {
935  int status = ::vsldSSEditMoments(
936  this->get(), mean, r2m, r3m, r4m, c2m, c3m, c4m);
938  status, "MKLSSTask::edit_moments", "::vsldSSEditMoments");
939 
940  return status;
941  }
942 
943  int edit_sums_dispatch(const float *sum, const float *r2s,
944  const float *r3s, const float *r4s, const float *c2s, const float *c3s,
945  const float *c4s)
946  {
947  int status =
948  ::vslsSSEditSums(this->get(), sum, r2s, r3s, r4s, c2s, c3s, c4s);
950  status, "MKLSSTask::edit_sums", "::vslsSSEditSums");
951 
952  return status;
953  }
954 
955  int edit_sums_dispatch(const double *sum, const double *r2s,
956  const double *r3s, const double *r4s, const double *c2s,
957  const double *c3s, const double *c4s)
958  {
959  int status =
960  ::vsldSSEditSums(this->get(), sum, r2s, r3s, r4s, c2s, c3s, c4s);
962  status, "MKLSSTask::edit_sums", "::vsldSSEditSums");
963 
964  return status;
965  }
966 
967  int edit_cov_cor_dispatch(const float *mean, const float *cov,
968  const MKL_INT *cov_storage, const float *cor,
969  const MKL_INT *cor_storage)
970  {
971  int status = ::vslsSSEditCovCor(
972  this->get(), mean, cov, cov_storage, cor, cor_storage);
974  status, "MKLSSTask::edit_cov_cor", "::vslsSSEditCovCor");
975 
976  return status;
977  }
978 
979  int edit_cov_cor_dispatch(const double *mean, const double *cov,
980  const MKL_INT *cov_storage, const double *cor,
981  const MKL_INT *cor_storage)
982  {
983  int status = ::vsldSSEditCovCor(
984  this->get(), mean, cov, cov_storage, cor, cor_storage);
986  status, "MKLSSTask::edit_cov_cor", "::vsldSSEditCovCor");
987 
988  return status;
989  }
990 
991  int edit_cp_dispatch(const float *mean, const float *sum, const float *cp,
992  const MKL_INT *cp_storage)
993  {
994  int status = ::vslsSSEditCP(this->get(), mean, sum, cp, cp_storage);
996  status, "MKLSSTask::edit_cp", "::vslsSSEditCP");
997 
998  return status;
999  }
1000 
1001  int edit_cp_dispatch(const double *mean, const double *sum,
1002  const double *cp, const MKL_INT *cp_storage)
1003  {
1004  int status = ::vsldSSEditCP(this->get(), mean, sum, cp, cp_storage);
1006  status, "MKLSSTask::edit_cp", "::vsldSSEditCP");
1007 
1008  return status;
1009  }
1010 
1011  int edit_partial_cov_cor_dispatch(const MKL_INT *p_idx_array,
1012  const float *cov, const MKL_INT *cov_storage, const float *cor,
1013  const MKL_INT *cor_storage, const float *p_cov,
1014  const MKL_INT *p_cov_storage, const float *p_cor,
1015  const MKL_INT *p_cor_storage) const
1016  {
1017  int status = ::vslsSSEditPartialCovCor(this->get(), p_idx_array, cov,
1018  cov_storage, cor, cor_storage, p_cov, p_cov_storage, p_cor,
1019  p_cor_storage);
1020  internal::mkl_error_check(status, "MKLSSTask::edit_partial_cov_cor",
1021  "::vslsSSEditPartialCovCor");
1022 
1023  return status;
1024  }
1025 
1026  int edit_partial_cov_cor_dispatch(const MKL_INT *p_idx_array,
1027  const double *cov, const MKL_INT *cov_storage, const double *cor,
1028  const MKL_INT *cor_storage, const double *p_cov,
1029  const MKL_INT *p_cov_storage, const double *p_cor,
1030  const MKL_INT *p_cor_storage) const
1031  {
1032  int status = ::vsldSSEditPartialCovCor(this->get(), p_idx_array, cov,
1033  cov_storage, cor, cor_storage, p_cov, p_cov_storage, p_cor,
1034  p_cor_storage);
1035  internal::mkl_error_check(status, "MKLSSTask::edit_partial_cov_cor",
1036  "::vsldSSEditPartialCovCor");
1037 
1038  return status;
1039  }
1040 
1041  int edit_quantiles_dispatch(const MKL_INT *quant_order_n,
1042  const float *quant_order, const float *quant, const float *order_stats,
1043  const MKL_INT *order_stats_storage)
1044  {
1045  int status = ::vslsSSEditQuantiles(this->get(), quant_order_n,
1046  quant_order, quant, order_stats, order_stats_storage);
1048  status, "MKLSSTask::edit_quantiles", "::vslsSSEditQuantiles");
1049 
1050  return status;
1051  }
1052 
1053  int edit_quantiles_dispatch(const MKL_INT *quant_order_n,
1054  const double *quant_order, const double *quant,
1055  const double *order_stats, const MKL_INT *order_stats_storage)
1056  {
1057  int status = ::vsldSSEditQuantiles(this->get(), quant_order_n,
1058  quant_order, quant, order_stats, order_stats_storage);
1060  status, "MKLSSTask::edit_quantiles", "::vsldSSEditQuantiles");
1061 
1062  return status;
1063  }
1064 
1065  int edit_stream_quantiles_dispatch(const MKL_INT *quant_order_n,
1066  const float *quant_order, const float *quants, const MKL_INT *nparams,
1067  const float *params)
1068  {
1069  int status = ::vslsSSEditStreamQuantiles(
1070  this->get(), quant_order_n, quant_order, quants, nparams, params);
1071  internal::mkl_error_check(status, "MKLSSTask::edit_stream_quantiles",
1072  "::vslsSSEditStreamQuantiles");
1073 
1074  return status;
1075  }
1076 
1077  int edit_stream_quantiles_dispatch(const MKL_INT *quant_order_n,
1078  const double *quant_order, const double *quants,
1079  const MKL_INT *nparams, const double *params)
1080  {
1081  int status = ::vsldSSEditStreamQuantiles(
1082  this->get(), quant_order_n, quant_order, quants, nparams, params);
1083  internal::mkl_error_check(status, "MKLSSTask::edit_stream_quantiles",
1084  "::vsldSSEditStreamQuantiles");
1085 
1086  return status;
1087  }
1088 
1089  int edit_pooled_covariance_dispatch(const MKL_INT *grp_indices,
1090  const float *pld_mean, const float *pld_cov,
1091  const MKL_INT *req_grp_indices, const float *grp_means,
1092  const float *grp_cov)
1093  {
1094  int status = ::vslsSSEditPooledCovariance(this->get(), grp_indices,
1095  pld_mean, pld_cov, req_grp_indices, grp_means, grp_cov);
1096  internal::mkl_error_check(status, "MKLSSTask::edit_pooled_covariance",
1097  "::vslsSSEditPooledCovariance");
1098 
1099  return status;
1100  }
1101 
1102  int edit_pooled_covariance_dispatch(const MKL_INT *grp_indices,
1103  const double *pld_mean, const double *pld_cov,
1104  const MKL_INT *req_grp_indices, const double *grp_means,
1105  const double *grp_cov)
1106  {
1107  int status = ::vsldSSEditPooledCovariance(this->get(), grp_indices,
1108  pld_mean, pld_cov, req_grp_indices, grp_means, grp_cov);
1109  internal::mkl_error_check(status, "MKLSSTask::edit_pooled_covariance",
1110  "::vsldSSEditPooledCovariance");
1111 
1112  return status;
1113  }
1114 
1115  int edit_robust_covariance_dispatch(const MKL_INT *rcov_storage,
1116  const MKL_INT *nparams, const float *params, const float *rmean,
1117  const float *rcov)
1118  {
1119  int status = ::vslsSSEditRobustCovariance(
1120  this->get(), rcov_storage, nparams, params, rmean, rcov);
1121  internal::mkl_error_check(status, "MKLSSTask::edit_robust_covariance",
1122  "::vslsSSEditRobustCovariance");
1123 
1124  return status;
1125  }
1126 
1127  int edit_robust_covariance_dispatch(const MKL_INT *rcov_storage,
1128  const MKL_INT *nparams, const double *params, const double *rmean,
1129  const double *rcov)
1130  {
1131  int status = ::vsldSSEditRobustCovariance(
1132  this->get(), rcov_storage, nparams, params, rmean, rcov);
1133  internal::mkl_error_check(status, "MKLSSTask::edit_robust_covariance",
1134  "::vsldSSEditRobustCovariance");
1135 
1136  return status;
1137  }
1138 
1139  int edit_outliers_detection_dispatch(
1140  const MKL_INT *nparams, const float *params, const float *w)
1141  {
1142  int status =
1143  ::vslsSSEditOutliersDetection(this->get(), nparams, params, w);
1144  internal::mkl_error_check(status, "MKLSSTask::edit_outliers_detection",
1145  "::vslsSSEditOutliersDetection");
1146 
1147  return status;
1148  }
1149 
1150  int edit_outliers_detection_dispatch(
1151  const MKL_INT *nparams, const double *params, const double *w)
1152  {
1153  int status =
1154  ::vsldSSEditOutliersDetection(this->get(), nparams, params, w);
1155  internal::mkl_error_check(status, "MKLSSTask::edit_outliers_detection",
1156  "::vsldSSEditOutliersDetection");
1157 
1158  return status;
1159  }
1160 
1161  int edit_missing_values_dispatch(const MKL_INT *nparams,
1162  const float *params, const MKL_INT *init_estimates_n,
1163  const float *init_estimates, const MKL_INT *prior_n,
1164  const float *prior, const MKL_INT *simul_missing_vals_n,
1165  const float *simul_missing_vals, const MKL_INT *estimates_n,
1166  const float *estimates)
1167  {
1168  int status = ::vslsSSEditMissingValues(this->get(), nparams, params,
1169  init_estimates_n, init_estimates, prior_n, prior,
1170  simul_missing_vals_n, simul_missing_vals, estimates_n, estimates);
1171  internal::mkl_error_check(status, "MKLSSTask::edit_missing_values",
1172  "::vslsSSEditMissingValues");
1173 
1174  return status;
1175  }
1176 
1177  int edit_missing_values_dispatch(const MKL_INT *nparams,
1178  const double *params, const MKL_INT *init_estimates_n,
1179  const double *init_estimates, const MKL_INT *prior_n,
1180  const double *prior, const MKL_INT *simul_missing_vals_n,
1181  const double *simul_missing_vals, const MKL_INT *estimates_n,
1182  const double *estimates)
1183  {
1184  int status = ::vsldSSEditMissingValues(this->get(), nparams, params,
1185  init_estimates_n, init_estimates, prior_n, prior,
1186  simul_missing_vals_n, simul_missing_vals, estimates_n, estimates);
1187  internal::mkl_error_check(status, "MKLSSTask::edit_missing_values",
1188  "::vsldSSEditMissingValues");
1189 
1190  return status;
1191  }
1192 
1193  int edit_cor_parameterization_dispatch(const float *cor,
1194  const MKL_INT *cor_storage, const float *pcor,
1195  const MKL_INT *pcor_storage)
1196  {
1197  int status = ::vslsSSEditCorParameterization(
1198  this->get(), cor, cor_storage, pcor, pcor_storage);
1200  "MKLSSTask::edit_cor_parameterization",
1201  "::vslsSSEditCorParameterization");
1202 
1203  return status;
1204  }
1205 
1206  int edit_cor_parameterization_dispatch(const double *cor,
1207  const MKL_INT *cor_storage, const double *pcor,
1208  const MKL_INT *pcor_storage)
1209  {
1210  int status = ::vsldSSEditCorParameterization(
1211  this->get(), cor, cor_storage, pcor, pcor_storage);
1213  "MKLSSTask::edit_cor_parameterization",
1214  "::vsldSSEditCorParameterization");
1215 
1216  return status;
1217  }
1218 
1219  int compute_dispatch(
1220  unsigned MKL_INT64 estimates, MKL_INT method, const float *)
1221  {
1222  int status = ::vslsSSCompute(this->get(), estimates, method);
1224  status, "MKLSSTask::compute", "::vslsSSCompute");
1225 
1226  return status;
1227  }
1228 
1229  int compute_dispatch(
1230  unsigned MKL_INT64 estimates, MKL_INT method, const double *)
1231  {
1232  int status = ::vsldSSCompute(this->get(), estimates, method);
1234  status, "MKLSSTask::compute", "::vsldSSCompute");
1235 
1236  return status;
1237  }
1238 }; // class MKLSSTask
1239 
1242 template <typename ResultType = double>
1243 class MKLConvTask : public MKLBase<::VSLConvTaskPtr, MKLConvTask<ResultType>>
1244 {
1245  static_assert(internal::is_one_of<ResultType, float, double, MKL_Complex8,
1246  MKL_Complex16>::value,
1247  "**MKLConvTask** USED WITH ResultType OTHER THAN float, double, "
1248  "MKL_Complex8 OR MKL_Complex16");
1249 
1250  public:
1251  using result_type = ResultType;
1252 
1254  MKLConvTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1255  const MKL_INT *yshape, const MKL_INT *zshape)
1256  {
1257  reset(mode, dims, xshape, yshape, zshape);
1258  }
1259 
1262  MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
1263  {
1264  reset(mode, xshape, yshape, zshape);
1265  }
1266 
1268  MKLConvTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1269  const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x,
1270  const MKL_INT *xstride)
1271  {
1272  reset(mode, dims, xshape, yshape, zshape, x, xstride);
1273  }
1274 
1276  MKLConvTask(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape,
1277  const result_type *x, const MKL_INT xstride)
1278  {
1279  reset(mode, xshape, yshape, zshape, x, xstride);
1280  }
1281 
1284  {
1285  ::VSLConvTaskPtr ptr = nullptr;
1286  internal::mkl_error_check(::vslConvCopyTask(&ptr, other.get()),
1287  "MKLConvTask::MKLConvTask", "::vslConvCopyTask");
1288  this->reset_ptr(ptr);
1289  }
1290 
1293  {
1294  if (this != &other) {
1295  ::VSLConvTaskPtr ptr = nullptr;
1296  internal::mkl_error_check(::vslConvCopyTask(&ptr, other.get()),
1297  "MKLConvTask::operator=", "::vslConvCopyTask");
1298  this->reset_ptr(ptr);
1299  }
1300 
1301  return *this;
1302  }
1303 
1304  MKLConvTask(MKLConvTask<ResultType> &&) = default;
1305  MKLConvTask<ResultType> &operator=(MKLConvTask<ResultType> &&) = default;
1306 
1308  static int release(::VSLConvTaskPtr ptr)
1309  {
1310  if (ptr == nullptr)
1311  return 0;
1312 
1313  int status = ::vslConvDeleteTask(&ptr);
1315  status, "MKLConvTask::release", "::vslConvDeleteTask");
1316 
1317  return status;
1318  }
1319 
1321  int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1322  const MKL_INT *yshape, const MKL_INT *zshape)
1323  {
1324  return reset_dispatch(mode, dims, xshape, yshape, zshape);
1325  }
1326 
1328  int reset(
1329  MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
1330  {
1331  return reset_dispatch(mode, xshape, yshape, zshape);
1332  }
1333 
1335  int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1336  const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x,
1337  const MKL_INT *xstride)
1338  {
1339  return reset_dispatch(mode, dims, xshape, yshape, zshape, x, xstride);
1340  }
1341 
1343  int reset(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape,
1344  const result_type *x, const MKL_INT xstride)
1345  {
1346  return reset_dispatch(mode, xshape, yshape, zshape, x, xstride);
1347  }
1348 
1349  private:
1350  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1351  const MKL_INT *yshape, const MKL_INT *zshape, float *)
1352  {
1353  ::VSLConvTaskPtr ptr;
1354  int status =
1355  ::vslsConvNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1357  status, "MKLConvTask::reset", "::vslsConvNewTask");
1358  this->reset_ptr(ptr);
1359 
1360  return status;
1361  }
1362 
1363  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1364  const MKL_INT *yshape, const MKL_INT *zshape, double *)
1365  {
1366  ::VSLConvTaskPtr ptr;
1367  int status =
1368  ::vsldConvNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1370  status, "MKLConvTask::reset", "::vsldConvNewTask");
1371  this->reset_ptr(ptr);
1372 
1373  return status;
1374  }
1375 
1376  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1377  const MKL_INT *yshape, const MKL_INT *zshape, MKL_Complex8 *)
1378  {
1379  ::VSLConvTaskPtr ptr;
1380  int status =
1381  ::vslcConvNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1383  status, "MKLConvTask::reset", "::vslcConvNewTask");
1384  this->reset_ptr(ptr);
1385 
1386  return status;
1387  }
1388 
1389  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1390  const MKL_INT *yshape, const MKL_INT *zshape, MKL_Complex16 *)
1391  {
1392  ::VSLConvTaskPtr ptr;
1393  int status =
1394  ::vslzConvNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1396  status, "MKLConvTask::reset", "::vslzConvNewTask");
1397  this->reset_ptr(ptr);
1398 
1399  return status;
1400  }
1401 
1402  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1403  const MKL_INT yshape, const MKL_INT zshape, float *)
1404  {
1405  ::VSLConvTaskPtr ptr;
1406  int status = ::vslsConvNewTask1D(&ptr, mode, xshape, yshape, zshape);
1408  status, "MKLConvTask::reset", "::vslsConvNewTask1D");
1409  this->reset_ptr(ptr);
1410 
1411  return status;
1412  }
1413 
1414  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1415  const MKL_INT yshape, const MKL_INT zshape, double *)
1416  {
1417  ::VSLConvTaskPtr ptr;
1418  int status = ::vsldConvNewTask1D(&ptr, mode, xshape, yshape, zshape);
1420  status, "MKLConvTask::reset", "::vsldConvNewTask1D");
1421  this->reset_ptr(ptr);
1422 
1423  return status;
1424  }
1425 
1426  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1427  const MKL_INT yshape, const MKL_INT zshape, MKL_Complex8 *)
1428  {
1429  ::VSLConvTaskPtr ptr;
1430  int status = ::vslcConvNewTask1D(&ptr, mode, xshape, yshape, zshape);
1432  status, "MKLConvTask::reset", "::vslcConvNewTask1D");
1433  this->reset_ptr(ptr);
1434 
1435  return status;
1436  }
1437 
1438  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1439  const MKL_INT yshape, const MKL_INT zshape, MKL_Complex16 *)
1440  {
1441  ::VSLConvTaskPtr ptr;
1442  int status = ::vslzConvNewTask1D(&ptr, mode, xshape, yshape, zshape);
1444  status, "MKLConvTask::reset", "::vslzConvNewTask1D");
1445  this->reset_ptr(ptr);
1446 
1447  return status;
1448  }
1449 
1450  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1451  const MKL_INT *yshape, const MKL_INT *zshape, const float *x,
1452  const MKL_INT *xstride)
1453  {
1454  ::VSLConvTaskPtr ptr;
1455  int status = ::vslsConvNewTaskX(
1456  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1458  status, "MKLConvTask::reset", "::vslsConvNewTaskX");
1459  this->reset_ptr(ptr);
1460 
1461  return status;
1462  }
1463 
1464  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1465  const MKL_INT *yshape, const MKL_INT *zshape, const double *x,
1466  const MKL_INT *xstride)
1467  {
1468  ::VSLConvTaskPtr ptr;
1469  int status = ::vsldConvNewTaskX(
1470  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1472  status, "MKLConvTask::reset", "::vsldConvNewTaskX");
1473  this->reset_ptr(ptr);
1474 
1475  return status;
1476  }
1477 
1478  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1479  const MKL_INT *yshape, const MKL_INT *zshape, const MKL_Complex8 *x,
1480  const MKL_INT *xstride)
1481  {
1482  ::VSLConvTaskPtr ptr;
1483  int status = ::vslcConvNewTaskX(
1484  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1486  status, "MKLConvTask::reset", "::vslcConvNewTaskX");
1487  this->reset_ptr(ptr);
1488 
1489  return status;
1490  }
1491 
1492  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1493  const MKL_INT *yshape, const MKL_INT *zshape, const MKL_Complex16 *x,
1494  const MKL_INT *xstride)
1495  {
1496  ::VSLConvTaskPtr ptr;
1497  int status = ::vslzConvNewTaskX(
1498  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1500  status, "MKLConvTask::reset", "::vslzConvNewTaskX");
1501  this->reset_ptr(ptr);
1502 
1503  return status;
1504  }
1505 
1506  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1507  const MKL_INT yshape, const MKL_INT zshape, const float *x,
1508  const MKL_INT xstride)
1509  {
1510  ::VSLConvTaskPtr ptr;
1511  int status = ::vslsConvNewTaskX1D(
1512  &ptr, mode, xshape, yshape, zshape, x, xstride);
1514  status, "MKLConvTask::reset", "::vslsConvNewTaskX1D");
1515  this->reset_ptr(ptr);
1516 
1517  return status;
1518  }
1519 
1520  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1521  const MKL_INT yshape, const MKL_INT zshape, const double *x,
1522  const MKL_INT xstride)
1523  {
1524  ::VSLConvTaskPtr ptr;
1525  int status = ::vsldConvNewTaskX1D(
1526  &ptr, mode, xshape, yshape, zshape, x, xstride);
1528  status, "MKLConvTask::reset", "::vsldConvNewTaskX1D");
1529  this->reset_ptr(ptr);
1530 
1531  return status;
1532  }
1533 
1534  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1535  const MKL_INT yshape, const MKL_INT zshape, const MKL_Complex8 *x,
1536  const MKL_INT xstride)
1537  {
1538  ::VSLConvTaskPtr ptr;
1539  int status = ::vslcConvNewTaskX1D(
1540  &ptr, mode, xshape, yshape, zshape, x, xstride);
1542  status, "MKLConvTask::reset", "::vslcConvNewTaskX1D");
1543  this->reset_ptr(ptr);
1544 
1545  return status;
1546  }
1547 
1548  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1549  const MKL_INT yshape, const MKL_INT zshape, const MKL_Complex16 *x,
1550  const MKL_INT xstride)
1551  {
1552  ::VSLConvTaskPtr ptr;
1553  int status = ::vslzConvNewTaskX1D(
1554  &ptr, mode, xshape, yshape, zshape, x, xstride);
1556  status, "MKLConvTask::reset", "::vslzConvNewTaskX1D");
1557  this->reset_ptr(ptr);
1558 
1559  return status;
1560  }
1561 }; // class MKLConvTask
1562 
1565 template <typename ResultType = double>
1566 class MKLCorrTask : public MKLBase<::VSLCorrTaskPtr, MKLCorrTask<ResultType>>
1567 {
1568  static_assert(internal::is_one_of<ResultType, float, double, MKL_Complex8,
1569  MKL_Complex16>::value,
1570  "**MKLCorrTask** USED WITH ResultType OTHER THAN float, double, "
1571  "MKL_Complex8 OR MKL_Complex16");
1572 
1573  public:
1574  using result_type = ResultType;
1575 
1577  MKLCorrTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1578  const MKL_INT *yshape, const MKL_INT *zshape)
1579  {
1580  reset(mode, dims, xshape, yshape, zshape);
1581  }
1582 
1585  MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
1586  {
1587  reset(mode, xshape, yshape, zshape);
1588  }
1589 
1591  MKLCorrTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1592  const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x,
1593  const MKL_INT *xstride)
1594  {
1595  reset(mode, dims, xshape, yshape, zshape, x, xstride);
1596  }
1597 
1599  MKLCorrTask(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape,
1600  const result_type *x, const MKL_INT xstride)
1601  {
1602  reset(mode, xshape, yshape, zshape, x, xstride);
1603  }
1604 
1607  {
1608  ::VSLCorrTaskPtr ptr = nullptr;
1609  internal::mkl_error_check(::vslCorrCopyTask(&ptr, other.get()),
1610  "MKLCorrTask::MKLCorrTask", "::vslCorrCopyTask");
1611  this->reset_ptr(ptr);
1612  }
1613 
1616  {
1617  if (this != &other) {
1618  ::VSLCorrTaskPtr ptr = nullptr;
1619  internal::mkl_error_check(::vslCorrCopyTask(&ptr, other.get()),
1620  "MKLCorrTask::operator=", "::vslCorrCopyTask");
1621  this->reset_ptr(ptr);
1622  }
1623 
1624  return *this;
1625  }
1626 
1627  MKLCorrTask(MKLCorrTask<ResultType> &&) = default;
1628  MKLCorrTask<ResultType> &operator=(MKLCorrTask<ResultType> &&) = default;
1629 
1631  static int release(::VSLCorrTaskPtr ptr)
1632  {
1633  if (ptr == nullptr)
1634  return 0;
1635 
1636  int status = ::vslCorrDeleteTask(&ptr);
1638  status, "MKLCorrTask::release", "::vslCorrDeleteTask");
1639 
1640  return status;
1641  }
1642 
1644  int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1645  const MKL_INT *yshape, const MKL_INT *zshape)
1646  {
1647  return reset_dispatch(mode, dims, xshape, yshape, zshape);
1648  }
1649 
1651  int reset(
1652  MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
1653  {
1654  return reset_dispatch(mode, xshape, yshape, zshape);
1655  }
1656 
1658  int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1659  const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x,
1660  const MKL_INT *xstride)
1661  {
1662  return reset_dispatch(mode, dims, xshape, yshape, zshape, x, xstride);
1663  }
1664 
1666  int reset(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape,
1667  const result_type *x, const MKL_INT xstride)
1668  {
1669  return reset_dispatch(mode, xshape, yshape, zshape, x, xstride);
1670  }
1671 
1672  private:
1673  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1674  const MKL_INT *yshape, const MKL_INT *zshape, float *)
1675  {
1676  ::VSLCorrTaskPtr ptr;
1677  int status =
1678  ::vslsCorrNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1680  status, "MKLCorrTask::reset", "::vslsCorrNewTask");
1681  this->reset_ptr(ptr);
1682 
1683  return status;
1684  }
1685 
1686  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1687  const MKL_INT *yshape, const MKL_INT *zshape, double *)
1688  {
1689  ::VSLCorrTaskPtr ptr;
1690  int status =
1691  ::vsldCorrNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1693  status, "MKLCorrTask::reset", "::vsldCorrNewTask");
1694  this->reset_ptr(ptr);
1695 
1696  return status;
1697  }
1698 
1699  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1700  const MKL_INT *yshape, const MKL_INT *zshape, MKL_Complex8 *)
1701  {
1702  ::VSLCorrTaskPtr ptr;
1703  int status =
1704  ::vslcCorrNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1706  status, "MKLCorrTask::reset", "::vslcCorrNewTask");
1707  this->reset_ptr(ptr);
1708 
1709  return status;
1710  }
1711 
1712  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1713  const MKL_INT *yshape, const MKL_INT *zshape, MKL_Complex16 *)
1714  {
1715  ::VSLCorrTaskPtr ptr;
1716  int status =
1717  ::vslzCorrNewTask(&ptr, mode, dims, xshape, yshape, zshape);
1719  status, "MKLCorrTask::reset", "::vslzCorrNewTask");
1720  this->reset_ptr(ptr);
1721 
1722  return status;
1723  }
1724 
1725  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1726  const MKL_INT yshape, const MKL_INT zshape, float *)
1727  {
1728  ::VSLCorrTaskPtr ptr;
1729  int status = ::vslsCorrNewTask1D(&ptr, mode, xshape, yshape, zshape);
1731  status, "MKLCorrTask::reset", "::vslsCorrNewTask1D");
1732  this->reset_ptr(ptr);
1733 
1734  return status;
1735  }
1736 
1737  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1738  const MKL_INT yshape, const MKL_INT zshape, double *)
1739  {
1740  ::VSLCorrTaskPtr ptr;
1741  int status = ::vsldCorrNewTask1D(&ptr, mode, xshape, yshape, zshape);
1743  status, "MKLCorrTask::reset", "::vsldCorrNewTask1D");
1744  this->reset_ptr(ptr);
1745 
1746  return status;
1747  }
1748 
1749  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1750  const MKL_INT yshape, const MKL_INT zshape, MKL_Complex8 *)
1751  {
1752  ::VSLCorrTaskPtr ptr;
1753  int status = ::vslcCorrNewTask1D(&ptr, mode, xshape, yshape, zshape);
1755  status, "MKLCorrTask::reset", "::vslcCorrNewTask1D");
1756  this->reset_ptr(ptr);
1757 
1758  return status;
1759  }
1760 
1761  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1762  const MKL_INT yshape, const MKL_INT zshape, MKL_Complex16 *)
1763  {
1764  ::VSLCorrTaskPtr ptr;
1765  int status = ::vslzCorrNewTask1D(&ptr, mode, xshape, yshape, zshape);
1767  status, "MKLCorrTask::reset", "::vslzCorrNewTask1D");
1768  this->reset_ptr(ptr);
1769 
1770  return status;
1771  }
1772 
1773  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1774  const MKL_INT *yshape, const MKL_INT *zshape, const float *x,
1775  const MKL_INT *xstride)
1776  {
1777  ::VSLCorrTaskPtr ptr;
1778  int status = ::vslsCorrNewTaskX(
1779  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1781  status, "MKLCorrTask::reset", "::vslsCorrNewTaskX");
1782  this->reset_ptr(ptr);
1783 
1784  return status;
1785  }
1786 
1787  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1788  const MKL_INT *yshape, const MKL_INT *zshape, const double *x,
1789  const MKL_INT *xstride)
1790  {
1791  ::VSLCorrTaskPtr ptr;
1792  int status = ::vsldCorrNewTaskX(
1793  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1795  status, "MKLCorrTask::reset", "::vsldCorrNewTaskX");
1796  this->reset_ptr(ptr);
1797 
1798  return status;
1799  }
1800 
1801  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1802  const MKL_INT *yshape, const MKL_INT *zshape, const MKL_Complex8 *x,
1803  const MKL_INT *xstride)
1804  {
1805  ::VSLCorrTaskPtr ptr;
1806  int status = ::vslcCorrNewTaskX(
1807  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1809  status, "MKLCorrTask::reset", "::vslcCorrNewTaskX");
1810  this->reset_ptr(ptr);
1811 
1812  return status;
1813  }
1814 
1815  int reset_dispatch(const MKL_INT mode, MKL_INT dims, const MKL_INT *xshape,
1816  const MKL_INT *yshape, const MKL_INT *zshape, const MKL_Complex16 *x,
1817  const MKL_INT *xstride)
1818  {
1819  ::VSLCorrTaskPtr ptr;
1820  int status = ::vslzCorrNewTaskX(
1821  &ptr, mode, dims, xshape, yshape, zshape, x, xstride);
1823  status, "MKLCorrTask::reset", "::vslzCorrNewTaskX");
1824  this->reset_ptr(ptr);
1825 
1826  return status;
1827  }
1828 
1829  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1830  const MKL_INT yshape, const MKL_INT zshape, const float *x,
1831  const MKL_INT xstride)
1832  {
1833  ::VSLCorrTaskPtr ptr;
1834  int status = ::vslsCorrNewTaskX1D(
1835  &ptr, mode, xshape, yshape, zshape, x, xstride);
1837  status, "MKLCorrTask::reset", "::vslsCorrNewTaskX1D");
1838  this->reset_ptr(ptr);
1839 
1840  return status;
1841  }
1842 
1843  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1844  const MKL_INT yshape, const MKL_INT zshape, const double *x,
1845  const MKL_INT xstride)
1846  {
1847  ::VSLCorrTaskPtr ptr;
1848  int status = ::vsldCorrNewTaskX1D(
1849  &ptr, mode, xshape, yshape, zshape, x, xstride);
1851  status, "MKLCorrTask::reset", "::vsldCorrNewTaskX1D");
1852  this->reset_ptr(ptr);
1853 
1854  return status;
1855  }
1856 
1857  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1858  const MKL_INT yshape, const MKL_INT zshape, const MKL_Complex8 *x,
1859  const MKL_INT xstride)
1860  {
1861  ::VSLCorrTaskPtr ptr;
1862  int status = ::vslcCorrNewTaskX1D(
1863  &ptr, mode, xshape, yshape, zshape, x, xstride);
1865  status, "MKLCorrTask::reset", "::vslcCorrNewTaskX1D");
1866  this->reset_ptr(ptr);
1867 
1868  return status;
1869  }
1870 
1871  int reset_dispatch(const MKL_INT mode, const MKL_INT xshape,
1872  const MKL_INT yshape, const MKL_INT zshape, const MKL_Complex16 *x,
1873  const MKL_INT xstride)
1874  {
1875  ::VSLCorrTaskPtr ptr;
1876  int status = ::vslzCorrNewTaskX1D(
1877  &ptr, mode, xshape, yshape, zshape, x, xstride);
1879  status, "MKLCorrTask::reset", "::vslzCorrNewTaskX1D");
1880  this->reset_ptr(ptr);
1881 
1882  return status;
1883  }
1884 }; // class MKLCorrTask
1885 
1888 template <typename RealType = double>
1889 class MKLDFTask : public MKLBase<::DFTaskPtr, MKLDFTask<RealType>>
1890 {
1892  "**MKLDFTask** USED WITH RealType OTHER THAN float OR double");
1893 
1894  public:
1895  using result_type = RealType;
1896 
1897  MKLDFTask(MKL_INT nx, const result_type *x, MKL_INT xhint, MKL_INT ny,
1898  const result_type *y, MKL_INT yhint)
1899  {
1900  reset(nx, x, xhint, ny, y, yhint);
1901  }
1902 
1903  static int release(::DFTaskPtr ptr)
1904  {
1905  if (ptr == nullptr)
1906  return 0;
1907 
1908  int status = ::dfDeleteTask(&ptr);
1910  status, "MKLDFTask::release", "::dfDeleteTask");
1911 
1912  return status;
1913  }
1914 
1915  int reset(MKL_INT nx, const result_type *x, MKL_INT xhint, MKL_INT ny,
1916  const result_type *y, MKL_INT yhint)
1917  {
1918  return reset_dispatch(nx, x, xhint, ny, y, yhint);
1919  }
1920 
1921  private:
1922  int reset_dispatch(MKL_INT nx, const float *x, MKL_INT xhint, MKL_INT ny,
1923  const float *y, MKL_INT yhint)
1924  {
1925  ::DFTaskPtr ptr;
1926  int status = ::dfsNewTask1D(&ptr, nx, x, xhint, ny, y, yhint);
1928  status, "MKLDFTask::reset", "::dfsNewTask1D");
1929  this->reset_ptr(ptr);
1930 
1931  return status;
1932  }
1933 
1934  int reset_dispatch(MKL_INT nx, const double *x, MKL_INT xhint, MKL_INT ny,
1935  const double *y, MKL_INT yhint)
1936  {
1937  ::DFTaskPtr ptr;
1938  int status = ::dfdNewTask1D(&ptr, nx, x, xhint, ny, y, yhint);
1940  status, "MKLDFTask::reset", "::dfdNewTask1D");
1941  this->reset_ptr(ptr);
1942 
1943  return status;
1944  }
1945 }; // class MKLDFTask
1946 
1947 } // namespace vsmc
1948 
1949 #endif // VSMC_UTILITY_MKL_HPP
int gumbel(MKL_INT n, float *r, float a, float beta, MKL_INT method=VSL_RNG_METHOD_GUMBEL_ICDF)
vsRngGumbel
Definition: mkl.hpp:517
Definition: monitor.hpp:49
static int get_num_reg_brngs()
vslGetNumRegBrngs
Definition: mkl.hpp:299
MKLStream(MKL_INT brng, MKL_INT n, unsigned *params)
vslNewStreamEx
Definition: mkl.hpp:154
int edit_sums(const result_type *sum, const result_type *r2s, const result_type *r3s, const result_type *r4s, const result_type *c2s, const result_type *c3s, const result_type *c4s)
vslSSEditSums
Definition: mkl.hpp:759
int reset(const MKL_INT *p, const MKL_INT *n, const MKL_INT *xstorage, const result_type *x, const result_type *w, const MKL_INT *indices)
vslSSNewTask
Definition: mkl.hpp:719
int gamma(MKL_INT n, double *r, double alpha, double a, double beta, MKL_INT method=VSL_RNG_METHOD_GAMMA_GNORM)
vdRngGamma
Definition: mkl.hpp:549
int edit_quantiles(const MKL_INT *quant_order_n, const result_type *quant_order, const result_type *quant, const result_type *order_stats, const MKL_INT *order_stats_storage)
vslSSEditQuantiles
Definition: mkl.hpp:793
int exponential(MKL_INT n, float *r, float a, float beta, MKL_INT method=VSL_RNG_METHOD_EXPONENTIAL_ICDF)
vsRngExponential
Definition: mkl.hpp:383
int uniform_bits32(MKL_INT n, unsigned *r, MKL_INT method=VSL_RNG_METHOD_UNIFORMBITS32_STD)
viRngUniform32
Definition: mkl.hpp:601
int gaussian_mv(MKL_INT n, float *r, MKL_INT dimen, MKL_INT mstorage, const float *a, const float *t, MKL_INT method=VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2)
vsRngGaussianMV
Definition: mkl.hpp:357
int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape)
vslCorrNewTask
Definition: mkl.hpp:1644
MKLCorrTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape)
vslCorrNewTask
Definition: mkl.hpp:1577
typename std::remove_pointer< ::VSLStreamStatePtr >::type element_type
Definition: mkl.hpp:74
int geometric(MKL_INT n, int *r, double p, MKL_INT method=VSL_RNG_METHOD_GEOMETRIC_ICDF)
viRngGeometric
Definition: mkl.hpp:634
int gaussian(MKL_INT n, double *r, double a, double sigma, MKL_INT method=VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2)
vdRngGaussian
Definition: mkl.hpp:346
MKLConvTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape)
vslConvNewTask
Definition: mkl.hpp:1254
int gaussian(MKL_INT n, float *r, float a, float sigma, MKL_INT method=VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2)
vsRngGaussian
Definition: mkl.hpp:335
int edit_moments(const result_type *mean, const result_type *r2m, const result_type *r3m, const result_type *r4m, const result_type *c2m, const result_type *c3m, const result_type *c4m)
vslSSEditMoments
Definition: mkl.hpp:751
int rayleigh(MKL_INT n, double *r, double a, double beta, MKL_INT method=VSL_RNG_METHOD_RAYLEIGH_ICDF)
vdRngRayleigh
Definition: mkl.hpp:482
int compute(unsigned MKL_INT64 estimates, MKL_INT method)
vslSSCompute
Definition: mkl.hpp:859
int reset(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape, const result_type *x, const MKL_INT xstride)
vslConvNewTaskX1D
Definition: mkl.hpp:1343
int edit_task(MKL_INT parameter, const MKL_INT *par_addr)
vsliSSEditTask
Definition: mkl.hpp:745
static int get_brng_properties(MKL_INT brng,::VSLBRngProperties &properties)
vslGetBrngProperties
Definition: mkl.hpp:302
int release()
Definition: mkl.hpp:94
MKL VSLCorrTaskPtr
Definition: mkl.hpp:1566
MKLConvTask(MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
vslConvNewTask1D
Definition: mkl.hpp:1261
int leapfrog(MKL_INT k, MKL_INT nstreams)
vslLeapfrogStream
Definition: mkl.hpp:276
int edit_missing_values(const MKL_INT *nparams, const result_type *params, const MKL_INT *init_estimates_n, const result_type *init_estimates, const MKL_INT *prior_n, const result_type *prior, const MKL_INT *simul_missing_vals_n, const result_type *simul_missing_vals, const MKL_INT *estimates_n, const result_type *estimates)
vslSSEditMissingValues
Definition: mkl.hpp:837
MKL DFTaskPtr
Definition: mkl.hpp:1889
int get_size() const
vslGetStreamSize
Definition: mkl.hpp:273
int neg_binomial(MKL_INT n, int *r, double a, double p, MKL_INT method=VSL_RNG_METHOD_NEGBINOMIAL_NBAR)
viRngNegbinomial
Definition: mkl.hpp:689
MKLStream(MKL_INT brng, MKL_UINT seed)
vslNewStream
Definition: mkl.hpp:151
MKLDFTask(MKL_INT nx, const result_type *x, MKL_INT xhint, MKL_INT ny, const result_type *y, MKL_INT yhint)
Definition: mkl.hpp:1897
#define VSMC_RUNTIME_ASSERT(cond, msg)
Definition: assert.hpp:53
int gumbel(MKL_INT n, double *r, double a, double beta, MKL_INT method=VSL_RNG_METHOD_GUMBEL_ICDF)
vdRngGumbel
Definition: mkl.hpp:528
int get_brng() const
vslGetStreamStateBrng
Definition: mkl.hpp:296
int hypergeometric(MKL_INT n, int *r, int l, int s, int m, MKL_INT method=VSL_RNG_METHOD_HYPERGEOMETRIC_H2PE)
viRngHypergeometric
Definition: mkl.hpp:656
static int release(::DFTaskPtr ptr)
Definition: mkl.hpp:1903
int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape)
vslConvNewTask
Definition: mkl.hpp:1321
pointer get() const
Definition: mkl.hpp:104
int uniform(MKL_INT n, float *r, float a, float b, MKL_INT method=VSL_RNG_METHOD_UNIFORM_STD)
vsRngUniform
Definition: mkl.hpp:313
int poisson_v(MKL_INT n, int *r, const double *lambda, MKL_INT method=VSL_RNG_METHOD_POISSONV_POISNORM)
viRngPoissonV
Definition: mkl.hpp:678
MKLSSTask(const MKL_INT *p, const MKL_INT *n, const MKL_INT *xstorage, const result_type *x, const result_type *w, const MKL_INT *indices)
vslSSNewTask
Definition: mkl.hpp:712
static int release(::VSLSSTaskPtr ptr)
vslSSDeleteTask
Definition: mkl.hpp:726
bool operator!=(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
int poisson(MKL_INT n, int *r, double lambda, MKL_INT method=VSL_RNG_METHOD_POISSON_PTPE)
viRngPoisson
Definition: mkl.hpp:667
int edit_cp(const result_type *mean, const result_type *sum, const result_type *cp, const MKL_INT *cp_storage)
vslSSEditCP
Definition: mkl.hpp:775
std::string itos(UIntType i, std::true_type)
Definition: common.hpp:100
int uniform(MKL_INT n, double *r, double a, double b, MKL_INT method=VSL_RNG_METHOD_UNIFORM_STD)
vdRngUniform
Definition: mkl.hpp:324
static int release(::VSLCorrTaskPtr ptr)
vslCorrDeleteTask
Definition: mkl.hpp:1631
void mkl_error_check(int status, const char *func, const char *mklf)
Definition: mkl.hpp:48
int edit_pooled_covariance(const MKL_INT *grp_indices, const result_type *pld_mean, const result_type *pld_cov, const MKL_INT *req_grp_indices, const result_type *grp_means, const result_type *grp_cov)
vslSSEditPooledCovariance
Definition: mkl.hpp:811
int uniform(MKL_INT n, int *r, int a, int b, MKL_INT method=VSL_RNG_METHOD_UNIFORM_STD)
viRngUniform
Definition: mkl.hpp:579
int reset(MKL_INT brng, MKL_INT n, unsigned *params)
vslNewStreamEx
Definition: mkl.hpp:204
int edit_stream_quantiles(const MKL_INT *quant_order_n, const result_type *quant_order, const result_type *quants, const MKL_INT *nparams, const result_type *params)
vslSSEditStreamQuantiles
Definition: mkl.hpp:802
int save_m(char *memptr) const
vslSaveStreamM
Definition: mkl.hpp:251
int beta(MKL_INT n, float *r, float p, float q, float a, float beta, MKL_INT method=VSL_RNG_METHOD_BETA_CJA)
vsRngBeta
Definition: mkl.hpp:559
int beta(MKL_INT n, double *r, double p, double q, double a, double beta, MKL_INT method=VSL_RNG_METHOD_BETA_CJA)
vdRngBeta
Definition: mkl.hpp:569
int edit_partial_cov_cor(const MKL_INT *p_idx_array, const result_type *cov, const MKL_INT *cov_storage, const result_type *cor, const MKL_INT *cor_storage, const result_type *p_cov, const MKL_INT *p_cov_storage, const result_type *p_cor, const MKL_INT *p_cor_storage) const
vslSSEditPartialCovCor
Definition: mkl.hpp:782
static int release(::VSLStreamStatePtr ptr)
vslDeleteStream
Definition: mkl.hpp:216
const deleter_type & get_deleter() const
Definition: mkl.hpp:107
void operator()(MKLPtr ptr)
Definition: mkl.hpp:79
MKLCorrTask(MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
vslCorrNewTask1D
Definition: mkl.hpp:1584
int reset(MKL_INT brng, MKL_UINT seed)
vslNewStream
Definition: mkl.hpp:192
MKLConvTask(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape, const result_type *x, const MKL_INT xstride)
vslConvNewTaskX1D
Definition: mkl.hpp:1276
int reset(MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
vslConvNewTask1D
Definition: mkl.hpp:1328
RealType result_type
Definition: mkl.hpp:709
int reset(MKL_INT mode, const MKL_INT xshape, MKL_INT yshape, MKL_INT zshape)
vslCorrNewTask1D
Definition: mkl.hpp:1651
int edit_cov_cor(const result_type *mean, const result_type *cov, const MKL_INT *cov_storage, const result_type *cor, const MKL_INT *cor_storage)
vslSSEditCovCor
Definition: mkl.hpp:767
int weibull(MKL_INT n, double *r, double alpha, double a, double beta, MKL_INT method=VSL_RNG_METHOD_WEIBULL_ICDF)
vdRngWeibull
Definition: mkl.hpp:438
void swap(const MKLBase< MKLPtr, Derived > &ptr1, const MKLBase< MKLPtr, Derived > &ptr2)
Swap two MKLBase objects.
Definition: mkl.hpp:139
int gaussian_mv(MKL_INT n, double *r, MKL_INT dimen, MKL_INT mstorage, const double *a, const double *t, MKL_INT method=VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2)
vdRngGaussianMV
Definition: mkl.hpp:370
bool operator==(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
int lognormal(MKL_INT n, float *r, float a, float sigma, float b, float beta, MKL_INT method=VSL_RNG_METHOD_LOGNORMAL_BOXMULLER2)
vsRngLognormal
Definition: mkl.hpp:493
int skip_ahead(long long nskip)
vslSkipAheadStream
Definition: mkl.hpp:286
int load_f(const std::string &fname)
vslSaveStreamF
Definition: mkl.hpp:239
ResultType result_type
Definition: mkl.hpp:1574
int weibull(MKL_INT n, float *r, float alpha, float a, float beta, MKL_INT method=VSL_RNG_METHOD_WEIBULL_ICDF)
vsRngWeibull
Definition: mkl.hpp:427
MKL VSLSSTaskPtr
Definition: mkl.hpp:703
int load_m(const char *memptr)
vslLoadStreamM
Definition: mkl.hpp:261
int uniform_bits64(MKL_INT n, unsigned MKL_INT64 *r, MKL_INT method=VSL_RNG_METHOD_UNIFORMBITS64_STD)
viRngUniform64
Definition: mkl.hpp:612
int edit_outliers_detection(const MKL_INT *nparams, const result_type *params, const result_type *w)
vslSSEditOutliersDetection
Definition: mkl.hpp:830
MKLConvTask< ResultType > & operator=(const MKLConvTask< ResultType > &other)
vslConvCopyTask
Definition: mkl.hpp:1292
int bernoulli(MKL_INT n, int *r, double p, MKL_INT method=VSL_RNG_METHOD_BERNOULLI_ICDF)
viRngBernoulli
Definition: mkl.hpp:623
MKLCorrTask(const MKLCorrTask< ResultType > &other)
vslCorrCopyTask
Definition: mkl.hpp:1606
int cauchy(MKL_INT n, double *r, double a, double beta, MKL_INT method=VSL_RNG_METHOD_CAUCHY_ICDF)
vdRngCauchy
Definition: mkl.hpp:460
void swap(MKLBase< MKLPtr, Derived > &other)
Definition: mkl.hpp:102
void reset(pointer ptr)
Definition: mkl.hpp:96
int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x, const MKL_INT *xstride)
vslCorrNewTaskX
Definition: mkl.hpp:1658
MKLConvTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x, const MKL_INT *xstride)
vslConvNewTaskX
Definition: mkl.hpp:1268
int lognormal(MKL_INT n, double *r, double a, double sigma, double b, double beta, MKL_INT method=VSL_RNG_METHOD_LOGNORMAL_BOXMULLER2)
vdRngLognormal
Definition: mkl.hpp:505
int rayleigh(MKL_INT n, float *r, float a, float beta, MKL_INT method=VSL_RNG_METHOD_RAYLEIGH_ICDF)
vsRngRayleigh
Definition: mkl.hpp:471
MKL resource management base class.
Definition: mkl.hpp:70
int edit_task(MKL_INT parameter, const result_type *par_addr)
vslSSEditTask
Definition: mkl.hpp:739
static int release(::VSLConvTaskPtr ptr)
vslConvDeleteTask
Definition: mkl.hpp:1308
int status() const
Definition: mkl.hpp:81
MKL VSLStreamStatePtr
Definition: mkl.hpp:147
int save_f(const std::string &fname) const
vslSaveStreamF
Definition: mkl.hpp:229
RealType result_type
Definition: mkl.hpp:1895
MKLCorrTask(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x, const MKL_INT *xstride)
vslCorrNewTaskX
Definition: mkl.hpp:1591
void reset_ptr(pointer ptr)
Definition: mkl.hpp:112
int gamma(MKL_INT n, float *r, float alpha, float a, float beta, MKL_INT method=VSL_RNG_METHOD_GAMMA_GNORM)
vsRngGamma
Definition: mkl.hpp:539
int reset(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape, const result_type *x, const MKL_INT xstride)
vslCorrNewTaskX1D
Definition: mkl.hpp:1666
int laplace(MKL_INT n, float *r, float a, float beta, MKL_INT method=VSL_RNG_METHOD_LAPLACE_ICDF)
vsRngLaplace
Definition: mkl.hpp:405
int edit_robust_covariance(const MKL_INT *rcov_storage, const MKL_INT *nparams, const result_type *params, const result_type *rmean, const result_type *rcov)
vslSSEditRobustCovariance
Definition: mkl.hpp:821
int reset(MKL_INT nx, const result_type *x, MKL_INT xhint, MKL_INT ny, const result_type *y, MKL_INT yhint)
Definition: mkl.hpp:1915
MKLStream(const MKLStream &other)
vslCopyStream
Definition: mkl.hpp:160
int uniform_bits(MKL_INT n, unsigned *r, MKL_INT method=VSL_RNG_METHOD_UNIFORMBITS_STD)
viRngUniform
Definition: mkl.hpp:590
int binomial(MKL_INT n, int *r, int ntrial, double p, MKL_INT method=VSL_RNG_METHOD_BINOMIAL_BTPE)
viRngBinomial
Definition: mkl.hpp:645
MKLCorrTask(MKL_INT mode, MKL_INT xshape, MKL_INT yshape, MKL_INT zshape, const result_type *x, const MKL_INT xstride)
vslCorrNewTaskX1D
Definition: mkl.hpp:1599
ResultType result_type
Definition: mkl.hpp:1251
MKLCorrTask< ResultType > & operator=(const MKLCorrTask< ResultType > &other)
vslCorrCopyTask
Definition: mkl.hpp:1615
int exponential(MKL_INT n, double *r, double a, double beta, MKL_INT method=VSL_RNG_METHOD_EXPONENTIAL_ICDF)
vdRngExponential
Definition: mkl.hpp:394
MKL VSLConvTaskPtr
Definition: mkl.hpp:1243
int reset(MKL_INT mode, MKL_INT dims, const MKL_INT *xshape, const MKL_INT *yshape, const MKL_INT *zshape, const result_type *x, const MKL_INT *xstride)
vslConvNewTaskX
Definition: mkl.hpp:1335
int edit_cor_parameterization(const result_type *cor, const MKL_INT *cor_storage, const result_type *pcor, const MKL_INT *pcor_storage)
vslSSEditCorParameterization
Definition: mkl.hpp:850
deleter_type & get_deleter()
Definition: mkl.hpp:106
MKLStream & operator=(const MKLStream &other)
vslCopyStream/vslCopySreamState
Definition: mkl.hpp:170
int laplace(MKL_INT n, double *r, double a, double beta, MKL_INT method=VSL_RNG_METHOD_LAPLACE_ICDF)
vdRngLaplace
Definition: mkl.hpp:416
MKLConvTask(const MKLConvTask< ResultType > &other)
vslConvCopyTask
Definition: mkl.hpp:1283
int cauchy(MKL_INT n, float *r, float a, float beta, MKL_INT method=VSL_RNG_METHOD_CAUCHY_ICDF)
vsRngCauchy
Definition: mkl.hpp:449