EigenRand  0.2.0
Core.h
Go to the documentation of this file.
1 
13 #ifndef EIGENRAND_CORE_H
14 #define EIGENRAND_CORE_H
15 
16 #include <EigenRand/RandUtils.h>
17 #include <EigenRand/Dists/Basic.h>
18 #include <EigenRand/Dists/Discrete.h>
19 #include <EigenRand/Dists/NormalExp.h>
20 #include <EigenRand/Dists/GammaPoisson.h>
21 
22 namespace Eigen
23 {
28  namespace Rand
29  {
30  template<typename Derived, typename Urng>
31  using RandBitsType = CwiseNullaryOp<internal::scalar_randbits_op<typename Derived::Scalar, Urng>, const Derived>;
32 
43  template<typename Derived, typename Urng>
44  inline const RandBitsType<Derived, Urng>
45  randBits(Index rows, Index cols, Urng&& urng)
46  {
47  return {
48  rows, cols, internal::scalar_randbits_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
49  };
50  }
51 
61  template<typename Derived, typename Urng>
62  inline const RandBitsType<Derived, Urng>
63  randBitsLike(Derived& o, Urng&& urng)
64  {
65  return {
66  o.rows(), o.cols(), internal::scalar_randbits_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
67  };
68  }
69 
70  template<typename Derived, typename Urng>
71  using UniformIntType = CwiseNullaryOp<internal::scalar_uniform_int_op<typename Derived::Scalar, Urng>, const Derived>;
72 
84  template<typename Derived, typename Urng>
85  inline const UniformIntType<Derived, Urng>
86  uniformInt(Index rows, Index cols, Urng&& urng, typename Derived::Scalar min, typename Derived::Scalar max)
87  {
88  return {
89  rows, cols, internal::scalar_uniform_int_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), min, max)
90  };
91  }
92 
103  template<typename Derived, typename Urng>
104  inline const UniformIntType<Derived, Urng>
105  uniformIntLike(Derived& o, Urng&& urng, typename Derived::Scalar min, typename Derived::Scalar max)
106  {
107  return {
108  o.rows(), o.cols(), internal::scalar_uniform_int_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), min, max)
109  };
110  }
111 
112  template<typename Derived, typename Urng>
113  using BalancedType = CwiseNullaryOp<internal::scalar_balanced_op<typename Derived::Scalar, Urng>, const Derived>;
114 
125  template<typename Derived, typename Urng>
126  inline const BalancedType<Derived, Urng>
127  balanced(Index rows, Index cols, Urng&& urng)
128  {
129  return {
130  rows, cols, internal::scalar_balanced_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
131  };
132  }
133 
143  template<typename Derived, typename Urng>
144  inline const BalancedType<Derived, Urng>
145  balancedLike(const Derived& o, Urng&& urng)
146  {
147  return {
148  o.rows(), o.cols(), internal::scalar_balanced_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
149  };
150  }
151 
152  template<typename Derived, typename Urng>
153  using UniformRealType = CwiseNullaryOp<internal::scalar_uniform_real_op<typename Derived::Scalar, Urng>, const Derived>;
154 
165  template<typename Derived, typename Urng>
166  inline const UniformRealType<Derived, Urng>
167  uniformReal(Index rows, Index cols, Urng&& urng)
168  {
169  return {
170  rows, cols, internal::scalar_uniform_real_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
171  };
172  }
173 
183  template<typename Derived, typename Urng>
184  inline const UniformRealType<Derived, Urng>
185  uniformRealLike(Derived& o, Urng&& urng)
186  {
187  return {
188  o.rows(), o.cols(), internal::scalar_uniform_real_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
189  };
190  }
191 
192  template<typename Derived, typename Urng>
193  using NormalType = CwiseNullaryOp<internal::scalar_norm_dist_op<typename Derived::Scalar, Urng>, const Derived>;
194 
205  template<typename Derived, typename Urng>
206  inline const NormalType<Derived, Urng>
207  normal(Index rows, Index cols, Urng&& urng)
208  {
209  return {
210  rows, cols, internal::scalar_norm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
211  };
212  }
213 
223  template<typename Derived, typename Urng>
224  inline const NormalType<Derived, Urng>
225  normalLike(Derived& o, Urng&& urng)
226  {
227  return {
228  o.rows(), o.cols(), internal::scalar_norm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
229  };
230  }
231 
232  template<typename Derived, typename Urng>
233  using Normal2Type = CwiseNullaryOp<internal::scalar_norm_dist2_op<typename Derived::Scalar, Urng>, const Derived>;
234 
247  template<typename Derived, typename Urng>
248  inline const Normal2Type<Derived, Urng>
249  normal(Index rows, Index cols, Urng&& urng, typename Derived::Scalar mean, typename Derived::Scalar stdev = 1)
250  {
251  return {
252  rows, cols, internal::scalar_norm_dist2_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
253  };
254  }
255 
267  template<typename Derived, typename Urng>
268  inline const Normal2Type<Derived, Urng>
269  normalLike(Derived& o, Urng&& urng, typename Derived::Scalar mean, typename Derived::Scalar stdev = 1)
270  {
271  return {
272  o.rows(), o.cols(), internal::scalar_norm_dist2_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
273  };
274  }
275 
276  template<typename Derived, typename Urng>
277  using LognormalType = CwiseNullaryOp<internal::scalar_lognorm_dist_op<typename Derived::Scalar, Urng>, const Derived>;
278 
291  template<typename Derived, typename Urng>
292  inline const LognormalType<Derived, Urng>
293  lognormal(Index rows, Index cols, Urng&& urng, typename Derived::Scalar mean = 0, typename Derived::Scalar stdev = 1)
294  {
295  return {
296  rows, cols, internal::scalar_lognorm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
297  };
298  }
299 
311  template<typename Derived, typename Urng>
312  inline const LognormalType<Derived, Urng>
313  lognormalLike(Derived& o, Urng&& urng, typename Derived::Scalar mean = 0, typename Derived::Scalar stdev = 1)
314  {
315  return {
316  o.rows(), o.cols(), internal::scalar_lognorm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
317  };
318  }
319 
320  template<typename Derived, typename Urng>
321  using StudentTType = CwiseNullaryOp<internal::scalar_student_t_dist_op<typename Derived::Scalar, Urng>, const Derived>;
322 
334  template<typename Derived, typename Urng>
335  inline const StudentTType<Derived, Urng>
336  studentT(Index rows, Index cols, Urng&& urng, typename Derived::Scalar n = 1)
337  {
338  return {
339  rows, cols, internal::scalar_student_t_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
340  };
341  }
342 
353  template<typename Derived, typename Urng>
354  inline const StudentTType<Derived, Urng>
355  studentTLike(Derived& o, Urng&& urng, typename Derived::Scalar n = 1)
356  {
357  return {
358  o.rows(), o.cols(), internal::scalar_student_t_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
359  };
360  }
361 
362  template<typename Derived, typename Urng>
363  using ExponentialType = CwiseNullaryOp<internal::scalar_exp_dist_op<typename Derived::Scalar, Urng>, const Derived>;
364 
376  template<typename Derived, typename Urng>
377  inline const ExponentialType<Derived, Urng>
378  exponential(Index rows, Index cols, Urng&& urng, typename Derived::Scalar lambda = 1)
379  {
380  return {
381  rows, cols, internal::scalar_exp_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), lambda)
382  };
383  }
384 
395  template<typename Derived, typename Urng>
396  inline const ExponentialType<Derived, Urng>
397  exponentialLike(Derived& o, Urng&& urng, typename Derived::Scalar lambda = 1)
398  {
399  return {
400  o.rows(), o.cols(), internal::scalar_exp_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), lambda)
401  };
402  }
403 
404  template<typename Derived, typename Urng>
405  using GammaType = CwiseNullaryOp<internal::scalar_gamma_dist_op<typename Derived::Scalar, Urng>, const Derived>;
406 
419  template<typename Derived, typename Urng>
420  inline const GammaType<Derived, Urng>
421  gamma(Index rows, Index cols, Urng&& urng, typename Derived::Scalar alpha = 1, typename Derived::Scalar beta = 1)
422  {
423  return {
424  rows, cols, internal::scalar_gamma_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), alpha, beta)
425  };
426  }
427 
439  template<typename Derived, typename Urng>
440  inline const GammaType<Derived, Urng>
441  gammaLike(Derived& o, Urng&& urng, typename Derived::Scalar alpha = 1, typename Derived::Scalar beta = 1)
442  {
443  return {
444  o.rows(), o.cols(), internal::scalar_gamma_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), alpha, beta)
445  };
446  }
447 
448  template<typename Derived, typename Urng>
449  using WeibullType = CwiseNullaryOp<internal::scalar_weibull_dist_op<typename Derived::Scalar, Urng>, const Derived>;
450 
463  template<typename Derived, typename Urng>
464  inline const WeibullType<Derived, Urng>
465  weibull(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
466  {
467  return {
468  rows, cols, internal::scalar_weibull_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
469  };
470  }
471 
483  template<typename Derived, typename Urng>
484  inline const WeibullType<Derived, Urng>
485  weibullLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
486  {
487  return {
488  o.rows(), o.cols(), internal::scalar_weibull_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
489  };
490  }
491 
492  template<typename Derived, typename Urng>
493  using ExtremeValueType = CwiseNullaryOp<internal::scalar_extreme_value_dist_op<typename Derived::Scalar, Urng>, const Derived>;
494 
508  template<typename Derived, typename Urng>
509  inline const ExtremeValueType<Derived, Urng>
510  extremeValue(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
511  {
512  return {
513  rows, cols, internal::scalar_extreme_value_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
514  };
515  }
516 
529  template<typename Derived, typename Urng>
530  inline const ExtremeValueType<Derived, Urng>
531  extremeValueLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
532  {
533  return {
534  o.rows(), o.cols(), internal::scalar_extreme_value_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
535  };
536  }
537 
538  template<typename Derived, typename Urng>
539  using ChiSquaredType = CwiseNullaryOp<internal::scalar_chi_squared_dist_op<typename Derived::Scalar, Urng>, const Derived>;
540 
552  template<typename Derived, typename Urng>
553  inline const ChiSquaredType<Derived, Urng>
554  chiSquared(Index rows, Index cols, Urng&& urng, typename Derived::Scalar n = 1)
555  {
556  return {
557  rows, cols, internal::scalar_chi_squared_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
558  };
559  }
560 
571  template<typename Derived, typename Urng>
572  inline const ChiSquaredType<Derived, Urng>
573  chiSquaredLike(Derived& o, Urng&& urng, typename Derived::Scalar n = 1)
574  {
575  return {
576  o.rows(), o.cols(), internal::scalar_chi_squared_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
577  };
578  }
579 
580  template<typename Derived, typename Urng>
581  using CauchyType = CwiseNullaryOp<internal::scalar_cauchy_dist_op<typename Derived::Scalar, Urng>, const Derived>;
582 
595  template<typename Derived, typename Urng>
596  inline const CauchyType<Derived, Urng>
597  cauchy(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
598  {
599  return {
600  rows, cols, internal::scalar_cauchy_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
601  };
602  }
603 
615  template<typename Derived, typename Urng>
616  inline const CauchyType<Derived, Urng>
617  cauchyLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
618  {
619  return {
620  o.rows(), o.cols(), internal::scalar_cauchy_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
621  };
622  }
623 
624  template<typename Derived, typename Urng>
625  using FisherFType = CwiseNullaryOp<internal::scalar_fisher_f_dist_op<typename Derived::Scalar, Urng>, const Derived>;
626 
639  template<typename Derived, typename Urng>
640  inline const FisherFType<Derived, Urng>
641  fisherF(Index rows, Index cols, Urng&& urng, typename Derived::Scalar m = 1, typename Derived::Scalar n = 1)
642  {
643  return {
644  rows, cols, internal::scalar_fisher_f_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), m, n)
645  };
646  }
647 
659  template<typename Derived, typename Urng>
660  inline const FisherFType<Derived, Urng>
661  fisherFLike(Derived& o, Urng&& urng, typename Derived::Scalar m = 1, typename Derived::Scalar n = 1)
662  {
663  return {
664  o.rows(), o.cols(), internal::scalar_fisher_f_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), m, n)
665  };
666  }
667 
668  template<typename Derived, typename Urng>
669  using BetaType = CwiseNullaryOp<internal::scalar_beta_dist_op<typename Derived::Scalar, Urng>, const Derived>;
670 
682  template<typename Derived, typename Urng>
683  inline const BetaType<Derived, Urng>
684  beta(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
685  {
686  return {
687  rows, cols, internal::scalar_beta_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
688  };
689  }
690 
701  template<typename Derived, typename Urng>
702  inline const BetaType<Derived, Urng>
703  betaLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
704  {
705  return {
706  o.rows(), o.cols(), internal::scalar_beta_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
707  };
708  }
709 
710  template<typename Derived, typename Urng>
711  using DiscreteFType = CwiseNullaryOp<internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, float>, const Derived>;
712 
725  template<typename Derived, typename Urng, typename RealIter>
726  inline const DiscreteFType<Derived, Urng>
727  discreteF(Index rows, Index cols, Urng&& urng, RealIter first, RealIter last)
728  {
729  return {
730  rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), first, last)
731  };
732  }
733 
745  template<typename Derived, typename Urng, typename RealIter>
746  inline const DiscreteFType<Derived, Urng>
747  discreteFLike(Derived& o, Urng&& urng, RealIter first, RealIter last)
748  {
749  return {
750  o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), first, last)
751  };
752  }
753 
766  template<typename Derived, typename Urng, typename Real>
767  inline const DiscreteFType<Derived, Urng>
768  discreteF(Index rows, Index cols, Urng&& urng, const std::initializer_list<Real>& il)
769  {
770  return {
771  rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), il.begin(), il.end())
772  };
773  }
774 
786  template<typename Derived, typename Urng, typename Real>
787  inline const DiscreteFType<Derived, Urng>
788  discreteFLike(Derived& o, Urng&& urng, const std::initializer_list<Real>& il)
789  {
790  return {
791  o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), il.begin(), il.end())
792  };
793  }
794 
795  template<typename Derived, typename Urng>
796  using DiscreteDType = CwiseNullaryOp<internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>, const Derived>;
797 
810  template<typename Derived, typename Urng, typename RealIter>
811  inline const DiscreteDType<Derived, Urng>
812  discreteD(Index rows, Index cols, Urng&& urng, RealIter first, RealIter last)
813  {
814  return {
815  rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), first, last)
816  };
817  }
818 
830  template<typename Derived, typename Urng, typename RealIter>
831  inline const DiscreteDType<Derived, Urng>
832  discreteDLike(Derived& o, Urng&& urng, RealIter first, RealIter last)
833  {
834  return {
835  o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), first, last)
836  };
837  }
838 
851  template<typename Derived, typename Urng, typename Real>
852  inline const DiscreteDType<Derived, Urng>
853  discreteD(Index rows, Index cols, Urng&& urng, const std::initializer_list<Real>& il)
854  {
855  return {
856  rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), il.begin(), il.end())
857  };
858  }
859 
871  template<typename Derived, typename Urng, typename Real>
872  inline const DiscreteDType<Derived, Urng>
873  discreteDLike(Derived& o, Urng&& urng, const std::initializer_list<Real>& il)
874  {
875  return {
876  o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), il.begin(), il.end())
877  };
878  }
879 
880  template<typename Derived, typename Urng>
881  using DiscreteType = CwiseNullaryOp<internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>, const Derived>;
882 
895  template<typename Derived, typename Urng, typename RealIter>
896  inline const DiscreteType<Derived, Urng>
897  discrete(Index rows, Index cols, Urng&& urng, RealIter first, RealIter last)
898  {
899  return {
900  rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), first, last)
901  };
902  }
903 
915  template<typename Derived, typename Urng, typename RealIter>
916  inline const DiscreteType<Derived, Urng>
917  discreteLike(Derived& o, Urng&& urng, RealIter first, RealIter last)
918  {
919  return {
920  o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), first, last)
921  };
922  }
923 
936  template<typename Derived, typename Urng, typename Real>
937  inline const DiscreteType<Derived, Urng>
938  discrete(Index rows, Index cols, Urng&& urng, const std::initializer_list<Real>& il)
939  {
940  return {
941  rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), il.begin(), il.end())
942  };
943  }
944 
956  template<typename Derived, typename Urng, typename Real>
957  inline const DiscreteType<Derived, Urng>
958  discreteLike(Derived& o, Urng&& urng, const std::initializer_list<Real>& il)
959  {
960  return {
961  o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), il.begin(), il.end())
962  };
963  }
964 
965  template<typename Derived, typename Urng>
966  using PoissonType = CwiseNullaryOp<internal::scalar_poisson_dist_op<typename Derived::Scalar, Urng>, const Derived>;
967 
979  template<typename Derived, typename Urng>
980  inline const PoissonType<Derived, Urng>
981  poisson(Index rows, Index cols, Urng&& urng, double mean = 1)
982  {
983  return {
984  rows, cols, internal::scalar_poisson_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean)
985  };
986  }
987 
998  template<typename Derived, typename Urng>
999  inline const PoissonType<Derived, Urng>
1000  poissonLike(Derived& o, Urng&& urng, double mean = 1)
1001  {
1002  return {
1003  o.rows(), o.cols(), internal::scalar_poisson_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean)
1004  };
1005  }
1006 
1007  template<typename Derived, typename Urng>
1008  using BinomialType = CwiseNullaryOp<internal::scalar_binomial_dist_op<typename Derived::Scalar, Urng>, const Derived>;
1009 
1022  template<typename Derived, typename Urng>
1023  inline const BinomialType<Derived, Urng>
1024  binomial(Index rows, Index cols, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
1025  {
1026  return {
1027  rows, cols, internal::scalar_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
1028  };
1029  }
1030 
1042  template<typename Derived, typename Urng>
1043  inline const BinomialType<Derived, Urng>
1044  binomialLike(Derived& o, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
1045  {
1046  return {
1047  o.rows(), o.cols(), internal::scalar_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
1048  };
1049  }
1050 
1051  template<typename Derived, typename Urng>
1052  using NegativeBinomialType = CwiseNullaryOp<internal::scalar_negative_binomial_dist_op<typename Derived::Scalar, Urng>, const Derived>;
1053 
1066  template<typename Derived, typename Urng>
1067  inline const NegativeBinomialType<Derived, Urng>
1068  negativeBinomial(Index rows, Index cols, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
1069  {
1070  return {
1071  rows, cols, internal::scalar_negative_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
1072  };
1073  }
1074 
1086  template<typename Derived, typename Urng>
1087  inline const NegativeBinomialType<Derived, Urng>
1088  negativeBinomialLike(Derived& o, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
1089  {
1090  return {
1091  o.rows(), o.cols(), internal::scalar_negative_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
1092  };
1093  }
1094 
1095  template<typename Derived, typename Urng>
1096  using GeometricType = CwiseNullaryOp<internal::scalar_geometric_dist_op<typename Derived::Scalar, Urng>, const Derived>;
1097 
1109  template<typename Derived, typename Urng>
1110  inline const GeometricType<Derived, Urng>
1111  geometric(Index rows, Index cols, Urng&& urng, double p = 0.5)
1112  {
1113  return {
1114  rows, cols, internal::scalar_geometric_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), p)
1115  };
1116  }
1117 
1128  template<typename Derived, typename Urng>
1129  inline const GeometricType<Derived, Urng>
1130  geometricLike(Derived& o, Urng&& urng, double p = 0.5)
1131  {
1132  return {
1133  o.rows(), o.cols(), internal::scalar_geometric_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), p)
1134  };
1135  }
1136  }
1137 }
1138 
1139 #endif
Eigen::Rand::geometric
const GeometricType< Derived, Urng > geometric(Index rows, Index cols, Urng &&urng, double p=0.5)
generates reals on the geometric distribution.
Definition: Core.h:1111
Eigen::Rand::geometricLike
const GeometricType< Derived, Urng > geometricLike(Derived &o, Urng &&urng, double p=0.5)
generates reals on the geometric distribution.
Definition: Core.h:1130
Eigen::Rand::balanced
const BalancedType< Derived, Urng > balanced(Index rows, Index cols, Urng &&urng)
generates reals in a range [-1, 1]
Definition: Core.h:127
Eigen::Rand::normalLike
const NormalType< Derived, Urng > normalLike(Derived &o, Urng &&urng)
generates reals on a standard normal distribution (mean = 0, stdev=1)
Definition: Core.h:225
Eigen::Rand::discreteFLike
const DiscreteFType< Derived, Urng > discreteFLike(Derived &o, Urng &&urng, RealIter first, RealIter last)
generates random integers on the interval [0, n), where the probability of each individual integer i ...
Definition: Core.h:747
Eigen::Rand::poisson
const PoissonType< Derived, Urng > poisson(Index rows, Index cols, Urng &&urng, double mean=1)
generates reals on the Poisson distribution.
Definition: Core.h:981
Eigen::Rand::uniformReal
const UniformRealType< Derived, Urng > uniformReal(Index rows, Index cols, Urng &&urng)
generates reals in a range [0, 1)
Definition: Core.h:167
Eigen::Rand::cauchyLike
const CauchyType< Derived, Urng > cauchyLike(Derived &o, Urng &&urng, typename Derived::Scalar a=0, typename Derived::Scalar b=1)
generates reals on the Cauchy distribution.
Definition: Core.h:617
Eigen::Rand::negativeBinomial
const NegativeBinomialType< Derived, Urng > negativeBinomial(Index rows, Index cols, Urng &&urng, typename Derived::Scalar trials=1, double p=0.5)
generates reals on the negative binomial distribution.
Definition: Core.h:1068
Eigen::Rand::binomial
const BinomialType< Derived, Urng > binomial(Index rows, Index cols, Urng &&urng, typename Derived::Scalar trials=1, double p=0.5)
generates reals on the binomial distribution.
Definition: Core.h:1024
Eigen::Rand::studentT
const StudentTType< Derived, Urng > studentT(Index rows, Index cols, Urng &&urng, typename Derived::Scalar n=1)
generates reals on the Student's t distribution with arbirtrary degress of freedom.
Definition: Core.h:336
Eigen::Rand::exponentialLike
const ExponentialType< Derived, Urng > exponentialLike(Derived &o, Urng &&urng, typename Derived::Scalar lambda=1)
generates reals on an exponential distribution with arbitrary scale parameter.
Definition: Core.h:397
Eigen::Rand::exponential
const ExponentialType< Derived, Urng > exponential(Index rows, Index cols, Urng &&urng, typename Derived::Scalar lambda=1)
generates reals on an exponential distribution with arbitrary scale parameter.
Definition: Core.h:378
Eigen::Rand::studentTLike
const StudentTType< Derived, Urng > studentTLike(Derived &o, Urng &&urng, typename Derived::Scalar n=1)
generates reals on the Student's t distribution with arbirtrary degress of freedom.
Definition: Core.h:355
Eigen::Rand::discreteD
const DiscreteDType< Derived, Urng > discreteD(Index rows, Index cols, Urng &&urng, RealIter first, RealIter last)
generates random integers on the interval [0, n), where the probability of each individual integer i ...
Definition: Core.h:812
Eigen::Rand::poissonLike
const PoissonType< Derived, Urng > poissonLike(Derived &o, Urng &&urng, double mean=1)
generates reals on the Poisson distribution.
Definition: Core.h:1000
Eigen::Rand::betaLike
const BetaType< Derived, Urng > betaLike(Derived &o, Urng &&urng, typename Derived::Scalar a=1, typename Derived::Scalar b=1)
generates reals on the beta distribution.
Definition: Core.h:703
Eigen::Rand::normal
const NormalType< Derived, Urng > normal(Index rows, Index cols, Urng &&urng)
generates reals on a standard normal distribution (mean = 0, stdev=1)
Definition: Core.h:207
Eigen::Rand::randBitsLike
const RandBitsType< Derived, Urng > randBitsLike(Derived &o, Urng &&urng)
generates integers with random bits
Definition: Core.h:63
Eigen::Rand::gammaLike
const GammaType< Derived, Urng > gammaLike(Derived &o, Urng &&urng, typename Derived::Scalar alpha=1, typename Derived::Scalar beta=1)
generates reals on a gamma distribution with arbitrary shape and scale parameter.
Definition: Core.h:441
Eigen::Rand::discrete
const DiscreteType< Derived, Urng > discrete(Index rows, Index cols, Urng &&urng, RealIter first, RealIter last)
generates random integers on the interval [0, n), where the probability of each individual integer i ...
Definition: Core.h:897
Eigen::Rand::binomialLike
const BinomialType< Derived, Urng > binomialLike(Derived &o, Urng &&urng, typename Derived::Scalar trials=1, double p=0.5)
generates reals on the binomial distribution.
Definition: Core.h:1044
Eigen::Rand::weibull
const WeibullType< Derived, Urng > weibull(Index rows, Index cols, Urng &&urng, typename Derived::Scalar a=1, typename Derived::Scalar b=1)
generates reals on a Weibull distribution with arbitrary shape and scale parameter.
Definition: Core.h:465
Eigen::Rand::chiSquared
const ChiSquaredType< Derived, Urng > chiSquared(Index rows, Index cols, Urng &&urng, typename Derived::Scalar n=1)
generates reals on the Chi-squared distribution with arbitrary degrees of freedom.
Definition: Core.h:554
Eigen::Rand::beta
const BetaType< Derived, Urng > beta(Index rows, Index cols, Urng &&urng, typename Derived::Scalar a=1, typename Derived::Scalar b=1)
generates reals on the beta distribution.
Definition: Core.h:684
Eigen::Rand::lognormal
const LognormalType< Derived, Urng > lognormal(Index rows, Index cols, Urng &&urng, typename Derived::Scalar mean=0, typename Derived::Scalar stdev=1)
generates reals on a lognormal distribution with arbitrary mean and stdev.
Definition: Core.h:293
Eigen::Rand::extremeValue
const ExtremeValueType< Derived, Urng > extremeValue(Index rows, Index cols, Urng &&urng, typename Derived::Scalar a=0, typename Derived::Scalar b=1)
generates reals on an extreme value distribution (a.k.a Gumbel Type I, log-Weibull,...
Definition: Core.h:510
Eigen::Rand::chiSquaredLike
const ChiSquaredType< Derived, Urng > chiSquaredLike(Derived &o, Urng &&urng, typename Derived::Scalar n=1)
generates reals on the Chi-squared distribution with arbitrary degrees of freedom.
Definition: Core.h:573
Eigen::Rand::extremeValueLike
const ExtremeValueType< Derived, Urng > extremeValueLike(Derived &o, Urng &&urng, typename Derived::Scalar a=0, typename Derived::Scalar b=1)
generates reals on an extreme value distribution (a.k.a Gumbel Type I, log-Weibull,...
Definition: Core.h:531
Eigen::Rand::uniformRealLike
const UniformRealType< Derived, Urng > uniformRealLike(Derived &o, Urng &&urng)
generates reals in a range [0, 1)
Definition: Core.h:185
Eigen::Rand::fisherF
const FisherFType< Derived, Urng > fisherF(Index rows, Index cols, Urng &&urng, typename Derived::Scalar m=1, typename Derived::Scalar n=1)
generates reals on the Fisher's F distribution.
Definition: Core.h:641
Eigen::Rand::balancedLike
const BalancedType< Derived, Urng > balancedLike(const Derived &o, Urng &&urng)
generates reals in a range [-1, 1]
Definition: Core.h:145
Eigen::Rand::discreteLike
const DiscreteType< Derived, Urng > discreteLike(Derived &o, Urng &&urng, RealIter first, RealIter last)
generates random integers on the interval [0, n), where the probability of each individual integer i ...
Definition: Core.h:917
Eigen::Rand::fisherFLike
const FisherFType< Derived, Urng > fisherFLike(Derived &o, Urng &&urng, typename Derived::Scalar m=1, typename Derived::Scalar n=1)
generates reals on the Fisher's F distribution.
Definition: Core.h:661
RandUtils.h
Eigen::Rand::cauchy
const CauchyType< Derived, Urng > cauchy(Index rows, Index cols, Urng &&urng, typename Derived::Scalar a=0, typename Derived::Scalar b=1)
generates reals on the Cauchy distribution.
Definition: Core.h:597
Eigen::Rand::gamma
const GammaType< Derived, Urng > gamma(Index rows, Index cols, Urng &&urng, typename Derived::Scalar alpha=1, typename Derived::Scalar beta=1)
generates reals on a gamma distribution with arbitrary shape and scale parameter.
Definition: Core.h:421
Eigen::Rand::lognormalLike
const LognormalType< Derived, Urng > lognormalLike(Derived &o, Urng &&urng, typename Derived::Scalar mean=0, typename Derived::Scalar stdev=1)
generates reals on a lognormal distribution with arbitrary mean and stdev.
Definition: Core.h:313
Eigen::Rand::weibullLike
const WeibullType< Derived, Urng > weibullLike(Derived &o, Urng &&urng, typename Derived::Scalar a=1, typename Derived::Scalar b=1)
generates reals on a Weibull distribution with arbitrary shape and scale parameter.
Definition: Core.h:485
Eigen::Rand::uniformInt
const UniformIntType< Derived, Urng > uniformInt(Index rows, Index cols, Urng &&urng, typename Derived::Scalar min, typename Derived::Scalar max)
generates integers with a given range [min, max]
Definition: Core.h:86
Eigen::Rand::randBits
const RandBitsType< Derived, Urng > randBits(Index rows, Index cols, Urng &&urng)
generates integers with random bits
Definition: Core.h:45
Eigen::Rand::negativeBinomialLike
const NegativeBinomialType< Derived, Urng > negativeBinomialLike(Derived &o, Urng &&urng, typename Derived::Scalar trials=1, double p=0.5)
generates reals on the negative binomial distribution.
Definition: Core.h:1088
Eigen::Rand::discreteF
const DiscreteFType< Derived, Urng > discreteF(Index rows, Index cols, Urng &&urng, RealIter first, RealIter last)
generates random integers on the interval [0, n), where the probability of each individual integer i ...
Definition: Core.h:727
Eigen::Rand::uniformIntLike
const UniformIntType< Derived, Urng > uniformIntLike(Derived &o, Urng &&urng, typename Derived::Scalar min, typename Derived::Scalar max)
generates integers with a given range [min, max]
Definition: Core.h:105
Eigen::Rand::discreteDLike
const DiscreteDType< Derived, Urng > discreteDLike(Derived &o, Urng &&urng, RealIter first, RealIter last)
generates random integers on the interval [0, n), where the probability of each individual integer i ...
Definition: Core.h:832