[Gsll-devel] small modification to blas2.lisp

Mirko Vukovic mirko.vukovic at gmail.com
Sun May 18 00:56:39 UTC 2008


On Sat, May 17, 2008 at 6:11 PM, Liam Healy <lhealy at common-lisp.net> wrote:
> 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
>
Thanks Liam, I will take a look at this on monday.

Mirko


... stuff deleted
>>
>> 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