IT++ Logo
random.h
Go to the documentation of this file.
1
29#ifndef RANDOM_H
30#define RANDOM_H
31
33#include <itpp/base/operators.h>
34#include <itpp/itexports.h>
35
36namespace itpp
37{
38
105ITPP_EXPORT void GlobalRNG_reset(unsigned int seed);
106
108ITPP_EXPORT void GlobalRNG_reset();
109
111ITPP_EXPORT unsigned int GlobalRNG_get_local_seed();
112
114ITPP_EXPORT void GlobalRNG_randomize();
115
117ITPP_EXPORT void GlobalRNG_get_state(ivec &state);
118
120ITPP_EXPORT void GlobalRNG_set_state(const ivec &state);
121
123
124
141ITPP_EXPORT void RNG_reset(unsigned int seed);
142
149ITPP_EXPORT void RNG_reset();
150
152ITPP_EXPORT void RNG_randomize();
153
155ITPP_EXPORT void RNG_get_state(ivec &state);
156
158ITPP_EXPORT void RNG_set_state(const ivec &state);
159
161
162
172{
174public:
176 Random_Generator(): _dsfmt(random_details::lc_get()) {
178 _dsfmt.init_gen_rand(GlobalRNG_get_local_seed());
180 }
181 }
182
183 //Constructor using a certain seed - do not want to provide it. Use free-standing functions to change per-thread local seed
184 //Random_Generator(unsigned int seed) { init_gen_rand(seed); random_details::lc_mark_initialized();}
185
186 //provide wrappers for DSFMT algorithm functions
187
188 //Set the seed to a semi-random value (based on hashed time and clock) - do not want to provide it. Use free-standing functions to change per-thread local seed
189 //void randomize(){RNG_randomize();}
190
191 //Reset the generator with the same seed as used last time - do not want to provide it. Use free-standing functions to change per-thread local seed
192 //void reset() {RNG_reset();}
193
194 //Initialise the generator with a new seed (\sa init_gen_rand()) - do not want to provide it. Use free-standing functions to change per-thread local seed
195 //void reset(unsigned int seed) { RNG_reset(seed); }
196
197 //Resume the state of the generator from a previously saved ivec - do not want to provide it. Use free-standing functions to change per-thread local seed
198 //void set_state(const ivec &state) {RNG_set_state(state);}
199
200 //Return current state of generator in the form of ivec - do not want to provide it. Use free-standing functions to change per-thread local seed
201 //ivec get_state() const {ivec ret; RNG_get_state(ret); return ret; }
202
204 double random_01() { return genrand_open_open(); }
206 double random_01_lclosed() { return genrand_close_open(); }
208 double random_01_rclosed() { return genrand_open_close(); }
210 uint32_t random_int() { return genrand_uint32(); }
211
213 uint32_t genrand_uint32() { return _dsfmt.genrand_uint32(); }
214
224 double genrand_close1_open2() { return _dsfmt.genrand_close1_open2(); }
225
234 double genrand_close_open() { return genrand_close1_open2() - 1.0; }
235
244 double genrand_open_close() { return 2.0 - genrand_close1_open2(); }
245
254 double genrand_open_open() { return _dsfmt.genrand_open_open();}
255
256private:
257 DSFMT _dsfmt;
258};
259
265{
266public:
268 Bernoulli_RNG(double prob) { setup(prob); }
270 Bernoulli_RNG() { p = 0.5; }
272 void setup(double prob) {
273 it_assert(prob >= 0.0 && prob <= 1.0, "The Bernoulli source probability "
274 "must be between 0 and 1");
275 p = prob;
276 }
278 double get_setup() const { return p; }
280 bin operator()() { return sample(); }
282 bvec operator()(int n) { bvec temp(n); sample_vector(n, temp); return temp; }
284 bmat operator()(int h, int w) { bmat temp(h, w); sample_matrix(h, w, temp); return temp; }
286 bin sample() { return RNG.genrand_close_open() < p ? bin(1) : bin(0); }
288 void sample_vector(int size, bvec &out) {
289 out.set_size(size, false);
290 for(int i = 0; i < size; i++) out(i) = sample();
291 }
293 void sample_matrix(int rows, int cols, bmat &out) {
294 out.set_size(rows, cols, false);
295 for(int i = 0; i < rows * cols; i++) out(i) = sample();
296 }
297protected:
298private:
300 double p;
303};
304
323{
324public:
326 I_Uniform_RNG(int min = 0, int max = 1);
328 void setup(int min, int max);
330 void get_setup(int &min, int &max) const;
332 int operator()() { return sample(); }
334 ivec operator()(int n);
336 imat operator()(int h, int w);
338 int sample() {
339 return floor_i(RNG.genrand_close_open() * (hi - lo + 1)) + lo;
340 }
341private:
343 int lo;
345 int hi;
348};
349
355{
356public:
358 Uniform_RNG(double min = 0, double max = 1.0);
360 void setup(double min, double max);
362 void get_setup(double &min, double &max) const;
364 double operator()() { return (sample() * (hi_bound - lo_bound) + lo_bound); }
366 vec operator()(int n) {
367 vec temp(n);
368 sample_vector(n, temp);
369 temp *= hi_bound - lo_bound;
370 temp += lo_bound;
371 return temp;
372 }
374 mat operator()(int h, int w) {
375 mat temp(h, w);
376 sample_matrix(h, w, temp);
377 temp *= hi_bound - lo_bound;
378 temp += lo_bound;
379 return temp;
380 }
382 double sample() { return RNG.genrand_close_open(); }
384 void sample_vector(int size, vec &out) {
385 out.set_size(size, false);
386 for(int i = 0; i < size; i++) out(i) = sample();
387 }
389 void sample_matrix(int rows, int cols, mat &out) {
390 out.set_size(rows, cols, false);
391 for(int i = 0; i < rows * cols; i++) out(i) = sample();
392 }
393protected:
394private:
396 double lo_bound, hi_bound;
399};
400
406{
407public:
409 Exponential_RNG(double lambda = 1.0);
411 void setup(double lambda) { l = lambda; }
413 double get_setup() const;
415 double operator()() { return sample(); }
417 vec operator()(int n);
419 mat operator()(int h, int w);
420private:
421 double sample() { return (-std::log(RNG.genrand_open_close()) / l); }
422 double l;
423 Random_Generator RNG;
424};
425
441{
442public:
444 Normal_RNG(double meanval, double variance):
445 mean(meanval), sigma(std::sqrt(variance)) {}
447 Normal_RNG(): mean(0.0), sigma(1.0) {}
449 void setup(double meanval, double variance)
450 { mean = meanval; sigma = std::sqrt(variance); }
452 void get_setup(double &meanval, double &variance) const;
454 double operator()() { return (sigma * sample() + mean); }
456 vec operator()(int n) {
457 vec temp(n);
458 sample_vector(n, temp);
459 temp *= sigma;
460 temp += mean;
461 return temp;
462 }
464 mat operator()(int h, int w) {
465 mat temp(h, w);
466 sample_matrix(h, w, temp);
467 temp *= sigma;
468 temp += mean;
469 return temp;
470 }
472 double sample();
473
475 void sample_vector(int size, vec &out) {
476 out.set_size(size, false);
477 for(int i = 0; i < size; i++) out(i) = sample();
478 }
479
481 void sample_matrix(int rows, int cols, mat &out) {
482 out.set_size(rows, cols, false);
483 for(int i = 0; i < rows * cols; i++) out(i) = sample();
484 }
485private:
486 double mean, sigma;
487 static const double ytab[128];
488 static const unsigned int ktab[128];
489 static const double wtab[128];
490 static const double PARAM_R;
492};
493
511{
512public:
514 Gamma_RNG(double a = 1.0, double b = 1.0): alpha(a), beta(b) {init_state();}
516 void setup(double a, double b) { alpha = a; beta = b; }
518 double operator()() { return sample(); }
520 vec operator()(int n);
522 mat operator()(int r, int c);
524 double sample();
525private:
527 void init_state();
529 double alpha;
531 double beta;
532
534 Normal_RNG NRNG;
535
536 /* State variables - used in Gamma_Rng::sample()*/
537 double _s, _s2, _d, _scale;
538 double _q0, _b, _si, _c;
539};
540
546{
547public:
549 Laplace_RNG(double meanval = 0.0, double variance = 1.0);
551 void setup(double meanval, double variance);
553 void get_setup(double &meanval, double &variance) const;
555 double operator()() { return sample(); }
557 vec operator()(int n);
559 mat operator()(int h, int w);
561 double sample() {
562 double u = RNG.genrand_open_open();
563 double l = sqrt_12var;
564 if(u < 0.5)
565 l *= std::log(2.0 * u);
566 else
567 l *= -std::log(2.0 * (1 - u));
568 return (l + mean);
569 }
570private:
571 double mean, var, sqrt_12var;
573};
574
580{
581public:
583 Complex_Normal_RNG(std::complex<double> mean, double variance):
584 norm_factor(1.0 / std::sqrt(2.0)) {
585 setup(mean, variance);
586 }
588 Complex_Normal_RNG(): m_re(0.0), m_im(0.0), sigma(1.0), norm_factor(1.0 / std::sqrt(2.0)) {}
590 void setup(std::complex<double> mean, double variance) {
591 m_re = mean.real();
592 m_im = mean.imag();
593 sigma = std::sqrt(variance);
594 }
596 void get_setup(std::complex<double> &mean, double &variance) {
597 mean = std::complex<double>(m_re, m_im);
598 variance = sigma * sigma;
599 }
601 std::complex<double> operator()() { return sigma * sample() + std::complex<double>(m_re, m_im); }
603 cvec operator()(int n) {
604 cvec temp(n);
605 sample_vector(n, temp);
606 temp *= sigma;
607 temp += std::complex<double>(m_re, m_im);
608 return temp;
609 }
611 cmat operator()(int h, int w) {
612 cmat temp(h, w);
613 sample_matrix(h, w, temp);
614 temp *= sigma;
615 temp += std::complex<double>(m_re, m_im);
616 return temp;
617 }
619 std::complex<double> sample() {
620 double a = nRNG.sample() * norm_factor;
621 double b = nRNG.sample() * norm_factor;
622 return std::complex<double>(a, b);
623 }
624
626 void sample_vector(int size, cvec &out) {
627 out.set_size(size, false);
628 for(int i = 0; i < size; i++) out(i) = sample();
629 }
630
632 void sample_matrix(int rows, int cols, cmat &out) {
633 out.set_size(rows, cols, false);
634 for(int i = 0; i < rows * cols; i++) out(i) = sample();
635 }
636
639
640private:
641 double m_re;
642 double m_im;
643 double sigma;
644 const double norm_factor;
645 Normal_RNG nRNG;
646};
647
653{
654public:
656 AR1_Normal_RNG(double meanval = 0.0, double variance = 1.0,
657 double rho = 0.0);
659 void setup(double meanval, double variance, double rho);
661 void get_setup(double &meanval, double &variance, double &rho) const;
663 void reset();
665 double operator()() { return sample(); }
667 vec operator()(int n);
669 mat operator()(int h, int w);
670private:
671 double sample() {
672 mem *= r;
673 if(odd) {
674 r1 = m_2pi * RNG.genrand_open_close();
675 r2 = std::sqrt(factr * std::log(RNG.genrand_open_close()));
676 mem += r2 * std::cos(r1);
677 }
678 else {
679 mem += r2 * std::sin(r1);
680 }
681 odd = !odd;
682 return (mem + mean);
683 }
684 double mem, r, factr, mean, var, r1, r2;
685 bool odd;
686 Random_Generator RNG;
687};
688
694
700
706{
707public:
709 Weibull_RNG(double lambda = 1.0, double beta = 1.0);
711 void setup(double lambda, double beta);
713 void get_setup(double &lambda, double &beta) { lambda = l; beta = b; }
715 double operator()() { return sample(); }
717 vec operator()(int n);
719 mat operator()(int h, int w);
720private:
721 double sample() {
722 return (std::pow(-std::log(RNG.genrand_open_close()), 1.0 / b) / l);
723 }
724 double l, b;
725 double mean, var;
726 Random_Generator RNG;
727};
728
734{
735public:
737 Rayleigh_RNG(double sigma = 1.0);
739 void setup(double sigma) { sig = sigma; }
741 double get_setup() { return sig; }
743 double operator()() { return sample(); }
745 vec operator()(int n);
747 mat operator()(int h, int w);
748private:
749 double sample() {
750 double s1 = nRNG.sample();
751 double s2 = nRNG.sample();
752 // s1 and s2 are N(0,1) and independent
753 return (sig * std::sqrt(s1 * s1 + s2 * s2));
754 }
755 double sig;
756 Normal_RNG nRNG;
757};
758
764{
765public:
767 Rice_RNG(double sigma = 1.0, double v = 1.0);
769 void setup(double sigma, double v) { sig = sigma; s = v; }
771 void get_setup(double &sigma, double &v) { sigma = sig; v = s; }
773 double operator()() { return sample(); }
775 vec operator()(int n);
777 mat operator()(int h, int w);
778private:
779 double sample() {
780 double s1 = nRNG.sample() + s;
781 double s2 = nRNG.sample();
782 // s1 and s2 are N(0,1) and independent
783 return (sig * std::sqrt(s1 * s1 + s2 * s2));
784 }
785 double sig, s;
786 Normal_RNG nRNG;
787};
788
791
793inline bin randb(void) { Bernoulli_RNG src; return src.sample(); }
795inline void randb(int size, bvec &out) { Bernoulli_RNG src; src.sample_vector(size, out); }
797inline bvec randb(int size) { bvec temp; randb(size, temp); return temp; }
799inline void randb(int rows, int cols, bmat &out) { Bernoulli_RNG src; src.sample_matrix(rows, cols, out); }
801inline bmat randb(int rows, int cols) { bmat temp; randb(rows, cols, temp); return temp; }
802
804inline double randu(void) { Uniform_RNG src; return src.sample(); }
806inline void randu(int size, vec &out) { Uniform_RNG src; src.sample_vector(size, out); }
808inline vec randu(int size) { vec temp; randu(size, temp); return temp; }
810inline void randu(int rows, int cols, mat &out) { Uniform_RNG src; src.sample_matrix(rows, cols, out); }
812inline mat randu(int rows, int cols) { mat temp; randu(rows, cols, temp); return temp; }
813
815inline int randi(int low, int high) { I_Uniform_RNG src; src.setup(low, high); return src(); }
817inline ivec randi(int size, int low, int high) { I_Uniform_RNG src; src.setup(low, high); return src(size); }
819inline imat randi(int rows, int cols, int low, int high) { I_Uniform_RNG src; src.setup(low, high); return src(rows, cols); }
820
822inline vec randray(int size, double sigma = 1.0) { Rayleigh_RNG src; src.setup(sigma); return src(size); }
823
825inline vec randrice(int size, double sigma = 1.0, double s = 1.0) { Rice_RNG src; src.setup(sigma, s); return src(size); }
826
828inline vec randexp(int size, double lambda = 1.0) { Exponential_RNG src; src.setup(lambda); return src(size); }
829
831inline double randn(void) { Normal_RNG src; return src.sample(); }
833inline void randn(int size, vec &out) { Normal_RNG src; src.sample_vector(size, out); }
835inline vec randn(int size) { vec temp; randn(size, temp); return temp; }
837inline void randn(int rows, int cols, mat &out) { Normal_RNG src; src.sample_matrix(rows, cols, out); }
839inline mat randn(int rows, int cols) { mat temp; randn(rows, cols, temp); return temp; }
840
845inline std::complex<double> randn_c(void) { Complex_Normal_RNG src; return src.sample(); }
847inline void randn_c(int size, cvec &out) { Complex_Normal_RNG src; src.sample_vector(size, out); }
849inline cvec randn_c(int size) { cvec temp; randn_c(size, temp); return temp; }
851inline void randn_c(int rows, int cols, cmat &out) { Complex_Normal_RNG src; src.sample_matrix(rows, cols, out); }
853inline cmat randn_c(int rows, int cols) { cmat temp; randn_c(rows, cols, temp); return temp; }
854
856
857} // namespace itpp
858
859#endif // #ifndef RANDOM_H
Filtered normal distribution.
Definition random.h:653
double operator()()
Get a single random sample.
Definition random.h:665
General array class.
Definition array.h:105
int size() const
Returns the number of data elements in the array object.
Definition array.h:155
T & operator()(int i)
Get the i element.
Definition array.h:290
void set_size(int n, bool copy=false)
Resizing an Array<T>.
Definition array.h:257
Bernoulli distribution.
Definition random.h:265
double get_setup() const
return the probability
Definition random.h:278
bmat operator()(int h, int w)
Get a sample matrix.
Definition random.h:284
Bernoulli_RNG()
Binary source with probability prob for a 1.
Definition random.h:270
bin sample()
Get a sample.
Definition random.h:286
void setup(double prob)
set the probability
Definition random.h:272
void sample_vector(int size, bvec &out)
Get a sample vector.
Definition random.h:288
bvec operator()(int n)
Get a sample vector.
Definition random.h:282
void sample_matrix(int rows, int cols, bmat &out)
Get a sample matrix.
Definition random.h:293
bin operator()()
Get one sample.
Definition random.h:280
Bernoulli_RNG(double prob)
Binary source with probability prob for a 1.
Definition random.h:268
A Complex Normal Source.
Definition random.h:580
void get_setup(std::complex< double > &mean, double &variance)
Get mean and variance.
Definition random.h:596
std::complex< double > sample()
Get a Complex Normal (0,1) distributed sample.
Definition random.h:619
Complex_Normal_RNG(std::complex< double > mean, double variance)
Constructor. Set mean and variance.
Definition random.h:583
std::complex< double > operator()()
Get one sample.
Definition random.h:601
Complex_Normal_RNG & operator=(const Complex_Normal_RNG &)
Dummy assignment operator - MSVC++ warning C4512.
Definition random.h:638
void setup(std::complex< double > mean, double variance)
Set mean and variance.
Definition random.h:590
void sample_vector(int size, cvec &out)
Get a Complex Normal (0,1) distributed vector.
Definition random.h:626
cmat operator()(int h, int w)
Get a sample matrix.
Definition random.h:611
void sample_matrix(int rows, int cols, cmat &out)
Get a Complex Normal (0,1) distributed matrix.
Definition random.h:632
cvec operator()(int n)
Get a sample vector.
Definition random.h:603
Complex_Normal_RNG()
Default constructor.
Definition random.h:588
Exponential distribution.
Definition random.h:406
double operator()()
Get one sample.
Definition random.h:415
double get_setup() const
get lambda
void setup(double lambda)
Set lambda.
Definition random.h:411
Gamma distribution.
Definition random.h:511
double operator()()
Get one sample.
Definition random.h:518
void setup(double a, double b)
Set alpha and beta.
Definition random.h:516
Gamma_RNG(double a=1.0, double b=1.0)
Constructor, which sets alpha (a) and beta (b)
Definition random.h:514
Integer uniform distribution.
Definition random.h:323
int sample()
Return a single value from this random generator.
Definition random.h:338
int operator()()
Get one sample.
Definition random.h:332
Laplacian distribution.
Definition random.h:546
double operator()()
Get one sample.
Definition random.h:555
double sample()
Returns a single sample.
Definition random.h:561
Normal distribution.
Definition random.h:441
void sample_vector(int size, vec &out)
Get a Normal distributed (0,1) vector.
Definition random.h:475
mat operator()(int h, int w)
Get a sample matrix.
Definition random.h:464
void sample_matrix(int rows, int cols, mat &out)
Get a Normal distributed (0,1) matrix.
Definition random.h:481
vec operator()(int n)
Get a sample vector.
Definition random.h:456
double operator()()
Get one sample.
Definition random.h:454
void setup(double meanval, double variance)
Set mean, and variance.
Definition random.h:449
Normal_RNG()
Constructor. Set mean and variance.
Definition random.h:447
Normal_RNG(double meanval, double variance)
Constructor. Set mean and variance.
Definition random.h:444
Base class for random (stochastic) sources.
Definition random.h:172
double genrand_open_open()
Generate uniform (0, 1) double pseudorandom number.
Definition random.h:254
double genrand_close_open()
Generate uniform [0, 1) double pseudorandom number.
Definition random.h:234
double random_01_lclosed()
Return a uniformly distributed [0,1) value.
Definition random.h:206
uint32_t genrand_uint32()
Generate uniform [0, UINT_MAX) integer pseudorandom number.
Definition random.h:213
double genrand_close1_open2()
Generate uniform [1, 2) double pseudorandom number.
Definition random.h:224
double random_01()
Return a uniformly distributed (0,1) value.
Definition random.h:204
uint32_t random_int()
Return a uniformly distributed [0, UINT_MAX) value.
Definition random.h:210
Random_Generator()
Default constructor.
Definition random.h:176
double genrand_open_close()
Generate uniform (0, 1] double pseudorandom number.
Definition random.h:244
double random_01_rclosed()
Return a uniformly distributed (0,1] value.
Definition random.h:208
Rayleigh distribution.
Definition random.h:734
double get_setup()
Get sigma.
Definition random.h:741
double operator()()
Get one sample.
Definition random.h:743
void setup(double sigma)
Set sigma.
Definition random.h:739
Rice distribution.
Definition random.h:764
double operator()()
Get one sample.
Definition random.h:773
void get_setup(double &sigma, double &v)
Get parameters.
Definition random.h:771
void setup(double sigma, double v)
Set sigma, and v (if v = 0, Rice -> Rayleigh).
Definition random.h:769
Uniform distribution.
Definition random.h:355
void sample_vector(int size, vec &out)
Get a Uniformly distributed [0,1) vector.
Definition random.h:384
vec operator()(int n)
Get a sample vector.
Definition random.h:366
double sample()
Get a Uniformly distributed [0,1) sample.
Definition random.h:382
mat operator()(int h, int w)
Get a sample matrix.
Definition random.h:374
void sample_matrix(int rows, int cols, mat &out)
Get a Uniformly distributed [0,1) matrix.
Definition random.h:389
double operator()()
Get one sample.
Definition random.h:364
Weibull distribution.
Definition random.h:706
double operator()()
Get one sample.
Definition random.h:715
void get_setup(double &lambda, double &beta)
Get lambda and beta.
Definition random.h:713
Binary arithmetic (boolean) class.
Definition binary.h:57
C++ implementation of dSFMT random number generator.
#define it_assert(t, s)
Abort if t is not true.
Definition itassert.h:94
int size(const Vec< T > &v)
Length of vector.
Definition matfunc.h:55
T min(const Vec< T > &in)
Minimum value of vector.
Definition min_max.h:125
T max(const Vec< T > &v)
Maximum value of vector.
Definition min_max.h:45
vec sqrt(const vec &x)
Square root of the elements.
Definition elem_math.h:123
void RNG_randomize()
Set a random seed for all Random Number Generators in the current thread.
Definition random.cpp:254
void lc_mark_initialized()
Function to mark thread-local context as initialized.
Definition random.cpp:57
void GlobalRNG_get_state(ivec &state)
Save current full state of global seed provider in memory.
Definition random.cpp:213
Normal_RNG Gauss_RNG
Gauss_RNG is the same as Normal Source.
Definition random.h:693
void RNG_set_state(const ivec &state)
Resume Random Number generation in the current thread with previously stored context.
Definition random.cpp:274
double randu(void)
Generates a random uniform (0,1) number.
Definition random.h:804
vec randexp(int size, double lambda=1.0)
Generates a random complex Gaussian vector.
Definition random.h:828
unsigned int GlobalRNG_get_local_seed()
Get new seed to initialize thread-local generators.
Definition random.cpp:193
vec randray(int size, double sigma=1.0)
Generates a random Rayleigh vector.
Definition random.h:822
std::complex< double > randn_c(void)
Generates a random complex Gaussian (0,1) variable.
Definition random.h:845
void RNG_reset()
Reset the seed to the previously set value for all Random Number Generators in the current thread.
Definition random.cpp:238
vec randrice(int size, double sigma=1.0, double s=1.0)
Generates a random Rice vector (See J.G. Poakis, "Digital Communications, 3rd ed." p....
Definition random.h:825
bin randb(void)
Generates a random bit (equally likely 0s and 1s)
Definition random.h:793
bool lc_is_initialized()
Function to check if thread-local context is initialized.
Definition random.cpp:52
int randi(int low, int high)
Generates a random integer in the interval [low,high].
Definition random.h:815
void GlobalRNG_reset()
Reset the internal seed of the Global Seed Provider to the previously set value.
Definition random.cpp:185
double randn(void)
Generates a random Gaussian (0,1) variable.
Definition random.h:831
void RNG_get_state(ivec &state)
Save Random Number generation context used in the current thread.
Definition random.cpp:262
void GlobalRNG_randomize()
Set a random seed for the Global Seed Provider seed.
Definition random.cpp:204
AR1_Normal_RNG AR1_Gauss_RNG
AR1_Gauss_RNG is the same as AR1_Normal_RNG.
Definition random.h:699
void GlobalRNG_set_state(const ivec &state)
Resume the global seed provider state saved in memory.
Definition random.cpp:222
double variance(const cvec &v)
The variance of the elements in the vector. Normalized with N-1 to be unbiased.
double mean(const vec &v)
The mean value.
Definition misc_stat.cpp:36
Mat< bin > bmat
bin matrix
Definition mat.h:508
itpp namespace
Definition itmex.h:37
const double m_2pi
Constant 2*Pi.
Definition misc.h:106
int floor_i(double x)
The nearest smaller integer.
Definition converters.h:350
STL namespace.
Definitions of operators for vectors and matricies of different types.
C++ implementation of dSFMT random number generator.

Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.8