[Top][All Lists]

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

Re: [Help-gsl] gsl_vector_complex_set with double

From: Alejandro Cámara Iglesias
Subject: Re: [Help-gsl] gsl_vector_complex_set with double
Date: Tue, 24 Feb 2009 19:31:34 +0100
User-agent: KMail/1.11.0 (Linux/2.6.27-11-generic; KDE/4.2.0; i686; ; )

Hi Kevin,

Thanks for you reply! That was pretty much what I was 
looking for :-)

But it seems it doesn't work well. The conversion from 
gsl_vector_complex * to gsl_vector * is done fine. But the 
error handler of GSL just complains about accessing an out-
of-range index. Even if I deactivate it with a 
gsl_set_error_handler_off(), the vector only has half the 
values added.

for( i=0; i<N; i++ )
      gsl_vector_set( (gsl_vector *)x, 2*i, -L/2 + 
i*(L/(N-1)) );

Just in case you wonder if I'm doing something weird with 
the loop. Is there something I'm missing?

Thanks again.

- Alejandro Cámara

Kevin Channon escribió:
> Hi Alejandro,
> > gsl_vector_complex *F = gsl_vector_complex_alloc( 5 );
> > gsl_vector_complex_set_zero( F );
> > gsl_vector_complex_set( F, 0, 2.0 );
> you can set the real part of element i of a complex
> vector to "value" using something like
> gsl_vector_set( (gsl_vector *)F, 2*i, value);
> and the imaginary part in a similar way
> gsl_vector_set( (gsl_vector *)F, 2*i + 1, value);
> Hope that helps!

reply via email to

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