mercredi 6 novembre 2019

Python and C ++ equivalence over Gaussian normalization

What to do Gaussian normalization in C ++ What is the following code equivalence in C++?

In Python:

k = 20

w = np.zeros(k)

x = np.linspace(1,k,k)

w = norm.pdf(x,1,q*k)

Em C++:

default_random_engine generator (x);

normal_distribution distribution (1,(q * k));

for(int i=0; i < this->k ; i++){

            w[i] = distribution(generator);

}

Aucun commentaire:

Enregistrer un commentaire