From eb1420b4440a1c581dd527fded786489960ed892 Mon Sep 17 00:00:00 2001 From: Liam Healy <liam@thinkpad.local> Date: Sat, 4 Apr 2009 22:46:57 -0400 Subject: [PATCH] Standardized names of GSL function structs All defcstruct definitions for functions are in the new file init/callback-struct.lisp. They all have standard name format beginning with "fnstruct" and have been consolidated where there were redundant definitions. --- calculus/monte-carlo.lisp | 23 +++----- calculus/numerical-differentiation.lisp | 8 +-- .../numerical-integration-with-tables.lisp | 8 +-- calculus/numerical-integration.lisp | 18 +++--- chebyshev.lisp | 4 +- gsll.asd | 5 +- init/callback-compile-defs.lisp | 4 +- init/callback-struct.lisp | 56 +++++++++++++++++++ init/callback.lisp | 18 ++---- init/interface.lisp | 4 +- solve-minimize-fit/generic.lisp | 35 +----------- solve-minimize-fit/minimization-multi.lisp | 8 +-- solve-minimize-fit/minimization-one.lisp | 4 +- .../nonlinear-least-squares.lisp | 24 +------- solve-minimize-fit/roots-multi.lisp | 6 +- solve-minimize-fit/roots-one.lisp | 6 +- 16 files changed, 109 insertions(+), 122 deletions(-) create mode 100644 init/callback-struct.lisp diff --git a/calculus/monte-carlo.lisp b/calculus/monte-carlo.lisp index 18618d72..853b9bfa 100644 --- a/calculus/monte-carlo.lisp +++ b/calculus/monte-carlo.lisp @@ -1,6 +1,6 @@ ;; Monte Carlo Integration ;; Liam Healy Sat Feb 3 2007 - 17:42 -;; Time-stamp: <2009-04-01 21:25:08EDT monte-carlo.lisp> +;; Time-stamp: <2009-04-04 22:34:29EDT monte-carlo.lisp> ;; $Id$ (in-package :gsl) @@ -10,15 +10,6 @@ ;;; /usr/include/gsl/gsl_monte_miser.h ;;; /usr/include/gsl/gsl_monte_vegas.h -;;;;**************************************************************************** -;;;; Callback definition -;;;;**************************************************************************** - -(cffi:defcstruct monte-function - (function :pointer) - (dimensions sizet) - (parameters :pointer)) - ;;;;**************************************************************************** ;;;; PLAIN Monte Carlo ;;;;**************************************************************************** @@ -28,7 +19,7 @@ ((dim sizet)) "plain Monte Carlo integration" :documentation ; FDL - "Make and initialize a workspace for Monte Carlo integration in dim dimensions." + "Make and initialize a workspace for Monte Carlo integration in dimension dim." :initialize-suffix "init" :initialize-args nil) @@ -56,7 +47,7 @@ (result :double) (abserr :double)) :inputs (lower-limits upper-limits) :callbacks - (callback monte-function (dimensions) + (callback fnstruct-dimension (dimension) (function :double (:input :double :cvector dim0) :slug)) :callback-dynamic (((dim0 lower-limits)) (function scalars)) :documentation ; FDL @@ -85,7 +76,7 @@ "miser Monte Carlo integration" :documentation ; FDL "Make and initialize a workspace for Monte Carlo integration in - dim dimensions. The workspace is used to maintain + dimension dim. The workspace is used to maintain the state of the integration." :initialize-suffix "init" :initialize-args nil) @@ -142,7 +133,7 @@ (result :double) (abserr :double)) :inputs (lower-limits upper-limits) :callbacks - (callback monte-function (dimensions) + (callback fnstruct-dimension (dimension) (function :double (:input :double :cvector dim0) :slug)) :callback-dynamic (((dim0 lower-limits)) (function scalars)) :documentation ; FDL @@ -171,7 +162,7 @@ "vegas Monte Carlo integration" :documentation ; FDL "Make and initialize a workspace for Monte Carlo integration in - dim dimensions. The workspace is used to maintain + dimension dim. The workspace is used to maintain the state of the integration. Returns a pointer to vegas-state." :initialize-suffix "init" :initialize-args nil) @@ -238,7 +229,7 @@ (result :double) (abserr :double)) :inputs (lower-limits upper-limits) :callbacks - (callback monte-function (dimensions) + (callback fnstruct-dimension (dimension) (function :double (:input :double :cvector dim0) :slug)) :callback-dynamic (((dim0 lower-limits)) (function scalars)) :documentation ; FDL diff --git a/calculus/numerical-differentiation.lisp b/calculus/numerical-differentiation.lisp index 84f66eba..60be5847 100644 --- a/calculus/numerical-differentiation.lisp +++ b/calculus/numerical-differentiation.lisp @@ -1,6 +1,6 @@ ;; Numerical differentiation. ;; Liam Healy Mon Nov 12 2007 - 22:07 -;; Time-stamp: <2009-03-31 22:08:34EDT numerical-differentiation.lisp> +;; Time-stamp: <2009-04-04 22:24:31EDT numerical-differentiation.lisp> ;; $Id$ (in-package :gsl) @@ -15,7 +15,7 @@ ((callback :pointer) (x :double) (step :double) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the numerical derivative of the function @@ -38,7 +38,7 @@ ((callback :pointer) (x :double) (step :double) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the numerical derivative of the function @@ -63,7 +63,7 @@ ((callback :pointer) (x :double) (step :double) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the numerical derivative of the function at the point x diff --git a/calculus/numerical-integration-with-tables.lisp b/calculus/numerical-integration-with-tables.lisp index 75584db8..c885afef 100644 --- a/calculus/numerical-integration-with-tables.lisp +++ b/calculus/numerical-integration-with-tables.lisp @@ -1,6 +1,6 @@ ;; Numerical integration techniques that require tables ;; Liam Healy 2009-04-04 15:24:05EDT -;; Time-stamp: <2009-04-04 18:09:47EDT numerical-integration-with-tables.lisp> +;; Time-stamp: <2009-04-04 22:27:18EDT numerical-integration-with-tables.lisp> ;; $Id: $ (in-package :gsl) @@ -50,7 +50,7 @@ (limit sizet) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the integral of the function f(x) over the interval (a,b) @@ -111,7 +111,7 @@ ((mpointer table) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Use an adaptive algorithm to compute the integral of f over (a,b) @@ -155,7 +155,7 @@ ((mpointer table) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "This function attempts to compute a Fourier integral of the diff --git a/calculus/numerical-integration.lisp b/calculus/numerical-integration.lisp index e4ef8981..fa6a7846 100644 --- a/calculus/numerical-integration.lisp +++ b/calculus/numerical-integration.lisp @@ -1,6 +1,6 @@ ;; Numerical integration ;; Liam Healy, Wed Jul 5 2006 - 23:14 -;; Time-stamp: <2009-04-04 21:30:01EDT numerical-integration.lisp> +;; Time-stamp: <2009-04-04 22:25:57EDT numerical-integration.lisp> ;; $Id$ (in-package :gsl) @@ -36,7 +36,7 @@ (absolute-error :double) (relative-error :double) (result :double) (abserr :double) (neval sizet)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Apply the Gauss-Kronrod 10-point, 21-point, 43-point and @@ -80,7 +80,7 @@ (limit sizet) (method integrate-method) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Apply an integration rule adaptively until an estimate @@ -116,7 +116,7 @@ (absolute-error :double) (relative-error :double) (limit sizet) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Apply the Gauss-Kronrod 21-point integration rule @@ -149,7 +149,7 @@ ((mpointer workspace) :pointer) (result :double) (abserr :double)) :inputs (points) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Apply the adaptive integration algorithm QAGS taking @@ -178,7 +178,7 @@ (absolute-error :double) (relative-error :double) (limit sizet) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the integral of the function f over the @@ -202,7 +202,7 @@ (absolute-error :double) (relative-error :double) (limit sizet) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the integral of the function f over the @@ -222,7 +222,7 @@ (absolute-error :double) (relative-error :double) (limit sizet) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the integral of the function f over the @@ -247,7 +247,7 @@ (absolute-error :double) (relative-error :double) (limit sizet) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :callback-dynamic (nil (function)) :documentation ; FDL "Compute the Cauchy principal value of the integral of diff --git a/chebyshev.lisp b/chebyshev.lisp index 7578836d..3eb89691 100644 --- a/chebyshev.lisp +++ b/chebyshev.lisp @@ -1,6 +1,6 @@ ;; Chebyshev Approximations ;; Liam Healy Sat Nov 17 2007 - 20:36 -;; Time-stamp: <2009-03-29 11:44:09EDT chebyshev.lisp> +;; Time-stamp: <2009-04-04 22:27:16EDT chebyshev.lisp> ;; $Id$ (in-package :gsl) @@ -17,7 +17,7 @@ :documentation ; FDL "Make a Chebyshev series of specified order." :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :initialize-suffix "init" :initialize-args ((callback :pointer) (lower-limit :double) (upper-limit :double)) diff --git a/gsll.asd b/gsll.asd index fe69a055..da8432d6 100644 --- a/gsll.asd +++ b/gsll.asd @@ -1,6 +1,6 @@ ;; Definition of GSLL system ;; Liam Healy -;; Time-stamp: <2009-04-04 17:56:17EDT gsll.asd> +;; Time-stamp: <2009-04-04 22:32:18EDT gsll.asd> ;; $Id$ (asdf:defsystem "gsll" @@ -23,8 +23,9 @@ (:file "callback-included" :depends-on (mobject)) (:file "callback" :depends-on (init utility forms number-conversion callback-included)) - (:file "funcallable" :depends-on (utility)) (:file "types" :depends-on (init)) + (:file "callback-struct" :depends-on (types)) + (:file "funcallable" :depends-on (utility)) (:file "complex-types" :depends-on (types)) (:file "element-types" :depends-on (init complex-types)) (:file "interface" diff --git a/init/callback-compile-defs.lisp b/init/callback-compile-defs.lisp index ce6fd631..2f447ae8 100644 --- a/init/callback-compile-defs.lisp +++ b/init/callback-compile-defs.lisp @@ -1,6 +1,6 @@ ;; Definitions for macro expansion ;; Liam Healy 2009-03-15 14:50:28EDT callback-compile-defs.lisp -;; Time-stamp: <2009-04-04 21:40:57EDT callback-compile-defs.lisp> +;; Time-stamp: <2009-04-04 22:44:05EDT callback-compile-defs.lisp> ;; $Id: $ (in-package :gsl) @@ -23,7 +23,7 @@ (let ((cbs (get-callbacks-for-class class))) (unless cbs (error "Class ~a not defined." class)) `(make-cbstruct - ',(parse-callback-static cbs 'callback-structure-type) + ',(parse-callback-static cbs 'callback-fnstruct) (when (dimension-names object) (mappend 'list (dimension-names object) (dimensions object))) ,@(mappend diff --git a/init/callback-struct.lisp b/init/callback-struct.lisp new file mode 100644 index 00000000..30cb1485 --- /dev/null +++ b/init/callback-struct.lisp @@ -0,0 +1,56 @@ +;; GSL structures for holding functions +;; Liam Healy 2009-04-04 22:15:56EDT callback-struct.lisp +;; Time-stamp: <2009-04-04 22:34:29EDT callback-struct.lisp> +;; $Id: $ + +(in-package :gsl) + +;;; Only the function +(cffi:defcstruct fnstruct + "Passing functions to GSL." + ;; see /usr/include/gsl/gsl_math.h + (function :pointer) + (parameters :pointer)) + +;;; The function and its derivative(s) +(cffi:defcstruct fnstruct-fdf + ;; See /usr/include/gsl/gsl_math.h + "The definition of a function and its derivative for root finding in GSL." + (function :pointer) + (df :pointer) + (fdf :pointer) + (parameters :pointer)) + +;;; The function and a dimension +(cffi:defcstruct fnstruct-dimension + ;; See /usr/include/gsl/gsl_multiroots.h + ;; or /usr/include/gsl/gsl_monte.h + (function :pointer) + (dimension sizet) + (parameters :pointer)) + +;;; The function, dimension, and derivatives +(cffi:defcstruct fnstruct-dimension-fdf + ;; See /usr/include/gsl/gsl_multiroots.h + (function :pointer) + (df :pointer) + (fdf :pointer) + (dimension sizet) + (parameters :pointer)) + +;;; The function and two dimensions (for nonlinear fit). +(cffi:defcstruct fnstruct-fit + ;; See gsl_multifit_function in /usr/include/gsl/gsl_multifit_nlin.h + (function :pointer) + (number-of-observations sizet) + (number-of-parameters sizet) + (parameters :pointer)) + +;;; The function, two dimensions, and derivatives (for nonlinear fit) +(cffi:defcstruct fnstruct-fit-fdf + (function :pointer) + (df :pointer) + (fdf :pointer) + (number-of-observations sizet) + (number-of-parameters sizet) + (parameters :pointer)) diff --git a/init/callback.lisp b/init/callback.lisp index 1adc1c0a..7de3a841 100644 --- a/init/callback.lisp +++ b/init/callback.lisp @@ -1,6 +1,6 @@ ;; Foreign callback functions. ;; Liam Healy -;; Time-stamp: <2009-04-04 21:58:32EDT callback.lisp> +;; Time-stamp: <2009-04-04 22:44:06EDT callback.lisp> ;; $Id$ (in-package :gsl) @@ -53,16 +53,6 @@ (set-structure-slot foreign-structure structure-name 'parameters (cffi:null-pointer))) -;;;;**************************************************************************** -;;;; The GSL struct for holding callbacks -;;;;**************************************************************************** - -(cffi:defcstruct gsl-function - "Passing functions to GSL." - ;; see /usr/include/gsl/gsl_math.h - (function :pointer) - (parameters :pointer)) - ;;;;**************************************************************************** ;;;; Definitions for making cbstruct ;;;;**************************************************************************** @@ -88,7 +78,7 @@ ;;;;**************************************************************************** ;;; The :callbacks (cbinfo) argument is a list of the form: -;;; (foreign-argument callback-structure-type dimension-names function ...) +;;; (foreign-argument callback-fnstruct dimension-names function ...) ;;; where each function is of the form ;;; (structure-slot-name ;;; &optional (return-spec 'double-float) (argument-spec 'double-float) @@ -100,7 +90,7 @@ "Get the information component from the callbacks list." (case component (foreign-argument (first cbinfo)) - (callback-structure-type (second cbinfo)) + (callback-fnstruct (second cbinfo)) (dimension-names (third cbinfo)) (functions (nthcdr 3 cbinfo)))) @@ -181,7 +171,7 @@ (when cbinfo `((set-cbstruct ,(parse-callback-static cbinfo 'foreign-argument) - ',(parse-callback-static cbinfo 'callback-structure-type) + ',(parse-callback-static cbinfo 'callback-fnstruct) ,(when (parse-callback-static cbinfo 'dimension-names) (cons 'list (loop diff --git a/init/interface.lisp b/init/interface.lisp index 1a2850c3..47b173b5 100644 --- a/init/interface.lisp +++ b/init/interface.lisp @@ -1,6 +1,6 @@ ;; Macros to interface GSL functions, including definitions necessary for defmfun. ;; Liam Healy -;; Time-stamp: <2009-04-04 21:42:32EDT interface.lisp> +;; Time-stamp: <2009-04-04 22:44:06EDT interface.lisp> ;; $Id$ (in-package :gsl) @@ -65,7 +65,7 @@ `(',(st-eltype d) ,(st-dim d)) (if (eq (st-symbol d) (parse-callback-static cbinfo 'foreign-argument)) - `(',(parse-callback-static cbinfo 'callback-structure-type)) + `(',(parse-callback-static cbinfo 'callback-fnstruct)) `(',(st-type d)))))) ;;;;**************************************************************************** diff --git a/solve-minimize-fit/generic.lisp b/solve-minimize-fit/generic.lisp index f660c773..83c536cb 100644 --- a/solve-minimize-fit/generic.lisp +++ b/solve-minimize-fit/generic.lisp @@ -1,6 +1,6 @@ ;; Generic functions for optimization ;; Liam Healy 2009-01-03 12:59:07EST generic.lisp -;; Time-stamp: <2009-03-21 23:52:17EDT generic.lisp> +;; Time-stamp: <2009-04-04 22:20:38EDT generic.lisp> ;; $Id: $ (in-package :gsl) @@ -26,37 +26,4 @@ (:documentation ; FDL "The last step dx taken by the solver.")) -;;;;**************************************************************************** -;;;; Structures and macros for function definition -;;;;**************************************************************************** - -(cffi:defcstruct gsl-mfunction - ;; See /usr/include/gsl/gsl_multiroots.h - "The definition of a function for multiroot finding in GSL." - (function :pointer) - (dimension sizet) - (parameters :pointer)) - -(cffi:defcstruct gsl-mfunction-fdf - ;; See /usr/include/gsl/gsl_multiroots.h - "The definition of a function and its derivatives for multiroot - finding in GSL." - (function :pointer) - (df :pointer) - (fdf :pointer) - (dimension sizet) - (parameters :pointer)) - -;;;;**************************************************************************** -;;;; Function definition -;;;;**************************************************************************** -;;; Solvers that require the function and its derivative use the -;;; following structure. -(cffi:defcstruct gsl-function-fdf - ;; See /usr/include/gsl/gsl_math.h - "The definition of a function and its derivative for root finding in GSL." - (function :pointer) - (df :pointer) - (fdf :pointer) - (parameters :pointer)) diff --git a/solve-minimize-fit/minimization-multi.lisp b/solve-minimize-fit/minimization-multi.lisp index c7938b81..381711e4 100644 --- a/solve-minimize-fit/minimization-multi.lisp +++ b/solve-minimize-fit/minimization-multi.lisp @@ -1,6 +1,6 @@ ;; Multivariate minimization. ;; Liam Healy <Tue Jan 8 2008 - 21:28> -;; Time-stamp: <2009-03-29 12:43:30EDT minimization-multi.lisp> +;; Time-stamp: <2009-04-04 22:29:11EDT minimization-multi.lisp> ;; $Id$ (in-package :gsl) @@ -14,7 +14,7 @@ ;;; is easy enough to eliminate this, but then mfdfminimizer-gradient ;;; would not be useful to a CL user. -;;; The structures gsl-mfunction and gsl-mfunction-fdf are, from the +;;; The structures fnstruct-dimension and fnstruct-dimension-fdf are, from the ;;; CFFI point of view, equally valid for gsl_multimin_function and ;;; gsl_multimin_function_fdf defined in ;;; /usr/include/gsl/gsl_multimin.h as they are for @@ -38,7 +38,7 @@ initial trial steps is given in vector step-size. The precise meaning of this parameter depends on the method used." :callbacks - (callback gsl-mfunction (dimension) + (callback fnstruct-dimension (dimension) (function :double (:input :double :marray dim0) :slug)) :initialize-suffix "set" :initialize-args ;; Could have one fewer argument: dimension=(dim0 initial) @@ -62,7 +62,7 @@ direction p to a relative accuracy of tolerance, where dot(p,g) < tol |p| |g|." :callbacks - (callback gsl-mfunction-fdf (dimension) + (callback fnstruct-dimension-fdf (dimension) (function :double (:input :double :marray dim0) :slug) (df :void (:input :double :marray dim0) :slug diff --git a/solve-minimize-fit/minimization-one.lisp b/solve-minimize-fit/minimization-one.lisp index b1bd0037..c2d2e59f 100644 --- a/solve-minimize-fit/minimization-one.lisp +++ b/solve-minimize-fit/minimization-one.lisp @@ -1,6 +1,6 @@ ;; Univariate minimization ;; Liam Healy Tue Jan 8 2008 - 21:02 -;; Time-stamp: <2009-03-29 12:13:30EDT minimization-one.lisp> +;; Time-stamp: <2009-04-04 22:27:15EDT minimization-one.lisp> ;; $Id$ (in-package :gsl) @@ -21,7 +21,7 @@ set to use the function and the initial search interval [lower, upper], with a guess for the location of the minimum." :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :initialize-suffix "set" ; should use set_with_values? :initialize-args ((callback :pointer) (minimum :double) (lower :double) (upper :double)) diff --git a/solve-minimize-fit/nonlinear-least-squares.lisp b/solve-minimize-fit/nonlinear-least-squares.lisp index 583dab1c..bec7440c 100644 --- a/solve-minimize-fit/nonlinear-least-squares.lisp +++ b/solve-minimize-fit/nonlinear-least-squares.lisp @@ -1,6 +1,6 @@ ;; Nonlinear least squares fitting. ;; Liam Healy, 2008-02-09 12:59:16EST nonlinear-least-squares.lisp -;; Time-stamp: <2009-03-29 12:42:59EDT nonlinear-least-squares.lisp> +;; Time-stamp: <2009-04-04 22:30:04EDT nonlinear-least-squares.lisp> ;; $Id$ (in-package :gsl) @@ -22,7 +22,7 @@ :documentation ; FDL "The number of observations must be greater than or equal to parameters." :callbacks - (callback gsl-ffit-function + (callback fnstruct-fit (number-of-observations number-of-parameters) (function :success-failure @@ -32,14 +32,6 @@ :initialize-args ((callback :pointer) ((mpointer initial-guess) :pointer)) :singular (function)) -(cffi:defcstruct gsl-ffit-function - "The definition of a function for nonlinear least squares fitting in GSL." - ;; See gsl_multifit_function in /usr/include/gsl/gsl_multifit_nlin.h - (function :pointer) - (number-of-observations sizet) - (number-of-parameters sizet) - (parameters :pointer)) - (defmfun name ((solver nonlinear-ffit)) "gsl_multifit_fsolver_name" (((mpointer solver) :pointer)) @@ -61,7 +53,7 @@ "The number of observations must be greater than or equal to parameters." :callbacks - (callback gsl-fdffit-function + (callback fnstruct-fit-fdf (number-of-observations number-of-parameters) (function :success-failure (:input :double :marray dim1) @@ -91,16 +83,6 @@ (dx :pointer) (state :pointer)) -(cffi:defcstruct gsl-fdffit-function - "The definition of a function and its derivatives for nonlinear - least squares fitting in GSL." - (function :pointer) - (df :pointer) - (fdf :pointer) - (number-of-observations sizet) - (number-of-parameters sizet) - (parameters :pointer)) - (defmfun name ((solver nonlinear-fdffit)) "gsl_multifit_fdfsolver_name" (((mpointer solver) :pointer)) diff --git a/solve-minimize-fit/roots-multi.lisp b/solve-minimize-fit/roots-multi.lisp index c0ab5aa9..79d87a20 100644 --- a/solve-minimize-fit/roots-multi.lisp +++ b/solve-minimize-fit/roots-multi.lisp @@ -1,6 +1,6 @@ ;;; Multivariate roots. ;;; Liam Healy 2008-01-12 12:49:08 -;;; Time-stamp: <2009-03-31 22:51:42EDT roots-multi.lisp> +;;; Time-stamp: <2009-04-04 22:29:12EDT roots-multi.lisp> ;;; $Id$ (in-package :gsl) @@ -29,7 +29,7 @@ :initialize-suffix "set" :initialize-args ((callback :pointer) ((mpointer initial) :pointer)) :callbacks - (callback gsl-mfunction (dimension) + (callback fnstruct-dimension (dimension) (function :success-failure (:input :double :marray dim0) :slug @@ -56,7 +56,7 @@ :initialize-suffix "set" :initialize-args ((callback :pointer) ((mpointer initial) :pointer)) :callbacks - (callback gsl-mfunction-fdf (dimension) + (callback fnstruct-dimension-fdf (dimension) (function :success-failure (:input :double :marray dim0) :slug diff --git a/solve-minimize-fit/roots-one.lisp b/solve-minimize-fit/roots-one.lisp index 21d28ccd..ef5daa34 100644 --- a/solve-minimize-fit/roots-one.lisp +++ b/solve-minimize-fit/roots-one.lisp @@ -1,6 +1,6 @@ ;; One-dimensional root solver. ;; Liam Healy -;; Time-stamp: <2009-03-29 11:50:01EDT roots-one.lisp> +;; Time-stamp: <2009-04-04 22:27:16EDT roots-one.lisp> ;; $Id$ (in-package :gsl) @@ -17,7 +17,7 @@ :initialize-suffix "set" :initialize-args ((callback :pointer) (lower :double) (upper :double)) :callbacks - (callback gsl-function nil (function :double (:input :double) :slug)) + (callback fnstruct nil (function :double (:input :double) :slug)) :singular (function)) (defmobject one-dimensional-root-solver-fdf "gsl_root_fdfsolver" @@ -26,7 +26,7 @@ :initialize-suffix "set" :initialize-args ((callback :pointer) (root-guess :double)) :callbacks - (callback gsl-function-fdf nil + (callback fnstruct-fdf nil (function :double (:input :double) :slug) (df :double (:input :double) :slug) (fdf :void (:input :double) :slug -- GitLab