Commit 60f252ea authored by liam's avatar liam
Browse files

Fix bug in defun-gsl that caused #'polynomial-solve to not return


git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3275 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent e803849a
;; Macros to interface GSL functions.
;; Liam Healy
;; Time-stamp: <2008-01-19 19:54:09EST interface.lisp>
;; Time-stamp: <2008-01-26 21:33:48EST interface.lisp>
;; $Id: $
(in-package :gsl)
......@@ -185,7 +185,7 @@
(lambda (s) (find s cargs :key #'st-symbol))
(clret (or (substitute cret-name :c-return return)
(clret (or (substitute cret-name :c-return return) ; better as a symbol macro
(mapcan #'cl-convert-form allocated-decl)
(unless (eq c-return :void)
......@@ -251,7 +251,8 @@
(t (unless
(and (eq c-return :error-code)
(not allocated))
(not allocated)
(not return-supplied-p))
(and (null return) return-supplied-p))
,@(when index `((map-name ',(if (eql index t) name index) ,gsl-name)))
......@@ -130,26 +130,19 @@
;;;; General Polynomial Equations
(defun-gsl complex-workspace-alloc (n)
(set-asf complex-workspace allocate-complex-workspace free-complex-workspace)
(defun-gsl allocate-complex-workspace (n)
"gsl_poly_complex_workspace_alloc" ((n :size))
:c-return :pointer
:export nil
:index with-poly-complex-workspace)
:index (with-gsl-object complex-workspace))
(defun-gsl complex-workspace-free (ws)
(defun-gsl free-complex-workspace (ws)
"gsl_poly_complex_workspace_free" ((ws :pointer))
:c-return :void
:export nil
:index with-poly-complex-workspace)
(export '(with-poly-complex-workspace))
(defmacro with-poly-complex-workspace ((workspace size) &body body)
"Macro to create and cleanup workspace for polynomial root solver."
`(let ((,workspace (complex-workspace-alloc ,size)))
(progn ,@body)
(complex-workspace-free ,workspace))))
:index (with-gsl-object complex-workspace))
(defun polynomial-solve (coefficients)
"The roots of the general polynomial
......@@ -164,7 +157,7 @@
(with-data (coef vector-double len)
(setf (data coef) coefficients)
(with-data (answer vector-double ((* 2 (1- len))))
(with-poly-complex-workspace (ws len)
(with-gsl-objects ((complex-workspace ws len))
(values-list (polynomial-solve-ws coef ws answer)))))))
(defun-gsl polynomial-solve-ws (coefficients workspace answer-pd)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment