[Gsll-devel] small modification to blas2.lisp

Liam Healy lhealy at common-lisp.net
Sat May 17 22:11:45 UTC 2008


Mirko,

Your error is that your function isn't defined in the GSL library;
that is what sb-kernel::undefined-alien-function-error means.  A quick
glance at "fft_complex_radix2_forward" makes me suspicious, as I
believe all GSL functions start with "gsl_" and this doesn't have
that.  Since you're on linux, use the shell script "list" which is
at top level in the GSLL files, thus:
  list | grep -i fft_complex_radix2_forward
  gsl_fft_complex_radix2_forward

In the transition FFA-based arrays, I am incoporating have support for
all GSL array types, including complex.  That, with some valid
examples of how to do FFT might allow for its addition to GSLL.

Liam


On Fri, May 16, 2008 at 8:52 AM, Mirko Vukovic <mirko.vukovic at gmail.com> wrote:
> Hello.
>
> I am trying to use gsl's fft routines and I am having trouble.  Here
> is the sample code where I have defined the interface followed by a
> little driver.
>
> >From my reading of the documentation and the example (see
> http://www.gnu.org/software/gsl/manual/html_node/Radix_002d2-FFT-routines-for-complex-data.html)
> , the fft routine needs the complex vector repackaged as a double
> vector, a stride index, and the size.  That is what I tried to do
> below.
>
> I get the error sb-kernel::undefined-alien-function-error.
> I am using sbcl 1.0.14 on linux.
>
> The code is at the end of the message.
>
> Thanks,
>
> Mirko
>
>
>
> (in-package :gsll)
>
> (defmfun fft-c2f (x stride n)
>  "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))
>  :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))
>  (letm ((dim (length arg))
>         (double* (vector-double-float
>                   ;; repackaging complex as double -- is there a built-in?
>                   (let ((double (make-array (* 2 dim)
>                                             :element-type 'double-float
>                                             :initial-element 0d0)))
>                     (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))))
>                     double))))
>    (fft-c2f double* 1 dim)
>    (data double*)))
> _______________________________________________
> Gsll-devel mailing list
> Gsll-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel
>



More information about the gsll-devel mailing list