1#ifndef RANDOM_MATRICES_HPP
2#define RANDOM_MATRICES_HPP
19template<
typename RealType =
double>
24 mutable unsigned long long count;
39 template<
typename EigenMatrix>
41 mat = mat.NullaryExpr(mat.rows(), mat.cols(), [&]() {
42 return Complex_t<RealType>(Gaussian(mt), Gaussian(mt));
44 mat = (mat + mat.adjoint().eval()) / 2.0;
45 count += 2 * mat.size();
55 std::cout <<
"GUEgenerator.status()"
57 std::cout <<
"\tMean: " <<
Gaussian.mean() <<
"\n";
58 std::cout <<
"\tStddev: " <<
Gaussian.stddev() <<
"\n";
59 std::cout <<
"\tCount: " << this->count << std::endl;
79 template<
typename EigenMatrix>
80 void discard(EigenMatrix
const& mat,
unsigned long long num) {
81 this->
discard(num * 2 * mat.size());
89template<
typename RealType =
double>
109 template<
typename EigenMatrix>
111 res = res.NullaryExpr(res.rows(), res.cols(), [&]() { return Gaussian(mt); });
112 res = (res + res.transpose().eval()) / 2.0;
123 std::cout <<
"GOEgenerator.status()"
125 std::cout <<
"\tMean: " <<
Gaussian.mean() <<
"\n";
126 std::cout <<
"\tStddev: " <<
Gaussian.stddev() <<
"\n";
127 std::cout <<
"\tCount: " << this->count << std::endl;
147 template<
typename EigenMatrix>
148 void discard(EigenMatrix
const& mat,
unsigned long long num = 1) {
149 this->
discard(num * mat.size());
Generator of matrices in the Gaussian Orthogonal Ensemble (GOE)
Definition RandomMatrices.hpp:90
void discard(EigenMatrix const &mat, unsigned long long num=1)
Discards instances of random matrices to advance internal states of the random number generator.
Definition RandomMatrices.hpp:148
void discard(unsigned long long num)
Discards random numbers to advance internal states of the random number generator.
Definition RandomMatrices.hpp:135
std::mt19937 mt
Definition RandomMatrices.hpp:92
std::normal_distribution< RealType > Gaussian
Definition RandomMatrices.hpp:93
void status(void) const
Show the current status of the generator.
Definition RandomMatrices.hpp:122
unsigned long long count
Definition RandomMatrices.hpp:94
GOEgenerator(int seed=0, RealType stddev=1.0)
Constructor.
Definition RandomMatrices.hpp:102
void operator()(EigenMatrix &res)
Generates an instance of a random matrix.
Definition RandomMatrices.hpp:110
Generator of matrices in the Gaussian Unitary Ensemble (GUE)
Definition RandomMatrices.hpp:20
void discard(unsigned long long num)
Discards random numbers to advance internal states of the random number generator.
Definition RandomMatrices.hpp:67
std::normal_distribution< RealType > Gaussian
Definition RandomMatrices.hpp:23
void operator()(EigenMatrix &mat)
Generates an instance of a random matrix.
Definition RandomMatrices.hpp:40
std::mt19937 mt
Definition RandomMatrices.hpp:22
GUEgenerator(int seed=0, RealType stddev=1.0)
Constructor.
Definition RandomMatrices.hpp:32
unsigned long long count
Definition RandomMatrices.hpp:24
void discard(EigenMatrix const &mat, unsigned long long num)
Discards instances of random matrices to advance internal states of the random number generator.
Definition RandomMatrices.hpp:80
void status(void) const
Show the current status of the generator.
Definition RandomMatrices.hpp:54