c++ - Segmentation fault -
This is probably a silly question, but I can not see what I'm doing wrong here. I have a class:
#include & lt; Sys / time.h & gt; # Include & lt; Gsl / gsl_cdf.h & gt; # Include & lt; Gsl / gsl_randist.h & gt; # Include & lt; Semith & gt; #include "randomnumbergenerator.h" class RandomNumberGenerator {gsl_rng * rn; Public: RandomNumberGenerator (); ~ RandomNumberGenerator (); Double uneducated (); Zero Fleet Gossi (Double Road, Double and X, Double and Y); }; Longer current microscosk () {now Straval timeless; Gettimeofday (and now, NULL); Come back now tv_usec; } RandomNumberGenerator :: RandomNumberGenerator () {const gsl_rng_type * T; Gsl_rng_env_setup (); // T = gsl_rng_default; T = GSL_RNG_MT193937; Rn = gsl_rng_alok (t); Gsl_rng_set (rn, currentMicroseconds ()); } Double Random Number Generator :: Benevrett () {GSLRNINIP (RN) back; } Zero RandomNumberGenerator :: bivariateGaussian (Double Road, Double & X, Double & Y) {gsl_ran_bivariate_gaussian (rn, 1.0, 1.0, rho, & amp; x, & y); } RandomNumberGenerator :: ~ RandomNumberGenerator () {gsl_rng_free (rn); }
which I call from here:
Double X; Double wi; RNG. Beverer Gaussian (RO, X, Y);
But I get a partition error on gsl_ran_bivariate_gaussian (rn, 1.0, 1.0, rho, & amp; x, and y);
Any ideas?
Check to see if rn
is actually allocated This is probably the only thing that can cause a cemeting mistake.
I have tested your code on your computer, it is fine as far as they can tell. GSL can be checked, they have a test suit that you can use
Comments
Post a Comment