[Top][All Lists]

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

RE: [Help-gsl] Complex vectors

From: Cory Burkhardt
Subject: RE: [Help-gsl] Complex vectors
Date: Tue, 4 Apr 2006 14:35:33 -0500


Thanks for the pointers.

I am using the gsl_vector_complex_alloc function, but it isn't working as I
expected.  Calling gsl_vector_complex(5) returns a gsl_vector_complex with a
size of 5 and a stride of 1.  This means that the vector has 5 elements and
each element is 1 double in length.  Shouldn't the stride be at least 2 for
a complex vector because each element has two double values?


-----Original Message-----
From: Brian Gough [mailto:address@hidden 
Sent: Monday, April 03, 2006 12:55 PM
To: Cory Burkhardt
Cc: address@hidden
Subject: Re: [Help-gsl] Complex vectors

Cory Burkhardt writes:
 > I am attempting to perform FFT operations on complex vectors.  In the FFT
 > section of the documentation, it makes a comment about using a
 > gsl_complex_vector type, but this type is not described anywhere in the
 > documentation. 


Thanks for your message. That's a typo for gsl_vector_complex --
thanks for bringing it to my attention.

 > In the section on Vectors, the gsl_vector's stride member is
 > described, but nowhere does it describe how to modify the size and stride
 > members.  If I want to create a complex vector with 5 complex numbers,
 > I create a gsl_vector of size 10 and manually modify the stride to be 2?

You could make a vector like that with 

   #include <gsl/gsl_vector_complex.h>
   gsl_vector_complex * v =  gsl_vector_complex_alloc (5);

However, to use the FFTs you don't need a gsl_vector_complex type, you
can just malloc an array of 2*N doubles and pass it directly -- see
the examples in the FFT chapter for details.  

Brian Gough

Network Theory Ltd,
Publishing the GSL Manual -

reply via email to

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