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