25template <
typename AFloat_t>
28template<
typename AFloat>
31 if (!fgRandomGen) fgRandomGen =
new TRandom3();
32 fgRandomGen->SetSeed(seed);
34template<
typename AFloat>
37 if (!fgRandomGen) fgRandomGen =
new TRandom3(0);
42template<
typename AFloat>
49 TRandom & rand = GetRandomGenerator();
53 for (
size_t i = 0; i <
m; i++) {
54 for (
size_t j = 0; j <
n; j++) {
61template<
typename AFloat>
68 TRandom & rand = GetRandomGenerator();
70 AFloat range =
sqrt(2.0 / ((AFloat)
n));
72 for (
size_t i = 0; i <
m; i++) {
73 for (
size_t j = 0; j <
n; j++) {
74 A(i,j) = rand.
Uniform(-range, range);
84template<
typename AFloat>
91 TRandom & rand = GetRandomGenerator();
93 AFloat
sigma =
sqrt(2.0 /( ((AFloat)
n) + ((AFloat)
m)) );
95 for (
size_t i = 0; i <
m; i++) {
96 for (
size_t j = 0; j <
n; j++) {
98 if ( std::abs(value) > 2*
sigma)
continue;
109template<
typename AFloat>
116 TRandom & rand = GetRandomGenerator();
118 AFloat range =
sqrt(6.0 /( ((AFloat)
n) + ((AFloat)
m)) );
120 for (
size_t i = 0; i <
m; i++) {
121 for (
size_t j = 0; j <
n; j++) {
122 A(i,j) = rand.
Uniform(-range, range);
128template<
typename AFloat>
135 for (
size_t i = 0; i <
m; i++) {
136 for (
size_t j = 0; j <
n ; j++) {
147template<
typename AFloat>
154 for (
size_t i = 0; i <
m; i++) {
155 for (
size_t j = 0; j <
n ; j++) {
static TRandom * fgRandomGen
static void InitializeUniform(TCpuMatrix< Scalar_t > &A)
static void InitializeGlorotNormal(TCpuMatrix< Scalar_t > &A)
Truncated normal initialization (Glorot, called also Xavier normal) The values are sample with a norm...
static void InitializeIdentity(TCpuMatrix< Scalar_t > &A)
static TRandom & GetRandomGenerator()
static void SetRandomSeed(size_t seed)
static void InitializeZero(TCpuMatrix< Scalar_t > &A)
static void InitializeGauss(TCpuMatrix< Scalar_t > &A)
static void InitializeGlorotUniform(TCpuMatrix< Scalar_t > &A)
Sample from a uniform distribution in range [ -lim,+lim] where lim = sqrt(6/N_in+N_out).
Random number generator class based on M.
This is the base class for the ROOT Random number generators.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Abstract ClassifierFactory template that handles arbitrary types.