help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] (no subject)


From: Don
Subject: [Help-gsl] (no subject)
Date: Wed, 24 Aug 2011 08:58:16 +0800

        Hello! I am a beginner in C programming and I get a problem with coding
while using gsl_vector_minmax(). It's OK for compiling by GCC 4.6.
However, that will promt "segmentation fault" while executing. In the
GSL handbook, it suggest that the "const gsl_vector" rather than
"gsl_vector", I guess the mistake may cause by this point. However, I
could not construct a "const gsl_vector". In addition, I need some
suggestions on C/C++ programming, can you give me some advices or web
sites? I think I need a BBS which focus on GSL~~ :-)
                
        
        My code is follow:
                
        #include<stdio.h>
        #include<gsl/gsl_rng.h>
        #include<gsl/gsl_randist.h>
        #include<gsl/gsll_vector.h>
                
        int main(void)
        {
                int i;
                double *min, *max;
                gsl_vector *w = gsl_vector_alloc(10);
                const gsl_rng_type *T;
                gsl_rng *r;
        
                gsl_rng_env_setup();
                T = gsl_rng_default;
                r = gsl_rng_alloc(T);
                
                for (i = 0; i < 10; i++)
                        gsl_vector_get(w, i) = gsl_ran_ugaussian(r);
                
                gsl_vector_(w, min, max);
                return 0;
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]