StatMech
Loading...
Searching...
No Matches
GOEgenerator< RealType > Class Template Reference

Generator of matrices in the Gaussian Orthogonal Ensemble (GOE) More...

#include <RandomMatrices.hpp>

Collaboration diagram for GOEgenerator< RealType >:
Collaboration graph

Public Member Functions

 GOEgenerator (int seed=0, RealType stddev=1.0)
 Constructor.
 
template<typename EigenMatrix >
void operator() (EigenMatrix &res)
 Generates an instance of a random matrix.
 
void status (void) const
 Show the current status of the generator.
 
void discard (unsigned long long num)
 Discards random numbers to advance internal states of the random number generator.
 
template<typename EigenMatrix >
void discard (EigenMatrix const &mat, unsigned long long num=1)
 Discards instances of random matrices to advance internal states of the random number generator.
 

Private Attributes

std::mt19937 mt
 
std::normal_distribution< RealType > Gaussian
 
unsigned long long count
 

Detailed Description

template<typename RealType = double>
class GOEgenerator< RealType >

Generator of matrices in the Gaussian Orthogonal Ensemble (GOE)

Template Parameters
RealType: the type of floating-point numbers.

Constructor & Destructor Documentation

◆ GOEgenerator()

template<typename RealType = double>
GOEgenerator< RealType >::GOEgenerator ( int  seed = 0,
RealType  stddev = 1.0 
)
inline

Constructor.

Parameters
seedseed for the random number generator
stddevStandard deviation of diagonal elements
103 : mt(seed), Gaussian{0.0, stddev}, count{0} {};
std::mt19937 mt
Definition RandomMatrices.hpp:92
std::normal_distribution< RealType > Gaussian
Definition RandomMatrices.hpp:93
unsigned long long count
Definition RandomMatrices.hpp:94

Member Function Documentation

◆ discard() [1/2]

template<typename RealType = double>
template<typename EigenMatrix >
void GOEgenerator< RealType >::discard ( EigenMatrix const &  mat,
unsigned long long  num = 1 
)
inline

Discards instances of random matrices to advance internal states of the random number generator.

Parameters
matMatrix the shape of which is the same as random matrices to be discarded
numNumber of random matrices to be discarded
148 {
149 this->discard(num * mat.size());
150 }
void discard(unsigned long long num)
Discards random numbers to advance internal states of the random number generator.
Definition RandomMatrices.hpp:135

◆ discard() [2/2]

template<typename RealType = double>
void GOEgenerator< RealType >::discard ( unsigned long long  num)
inline

Discards random numbers to advance internal states of the random number generator.

Parameters
numNumber of random numbers to be discarded
135 {
136 mt.discard(num);
137 count += num;
138 }

◆ operator()()

template<typename RealType = double>
template<typename EigenMatrix >
void GOEgenerator< RealType >::operator() ( EigenMatrix &  res)
inline

Generates an instance of a random matrix.

Parameters
[out]matMatrix to which the generated matrix is assigned
110 {
111 res = res.NullaryExpr(res.rows(), res.cols(), [&]() { return Gaussian(mt); });
112 res = (res + res.transpose().eval()) / 2.0;
113 count += res.size();
114 }

◆ status()

template<typename RealType = double>
void GOEgenerator< RealType >::status ( void  ) const
inline

Show the current status of the generator.

  • Mean: Mean of each elements
  • Stddev: Standard deviation of diagonal elements
  • Count: Number of random numbers generated by the instance so far
122 {
123 std::cout << "GOEgenerator.status()"
124 << "\n";
125 std::cout << "\tMean: " << Gaussian.mean() << "\n";
126 std::cout << "\tStddev: " << Gaussian.stddev() << "\n";
127 std::cout << "\tCount: " << this->count << std::endl;
128 }

Member Data Documentation

◆ count

template<typename RealType = double>
unsigned long long GOEgenerator< RealType >::count
private

◆ Gaussian

template<typename RealType = double>
std::normal_distribution<RealType> GOEgenerator< RealType >::Gaussian
private

◆ mt

template<typename RealType = double>
std::mt19937 GOEgenerator< RealType >::mt
private

The documentation for this class was generated from the following file: