help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] message from Don <address@hidden>, (no subject)


From: Владимир Дрынкин
Subject: Re: [Help-gsl] message from Don <address@hidden>, (no subject)
Date: Wed, 24 Aug 2011 23:32:14 +0400

Hello, Don!

I think, that a good books for c and c++ beginners are books of Herbert
Shildt. For example, c++ complete reference. That was my choice when i
studied c and c++.

What about your code? It seems like everything okay, except one moment. I
think, that you forgot to allocate your ponters min and max:
double *min = new double
double *max = new double

Best regards, Vladimir.

      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]