Open rspadim opened 10 years ago
The fftw_malloc
won't be an issue. It will be used just for creation in
and out
only for block of data (C arrays). It means that if you have standalone object you have to emalloc
it. There is a need for allocating object data anyway though.
What do you mean by "normal" numbers? Like another generic complex numbers API?
I think that we should definitely implement something like fftw_complex and add support for the operations that you mention. +1 on that ;)
"normal" = (int) and (double/float) php types for example the bcmath use string, we will need to cast it, and gmp have a resource?! we need to cast it too, right? i don't know how internally php will execute gmp numbers and if we need to support it
in any case, should be interesting do this without executing foreach() and converting at "php side" the array of numbers
:) about fftw_complex, what you think about the idea of a php complex ext? and use it as the standard php complex lib? php team should like it, but i think it's not a problem :) if they don't like a complex lib we can call it as fftw_complex lib and no more problems =D
the problem here is convert (int/double) array to fftw_complex array and others "convert" functions
i'm thinking we have something like this: 1) complex lib 2) fftw lib 3) auxiliar functions that aren't part of fftw and aren't part of complex lib, but execute functions to make use of fftw and complex faster than executing php code
I'm thinking about that. Still not sure what would be the best way to do that. At the moment I'm inclining to create a new ext complex as it's more standalone project. I'll think about that. Let's leave it open for now and use just arrays.
nice :) about ext-complex, i got some info about perl and pear complex implementation, i think perl implement a natural coding style of complex numbers like "$a= 1234 +2i; $b=1234+2i; $c=$a+b;" the pear lib have many functions already implemented, we could use that math instead of studing new libs
http://perldoc.perl.org/Math/Complex.html <- perl language http://pear.php.net/package/Math_Complex <- pear php functions
today i'm using this guy php fft class to compute some ffts: Michele Andreoli michi.andreoli@gmail.com - http://www.phpclasses.org/package/6193-PHP-Compute-the-Fast-Fourier-Transform-of-sampled-data.html
there's a pear class too http://pear.php.net/manual/pt_BR/package.math.math-complex.php
it's a nice class and work, but it's a php code without align, SIMD, and others optimizations of fftw lib but the interesting part is the Complex.class.php
today php don't have a Complex number api (i'm right?!), it have bcmath, gmp and others "numbers" api, maybe we could start a new php complex api, maybe the php standard complex api
this class have basic add(+) sub(-) mul(*) div(/) abs() sqrt() inverse() scalar() functions/operations, it's a nice start to complex numbers, we should implement rect2polar() polar2rect() fucntions, but it's easy
the point here is: 1)we need a complex api, but fftw use a special fftw_malloc, maybe we need a complex api that work with "normal" numbers, and a api that work with fftw numbers, i don't know what we could do here, implement both or just one
2)if we implement fftw and normal complex numbers, we should have something to convert between fftw to normal, and normal to fftw without many php code 3)another point is "normal" real numbers and fftw_malloc real numbers, should we allow gmp? bcmath? or only "normal" (php) integer/double numbers?