Apparently, at one time there were CL FFI bindings for the fftw
library, at least according to cl-user.net. However, the link there is
broken, and the Google is not cooperating.
Does anyone know if such a package exists? Did someone maybe download
the file while it did exist?
If not, can anyone recommend an alternative high performance FFT that
I can use in an upcoming project? (The project will be in CL, with
opengl and some kind of widget toolkit, but I don't know which one.
The user will to some grunting and clicking in a window, then some
math will happen, and then an image will appear. Part of the math is
an inverse 2d FFT).
Or.. how hard would it be to make my own ffi bindings? It looks like
it exports about 100 functions, and I don't know how many types.
Thanks for any info,
Neil
On Sun, 27 Jul 2008 16:13:25 -0700, Neil Baylis wrote:
> If not, can anyone recommend an alternative high performance FFT that I
> can use in an upcoming project? (The project will be in CL, with opengl
> and some kind of widget toolkit, but I don't know which one. The user
> will to some grunting and clicking in a window, then some math will
> happen, and then an image will appear. Part of the math is an inverse 2d
> FFT).
GSLL (http://common-lisp.net/project/gsll/) might have it - GSL does, but
I don't know if the links are there. Ask on the GSLL mailing list.
> Or.. how hard would it be to make my own ffi bindings? It looks like it
> exports about 100 functions, and I don't know how many types.
If you have a C library that does FFT, try generating the bindings with
SWIG. Have a look at the FFA package for interfacing Lisp arrays.
Tamas
> SWIG. Have a look at the FFA package for interfacing Lisp arrays.
>
> Tamas
This might be a good moment to point out that FFA package is at this
time semi-broken, as you seem to have split array-operations into
separate system, without making it available. At least I failed to
find it anywhere. I didn't use it recently, so I didn't send a
bugreport, but if you are recommending its use on cll I thought you
might want to know.
Ramarren
On Mon, 28 Jul 2008 10:48:35 -0700, Ramarren wrote:
>> SWIG. Have a look at the FFA package for interfacing Lisp arrays.
>>
>> Tamas
>
> This might be a good moment to point out that FFA package is at this
> time semi-broken, as you seem to have split array-operations into
> separate system, without making it available. At least I failed to find
> it anywhere. I didn't use it recently, so I didn't send a bugreport, but
> if you are recommending its use on cll I thought you might want to know.
Dear Ramarren,
I mistakenly updated the tarball for FFA, without publishing ARRAY-
OPERATIONS. I cleaned it up now and posted it, and wrote a Cliki page
for the latter.
Thanks for the bugreport - next time please drop me an e-mail if you can.
Tamas
On Jul 28, 10:33 am, Tamas K Papp <······@gmail.com> wrote:
> On Sun, 27 Jul 2008 16:13:25 -0700, Neil Baylis wrote:
> > If not, can anyone recommend an alternative high performance FFT that I
> > can use in an upcoming project? (The project will be in CL, with opengl
> > and some kind of widget toolkit, but I don't know which one. The user
> > will to some grunting and clicking in a window, then some math will
> > happen, and then an image will appear. Part of the math is an inverse 2d
> > FFT).
>
> GSLL (http://common-lisp.net/project/gsll/) might have it - GSL does, but
> I don't know if the links are there. Ask on the GSLL mailing list.
>
> > Or.. how hard would it be to make my own ffi bindings? It looks like it
> > exports about 100 functions, and I don't know how many types.
>
> If you have a C library that does FFT, try generating the bindings with
> SWIG. Have a look at the FFA package for interfacing Lisp arrays.
>
> Tamas
I tried to get fft going via GSLL, but got an unhandled memory fault
in SBCL. Here's my attempt:
(in-package :gsll)
(defmfun fft-c2f (x stride n)
"gsl_fft_complex_radix2_forward"
;; for gsl doc and example see
;; http://www.gnu.org/software/gsl/manual/html_node/Radix_002d2-FFT-routines-for-complex-data.html
(((pointer x) gsl-vector-c) (stride :int) (n :int))
:type :function
:c-return :int
:documentation
"Forward FFT for a complex double radix-2 vector")
;; test run
(let ((arg (make-array 4 :element-type 'complex :initial-element
#c(0d0 0d0))))
(setf (aref arg 2) #c(1d0 0d0))
(let* ((dim (length arg))
(double (make-array (* 2 dim)
:element-type 'double-float
:initial-element 0d0)))
;; repackaging complex as double -- is there a built-in?
(loop
for re-im across arg
for i from 0 to (* 2 (1- dim)) by 2
do (progn
(setf (aref double i) (realpart re-im))
(setf (aref double (1+ i)) (imagpart re-im))))
(letm ((double* (vector-double-float double)))
(fft-c2f double* 1 dim))))
If someone can make it work, we all win :-)
Mirko
On Jul 28, 7:33 am, Tamas K Papp <······@gmail.com> wrote:
> On Sun, 27 Jul 2008 16:13:25 -0700, Neil Baylis wrote:
> > If not, can anyone recommend an alternative high performance FFT that I
> > can use in an upcoming project? (The project will be in CL, with opengl
> > and some kind of widget toolkit, but I don't know which one. The user
> > will to some grunting and clicking in a window, then some math will
> > happen, and then an image will appear. Part of the math is an inverse 2d
> > FFT).
>
> GSLL (http://common-lisp.net/project/gsll/) might have it - GSL does, but
> I don't know if the links are there. Ask on the GSLL mailing list.
>
> > Or.. how hard would it be to make my own ffi bindings? It looks like it
> > exports about 100 functions, and I don't know how many types.
>
> If you have a C library that does FFT, try generating the bindings with
> SWIG. Have a look at the FFA package for interfacing Lisp arrays.
>
> Tamas
OK, thanks. I do have a c library: fftw. I'll look in to the SWIG
idea, as well as GSLL.
Neil
Neil Baylis wrote:
> Apparently, at one time there were CL FFI bindings for the fftw
> library, at least according to cl-user.net. However, the link there is
> broken, and the Google is not cooperating.
Did you know that FFTW is written primarily in OCaml? :-)
> Does anyone know if such a package exists?
You should be able to write bindings to FFTW from Common Lisp fairly easily.
> If not, can anyone recommend an alternative high performance FFT that
> I can use in an upcoming project?
I strongly recommend using FFTW because it is much much better than anything
else out there. The only arguable exception is Intel's vendor tuned FFT
that is just as fast but commercial.
> Or.. how hard would it be to make my own ffi bindings? It looks like
> it exports about 100 functions, and I don't know how many types.
We described basic FFTW bindings from F# (not Common Lisp) in the F#.NET
Journal article "Numerical Libraries: linear algebra and spectral methods".
You only need half a dozen functions with simple signatures and no custom
types at all:
fftw_malloc
fftw_free
fftw_plan_dft_2d
fftw_destroy_plan
fftw_execute
The type of a "plan" can be "void *" because it is never used directly from
the host language (e.g. Common Lisp).
Good luck!
--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
On Jul 30, 7:51 am, Jon Harrop <····@ffconsultancy.com> wrote:
> Neil Baylis wrote:
> > Apparently, at one time there were CL FFI bindings for the fftw
> > library, at least according to cl-user.net. However, the link there is
> > broken, and the Google is not cooperating.
>
> Did you know that FFTW is written primarily in OCaml? :-)
>
> > Does anyone know if such a package exists?
>
> You should be able to write bindings to FFTW from Common Lisp fairly easily.
>
> > If not, can anyone recommend an alternative high performance FFT that
> > I can use in an upcoming project?
>
> I strongly recommend using FFTW because it is much much better than anything
> else out there. The only arguable exception is Intel's vendor tuned FFT
> that is just as fast but commercial.
>
> > Or.. how hard would it be to make my own ffi bindings? It looks like
> > it exports about 100 functions, and I don't know how many types.
>
> We described basic FFTW bindings from F# (not Common Lisp) in the F#.NET
> Journal article "Numerical Libraries: linear algebra and spectral methods".
>
> You only need half a dozen functions with simple signatures and no custom
> types at all:
>
> fftw_malloc
> fftw_free
> fftw_plan_dft_2d
> fftw_destroy_plan
> fftw_execute
>
> The type of a "plan" can be "void *" because it is never used directly from
> the host language (e.g. Common Lisp).
>
> Good luck!
>
> --
> Dr Jon D Harrop, Flying Frog Consultancyhttp://www.ffconsultancy.com/products/?u
That's encouraging. Thanks very much!
Neil