C complex number usage
Bruce Labitt
bruce.labitt at verizon.net
Sun Jan 6 13:45:02 EST 2008
Thanks, Kent.
It actually did help. Maybe I'll show up to the January PySig and annoy
people there... Do you know if Python (scientific/scipy) is available
for the CELL processor, aka PS3? I've got a massively parallel problem
I need to solve... My initial look at python was favorable - it appears
to be higher level than C.
However, right now I need to do this in C... I'm eventually going to
use the FFTW libraries to help solve my problem. But I'm such a lame C
programmer that this is very painful. So I'm taking baby steps to try
to build up the expertise level to the point that I can write something
useful. :) (And actually solve the original problem...)
Bruce
Kent Johnson wrote:
> Bruce Labitt wrote:
>> Hopefully a simple question. I'm trying to write a C program that
>> uses complex numbers.
>> Hopefully someone can point me in the write direction. TIA.
>
> If you don't have a specific requirement for C, you might consider
> learning Python instead.
> ----> python.org :-)
>
> Python has built-in support for complex numbers and the add-on package
> numpy supports FFT of complex arrays:
> http://numpy.scipy.org/numpydoc/numpy-17.html
>
> Your code would look something like this in Python:
>
> from random import gauss
>
> N = 1024
> mymean = ...
> mystdev = ...
> g = [ complex(gauss(mymean, mystdev), gauss(mymean, mystdev)) for i in
> range(N) ]
>
> HTH,
> Kent
>
More information about the gnhlug-discuss
mailing list