Skip to content
Snippets Groups Projects
Commit 0ca58836 authored by Liam Healy's avatar Liam Healy
Browse files

Call GSL functions with complex scalars

With improved fsbv:foreign-funcall that does the conversion of values
between Lisp and C, the function foreign-funcall-indirect has been
eliminated in favor of using fsbv:foreign-funcall directly.  Spot
checks on various functions that use complex scalars like #'evaluate
polynomials at a complex point, or set-all on complex marrays, or the
functions in complex.lisp, show that these all work.  Everything
compiles/loads and the usual tests pass in SBCL.
parent 913040d8
No related branches found
No related tags found
No related merge requests found
;; Expand the body of a defmfun
;; Liam Healy 2009-04-13 22:07:13EDT body-expand.lisp
;; Time-stamp: <2009-04-25 23:42:34EDT body-expand.lisp>
;; Time-stamp: <2009-05-02 21:43:36EDT body-expand.lisp>
;; $Id: $
(in-package :gsl)
......@@ -42,33 +42,6 @@
:test 'st-symbol))
finally (return answer)))
(defmacro foreign-funcall-indirect (name-and-options &rest arguments)
"Call the foreign function through FSBV, after setting one more level of indirection."
(let* ((arguments-symbol-type
(loop for (type form) on (butlast arguments) by #'cddr
collect
(list (if (symbolp form)
(make-symbol (string form))
(gensym "FORMARG"))
type)))
(clargs (loop for (nil form) on (butlast arguments) by #'cddr
collect form))
(ptrlist (mapcar
(lambda (st)
(make-st (st-symbol st)
(st-type st)))
arguments-symbol-type)))
;; Here allocate the foreign objects
`(fsbv:with-foreign-objects
,(mapcar (lambda (st cl)
(append (make-st (st-symbol st) `',(st-type st))
(list cl)))
ptrlist
clargs)
(fsbv:foreign-funcall
,name-and-options
,@(append (mappend 'reverse ptrlist) (last arguments))))))
(defun body-expand (name arglist gsl-name c-arguments key-args)
"Expand the body (computational part) of the defmfun."
(with-defmfun-key-args key-args
......@@ -113,7 +86,7 @@
cbinfo callback-dynamic-variables callback-dynamic)
(let ((,(st-symbol creturn-st)
(,(if (some 'identity pbv)
'foreign-funcall-indirect
'fsbv:foreign-funcall
'cffi:foreign-funcall)
,gsl-name
,@(mappend
......
;; Polynomials
;; Liam Healy, Tue Mar 21 2006 - 18:33
;; Time-stamp: <2009-04-29 22:34:47EDT polynomial.lisp>
;; Time-stamp: <2009-04-30 22:57:18EDT polynomial.lisp>
;; $Id$
(in-package :gsl)
......@@ -26,7 +26,6 @@
:documentation ; FDL
"Evaluate the polyonomial with coefficients at the point x.")
;;; These won't work until we can take returned complex (structs).
(defmfun evaluate
((coefficients vector-double-float) (x complex)
&key)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment