Commit cd6a85f8 authored by Liam Healy's avatar Liam Healy

Keyword arguments to defmobject

Change optional arguments to defmobject to keyword arguments, and add
:gsl-version argument that will create the maker function to signal an
error if the installed version of GSL is too old.
parent b134ed94
;; Basis splines.
;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp
;; Time-stamp: <2008-12-26 18:25:41EST basis-splines.lisp>
;; Time-stamp: <2009-01-25 10:11:48EST basis-splines.lisp>
;; $Id$
(in-package :gsl)
......@@ -11,7 +11,8 @@
(defmobject basis-spline "gsl_bspline"
((order sizet) (number-of-breakpoints sizet))
"basis spline" ; FDL
"basis spline"
:documentation ; FDL
"Allocate a workspace for computing B-splines. The number of
breakpoints is given by number-of-breakpoints. This leads to n =
nbreak + k - 2 basis functions where k = order. Cubic B-splines are
......
;; Monte Carlo Integration
;; Liam Healy Sat Feb 3 2007 - 17:42
;; Time-stamp: <2009-01-24 19:32:18EST monte-carlo.lisp>
;; Time-stamp: <2009-01-25 10:21:38EST monte-carlo.lisp>
;; $Id$
(in-package :gsl)
......@@ -17,10 +17,11 @@
(defmobject monte-carlo-plain
"gsl_monte_plain"
((dim sizet))
"plain Monte Carlo integration" ; FDL
"plain Monte Carlo integration"
:documentation ; FDL
"Make and initialize a workspace for Monte Carlo integration in dim dimensions."
"init"
nil)
:initialize-suffix "init"
:initialize-args nil)
(cffi:defcstruct plain-state
(dim sizet)
......@@ -59,12 +60,13 @@
(defmobject monte-carlo-miser
"gsl_monte_miser"
((dim sizet))
"miser Monte Carlo integration" ; FDL
"miser Monte Carlo integration"
:documentation ; FDL
"Make and initialize a workspace for Monte Carlo integration in
dim dimensions. The workspace is used to maintain
the state of the integration."
"init"
nil)
:initialize-suffix "init"
:initialize-args nil)
(cffi:defcstruct miser-state
(min-calls sizet)
......@@ -133,12 +135,13 @@
(defmobject monte-carlo-vegas
"gsl_monte_vegas"
((dim sizet))
"vegas Monte Carlo integration" ; FDL
"vegas Monte Carlo integration"
:documentation ; FDL
"Make and initialize a workspace for Monte Carlo integration in
dim dimensions. The workspace is used to maintain
the state of the integration. Returns a pointer to vegas-state."
"init"
nil)
:initialize-suffix "init"
:initialize-args nil)
(cffi:defcstruct vegas-state
;; grid
......
;; Numerical integration
;; Liam Healy, Wed Jul 5 2006 - 23:14
;; Time-stamp: <2009-01-24 14:48:39EST numerical-integration.lisp>
;; Time-stamp: <2009-01-25 10:16:31EST numerical-integration.lisp>
;; $Id$
;;; To do: QAWS, QAWO, QAWF, more tests
......@@ -40,7 +40,8 @@
(defmobject integration-workspace
"gsl_integration_workspace" ((size sizet))
"integration workspace" ; FDL
"integration workspace"
:documentation ; FDL
"Make a workspace sufficient to hold n double
precision intervals, their integration results and error estimates.")
......
;; Chebyshev Approximations
;; Liam Healy Sat Nov 17 2007 - 20:36
;; Time-stamp: <2009-01-24 12:56:27EST chebyshev.lisp>
;; Time-stamp: <2009-01-25 10:12:45EST chebyshev.lisp>
;; $Id$
(in-package :gsl)
......@@ -13,9 +13,11 @@
(defmobject chebyshev "gsl_cheb"
((order sizet))
"Chebyshev series" ; FDL
"Chebyshev series"
:documentation ; FDL
"Make a Chebyshev series of specified order."
"init"
:initialize-suffix "init"
:initialize-args
((function :pointer) (lower-limit :double) (upper-limit :double)))
;;;;****************************************************************************
......
;; Eigenvectors and eigenvalues
;; Liam Healy, Sun May 21 2006 - 19:52
;; Time-stamp: <2009-01-12 10:22:00EST eigensystems.lisp>
;; Time-stamp: <2009-01-25 10:37:09EST eigensystems.lisp>
;; $Id$
(in-package :gsl)
......@@ -17,15 +17,17 @@
(defmobject eigen-symm
"gsl_eigen_symm" ((n sizet))
"symmetric eigenvalue workspace" ; FDL
"symmetric eigenvalue workspace"
:documentation ; FDL
"Make a workspace for computing eigenvalues of
n-by-n real symmetric matrices. The size of the workspace
is O(2n).")
;; V 1.9
(defmobject eigen-nonsymm
"gsl_eigen_nonsymm" ((n sizet))
"non-symmetric eigenvalue workspace" ; FDL
"non-symmetric eigenvalue workspace"
:gsl-version (1 9)
:documentation ; FDL
"Make a workspace for computing eigenvalues of
n-by-n real non-symmetric matrices. The size of the workspace
is O(2n).")
......@@ -41,15 +43,17 @@
(defmobject eigen-symmv
"gsl_eigen_symmv" ((n sizet))
"symmetric eigensystem workspace" ; FDL
"symmetric eigensystem workspace"
:documentation ; FDL
"Make a workspace for computing eigenvalues and
eigenvectors of n-by-n real symmetric matrices. The size of
the workspace is O(4n).")
;; V 1.9
(defmobject eigen-nonsymmv
"gsl_eigen_nonsymmv" ((n sizet))
"non-symmetric eigenvalue workspace" ; FDL
"non-symmetric eigenvalue workspace"
:gsl-version (1 9)
:documentation ; FDL
"Make a workspace for computing for computing eigenvalues and
eigenvectors of n-by-n real nonsymmetric matrices. The size of the
workspace is O(5n).")
......@@ -57,13 +61,15 @@
(defmobject eigen-herm
"gsl_eigen_herm" ((n sizet))
"Hermitian eigenvalue workspace" ; FDL
:documentation ; FDL
"Make a workspace for computing eigenvalues of
n-by-n complex Hermitian matrices. The size of the workspace
is O(3n).")
(defmobject eigen-hermv
"gsl_eigen_hermv" ((n sizet))
"Hermitian eigensystem workspace" ; FDL
"Hermitian eigensystem workspace"
:documentation ; FDL
"Make a workspace for computing eigenvalues and
eigenvectors of n-by-n complex hermitian matrices. The size of
the workspace is O(5n).")
......
;; Discrete Hankel Transforms.
;; Liam Healy, Sat Dec 8 2007 - 16:50
;; Time-stamp: <2008-12-26 18:46:20EST hankel.lisp>
;; Time-stamp: <2009-01-25 10:00:41EST hankel.lisp>
;; $Id$
(in-package :gsl)
......@@ -14,10 +14,11 @@
(defmobject hankel "gsl_dht"
((size sizet))
"discrete Hankel Transform"
:documentation
"Allocate a Discrete Hankel transform object of the given size and
optionally initialize the transform for the given values of nu and x."
"init"
((nu :double) (xmax :double)))
:initialize-suffix "init"
:initialize-args ((nu :double) (xmax :double)))
(defmfun apply-hankel (hankel array-in array-out)
"gsl_dht_apply"
......
;; The histogram structure
;; Liam Healy, Mon Jan 1 2007 - 11:32
;; Time-stamp: <2009-01-11 22:40:23EST histogram.lisp>
;; Time-stamp: <2009-01-25 10:03:15EST histogram.lisp>
;; $Id$
(in-package :gsl)
......@@ -14,16 +14,15 @@
"gsl_histogram"
((number-of-bins sizet))
"one-dimensional histogram, including bin boundaries and bin contents."
NIL
"set_ranges"
(((c-pointer ranges) :pointer) ((dim0 ranges) sizet)))
:initialize-suffix "set_ranges"
:initialize-args (((c-pointer ranges) :pointer) ((dim0 ranges) sizet)))
(defmobject histogram2d
"gsl_histogram2d"
((number-of-bins-x sizet) (number-of-bins-y sizet))
"two-dimensional histogram, including bin boundaries and bin contents."
NIL
"set_ranges"
:initialize-suffix "set_ranges"
:initialize-args
(((c-pointer x-ranges) :pointer) ((dim0 x-ranges) sizet)
((c-pointer y-ranges) :pointer) ((dim0 y-ranges) sizet)))
......
;; Histogram probability distribution.
;; Liam Healy, Mon Jan 1 2007 - 17:51
;; Time-stamp: <2008-12-26 18:38:41EST probability-distribution.lisp>
;; Time-stamp: <2009-01-25 10:04:23EST probability-distribution.lisp>
;; $Id$
(in-package :gsl)
......@@ -12,23 +12,25 @@
"gsl_histogram_pdf"
((number-of-bins sizet))
"one-dimensional histogram PDF"
:documentation
"Optionally initialize the probability distribution pdf with the contents
of the histogram. If any of the bins are negative then an
input-domain error is signalled because a probability distribution
cannot contain negative values."
"init"
(((mpointer histogram) :pointer)))
:initialize-suffix "init"
:initialize-args (((mpointer histogram) :pointer)))
(defmobject histogram2d-pdf
"gsl_histogram2d_pdf"
((number-of-bins-x sizet) (number-of-bins-y sizet))
"two-dimensional histogram PDF"
:documentation
"Optionally initialize the probability distribution pdf with the contents
of the histogram. If any of the bins are negative then an
input-domain error is signalled because a probability distribution
cannot contain negative values."
"init"
(((mpointer histogram) :pointer)))
:initialize-suffix "init"
:initialize-args (((mpointer histogram) :pointer)))
(export 'sample)
(defgeneric sample (pdf value)
......
;; Helpers that define a single GSL function interface
;; Liam Healy 2009-01-07 22:02:20EST defmfun-single.lisp
;; Time-stamp: <2009-01-15 22:27:56EST defmfun-single.lisp>
;; Time-stamp: <2009-01-25 10:37:13EST defmfun-single.lisp>
;; $Id: $
(in-package :gsl)
......@@ -81,7 +81,7 @@
qualifier gsl-version &allow-other-keys)
key-args
(declare (ignorable inputs outputs)) ; workaround for compiler errors that don't see it's used
(if (or (not gsl-version) (apply 'have-at-least-gsl-version gsl-version))
(if (have-at-least-gsl-version gsl-version)
`(,definition
,@(when (and name (not (defgeneric-method-p name)))
(list name))
......
;; Macros to interface GSL functions, including definitions necessary for defmfun.
;; Liam Healy
;; Time-stamp: <2009-01-06 18:49:56EST interface.lisp>
;; Time-stamp: <2009-01-25 10:30:39EST interface.lisp>
;; $Id$
(in-package :gsl)
......@@ -143,13 +143,14 @@
(map-name '*gsl-version* "gsl_version")
(export '*gsl-version*)
(defun have-at-least-gsl-version (major minor)
(defun have-at-least-gsl-version (major-minor)
"The GSL version currently running is at least the specified
major/minor version."
(or (null major-minor)
(let* ((sep-pos (position #\. *gsl-version*))
(my-major
(read-from-string *gsl-version* nil nil :end sep-pos))
(my-minor
(read-from-string *gsl-version* nil nil :start (1+ sep-pos))))
(and (>= my-major major)
(>= my-minor minor))))
(and (>= my-major (first major-minor))
(>= my-minor (second major-minor))))))
;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21
;; Time-stamp: <2009-01-21 22:38:01EST mobject.lisp>
;; Time-stamp: <2009-01-25 10:35:08EST mobject.lisp>
;; $Id$
;;; GSL objects are represented in GSLL as and instance of a 'mobject.
......@@ -22,8 +22,8 @@
(defmacro defmobject
(class prefix allocation-args description
&optional docstring initialize-suffix initialize-args arglists-function
inputs)
&key documentation initialize-suffix initialize-args arglists-function
inputs gsl-version)
"Define the class, the allocate, initialize-instance and
reinitialize-instance methods, and the make-* function for the GSL object."
;; If prefix is a list, the first is the actual prefix, and the
......@@ -40,6 +40,7 @@
(cl-initialize-args
(variables-used-in-c-arguments initialize-args))
(realprefix (if (listp prefix) (first prefix) prefix)))
(if (have-at-least-gsl-version gsl-version)
`(progn
(defclass ,class (mobject)
()
......@@ -97,8 +98,9 @@
(list '&optional
(list (first cl-initialize-args) nil settingp))
(rest cl-initialize-args)))))
,(format nil "Create the GSL object representing a ~a (class ~a).~@[~&~a~]"
description class docstring)
,(format
nil "Create the GSL object representing a ~a (class ~a).~@[~&~a~]"
description class documentation)
(let ((object
(make-instance
',class
......@@ -115,7 +117,12 @@
(third arglists)
(symbol-keyword-symbol cl-initialize-args)))))
'((reinitialize-instance object)))) ; without arguments
object)))))
object)))
`(defun ,maker (&rest args)
(declare (ignore args))
(error 'obsolete-gsl-version
:name ',class :gsl-name ,realprefix
:gsl-version ',gsl-version)))))
(defun symbol-keyword-symbol (symbol)
(if (listp symbol)
......
;; Interpolation allocation, initialization, and freeing.
;; Liam Healy, Sun Nov 4 2007 - 17:24
;; Time-stamp: <2008-12-26 18:19:19EST interpolation.lisp>
;; Time-stamp: <2009-01-25 10:14:30EST interpolation.lisp>
;; $Id$
(in-package :gsl)
......@@ -12,15 +12,18 @@
;;; so they need not be supplied on each call.
(defmobject interpolation "gsl_interp"
((type :pointer) (size sizet))
"interpolation" ; FDL
"interpolation"
:documentation ; FDL
"Make an interpolation object of type for size data-points,
and optionally initialize the interpolation object interp for the
data (xa,ya) where xa and ya are vectors. The interpolation object does not save
the data arrays xa and ya and only stores the static state
computed from the data. The xa data array is always assumed to be
strictly ordered; the behavior for other arrangements is not defined."
"init"
:initialize-suffix "init"
:initialize-args
(((c-pointer xa) :pointer) ((c-pointer ya) :pointer) ((dim0 xa) sizet))
:arglists-function
(lambda (set)
`((type &optional xa-or-size (ya nil ,set))
(:type type :size (if ,set (dim0 ya) xa-or-size))
......@@ -28,10 +31,13 @@
(defmobject spline "gsl_spline"
((type :pointer) (size sizet))
"spline" ; FDL
"spline"
:documentation ; FDL
"Make an interpolation object of type for size data-points."
"init"
:initialize-suffix "init"
:initialize-args
(((c-pointer xa) :pointer) ((c-pointer ya) :pointer) ((dim0 xa) sizet))
:arglists-function
(lambda (set)
`((type &optional xa-or-size (ya nil ,set))
(:type type :size (if ,set (dim0 ya) xa-or-size))
......
;; Index lookup and acceleration
;; Liam Healy, Sun Nov 4 2007 - 18:09
;; Time-stamp: <2008-12-26 16:41:21EST lookup.lisp>
;; Time-stamp: <2009-01-25 10:14:47EST lookup.lisp>
;; $Id$
(in-package :gsl)
(defmobject acceleration "gsl_interp_accel"
()
"acceleration for interpolation" ; FDL
"acceleration for interpolation"
:documentation ; FDL
"Make an accelerator object, which is a
kind of iterator for interpolation lookups. It tracks the state of
lookups, thus allowing for application of various acceleration
......
;; Adaptive step-size control
;; Liam Healy 2008-02-17 17:30:04EST control.lisp
;; Time-stamp: <2009-01-20 19:39:08EST control.lisp>
;; Time-stamp: <2009-01-25 10:01:56EST control.lisp>
;; $Id$
(in-package :gsl)
#|
(defmobject standard-control ("gsl_odeiv_control_standard" "new")
((absolute-error :double) (relative-error :double)
(y-scaling :double) (dydt-scaling :double))
"standard control for ordinary differential equations"
"")
|#
(defmfun new-standard-control (absolute-error relative-error y-scaling dydt-scaling)
"gsl_odeiv_control_standard_new"
((absolute-error :double) (relative-error :double)
......
;; Evolution functions for ODE integration.
;; Liam Healy, Sun Sep 30 2007 - 14:31
;; Time-stamp: <2009-01-20 22:42:27EST evolution.lisp>
;; Time-stamp: <2009-01-25 10:00:41EST evolution.lisp>
;; $Id$
(in-package :gsl)
......@@ -8,8 +8,10 @@
(defmobject ode-evolution "gsl_odeiv_evolve"
((dimensions sizet))
"evolution for ordinary differential equations"
:documentation
"Make an object to advance the ODE solution."
"reset" nil)
:initialize-suffix "reset"
:initialize-args nil)
(defmfun apply-evolution
(evolve control step dydt time max-time step-size y)
......
;; Stepping functions for ODE systems.
;; Liam Healy, Mon Sep 24 2007 - 21:33
;; Time-stamp: <2009-01-20 19:09:55EST stepping.lisp>
;; Time-stamp: <2009-01-25 10:00:40EST stepping.lisp>
;; $Id$
(in-package :gsl)
......@@ -8,12 +8,14 @@
(defmobject ode-stepper "gsl_odeiv_step"
((type :pointer) (dimensions sizet))
"stepper for ordinary differential equations"
:documentation
"Make a stepper for ordinary differential equations. The type is
one of the GSL-supplied types defined in stepping.lisp, and
dimensions is the number of dependent variables. This instance
should be reinitialized whenever the next use of it will not be a
continuation of a previous step."
"reset" nil)
:initialize-suffix "reset"
:initialize-args nil)
(defmfun name ((object ode-stepper))
"gsl_odeiv_step_name"
......
;; Discrete random variables
;; Liam Healy, Sat Nov 11 2006 - 21:51
;; Time-stamp: <2008-12-29 22:33:10EST discrete.lisp>
;; Time-stamp: <2009-01-25 09:54:54EST discrete.lisp>
;; $Id$
(in-package :gsl)
......@@ -10,7 +10,8 @@
(defmobject discrete-random
("gsl_ran_discrete" "gsl_ran_discrete_preproc" (probabilities))
(((dim0 probabilities) sizet) ((c-pointer probabilities) :pointer))
"lookup table for the discrete random number generator" ; FDL
"lookup table for the discrete random number generator"
:documentation ; FDL
"Make a structure that contains the lookup
table for the discrete random number generator. The array probabilities contains
the probabilities of the discrete events; these array elements must all be
......
;; Generators of random numbers.
;; Liam Healy, Sat Jul 15 2006 - 14:43
;; Time-stamp: <2009-01-11 23:01:36EST generators.lisp>
;; Time-stamp: <2009-01-25 09:57:17EST generators.lisp>
;; $Id$
(in-package :gsl)
......@@ -14,7 +14,8 @@
(defmobject random-number-generator
"gsl_rng"
((rng-type :pointer))
"random number generator" ; FDL
"random number generator"
:documentation ; FDL
"Make and optionally initialize (or `seed') the random number
generator of the specified type. If the generator is seeded with
the same value of s on two different runs, the same stream of
......@@ -25,8 +26,8 @@
For example, the original Fortran source code for the *ranlux*
generator used a seed of 314159265, and so choosing s equal to zero
reproduces this when using *ranlux*."
("set" :void)
((value :ulong)))
:initialize-suffix ("set" :void)
:initialize-args ((value :ulong)))
;;;;****************************************************************************
;;;; Seed
......
;; Quasi-random sequences in arbitrary dimensions.
;; Liam Healy, Sun Jul 16 2006 - 15:54
;; Time-stamp: <2009-01-11 23:02:11EST quasi.lisp>
;; Time-stamp: <2009-01-25 09:57:03EST quasi.lisp>
;; $Id$
(in-package :gsl)
......@@ -10,12 +10,13 @@
(defmobject quasi-random-number-generator
"gsl_qrng"
((rng-type :pointer) (dimension :uint))
"quasi random number generator" ; FDL
"quasi random number generator"
:documentation ; FDL
"Make and optionally initialize the generator q to its starting point.
Note that quasi-random sequences do not use a seed and always produce
the same set of values."
("init" :void)
nil)
:initialize-suffix ("init" :void)
:initialize-args nil)
(defmfun qrng-get (generator return-vector)
"gsl_qrng_get"
......
;; Series acceleration.
;; Liam Healy, Wed Nov 21 2007 - 18:41
;; Time-stamp: <2009-01-21 22:48:11EST series-acceleration.lisp>
;; Time-stamp: <2009-01-25 10:12:17EST series-acceleration.lisp>
;; $Id$
(in-package :gsl)
......@@ -28,7 +28,8 @@
(defmobject levin "gsl_sum_levin_u"
((order sizet))
"Levin u-transform" ; FDL
"Levin u-transform"
:documentation ; FDL
"Make a workspace for a Levin u-transform of n
terms. The size of the workspace is O(2n^2 + 3n).")
......@@ -53,7 +54,8 @@
(defmobject levin-truncated "gsl_sum_levin_utrunc"
((order sizet))
"truncated Levin u-transform" ; FDL
"truncated Levin u-transform"
:documentation ; FDL
"Make a workspace for a Levin u-transform of n
terms, without error estimation. The size of the workspace is
O(3n).")
......
;; Linear least squares, or linear regression
;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp>
;; Time-stamp: <2009-01-24 09:24:25EST linear-least-squares.lisp>
;; Time-stamp: <2009-01-25 10:08:22EST linear-least-squares.lisp>
;; $Id$
(in-package :gsl)
......@@ -135,6 +135,7 @@
"gsl_multifit_linear"
((number-of-observations sizet) (number-of-parameters sizet))
"multi-dimensional root solver with function only"
:documentation
"Make a workspace for a multidimensional linear least-squares fit.")
(defun size-array (array-or-size)
......
;; Multivariate minimization.
;; Liam Healy <Tue Jan 8 2008 - 21:28>
;; Time-stamp: <2009-01-24 16:58:00EST minimization-multi.lisp>
;; Time-stamp: <2009-01-25 10:09:46EST minimization-multi.lisp>
;; $Id$
(in-package :gsl)
......@@ -57,21 +57,23 @@
(defmobject multi-dimensional-minimizer-f
"gsl_multimin_fminimizer"
((type :pointer) (dimension sizet))
"multi-dimensional minimizer with function only" ; FDL
"multi-dimensional minimizer with function only"
:documentation ; FDL
"Make an instance of a minimizer of the given for an function of the
given dimensions. Optionally initialize the minimizer to minimize
the function starting from the initial point. The size of the
initial trial steps is given in vector step-size. The precise
meaning of this parameter depends on the method used."
"set"
;; Could have one fewer argument: dimension=(dim0 initial)
:initialize-suffix "set"
:initialize-args ;; Could have one fewer argument: dimension=(dim0 initial)
((function :pointer) ((mpointer initial) :pointer)
((mpointer step-size) :pointer)))
(defmobject multi-dimensional-minimizer-fdf
"gsl_multimin_fdfminimizer"
((type :pointer) (dimension sizet))
"multi-dimensional minimizer with function and derivative" ; FDL
"multi-dimensional minimizer with function and derivative"
:documentation ; FDL
"Make an instance of a derivative-based minimizer of the given for
an function of the given dimensions. Optionally initialize the
minimizer to minimize the function starting from the initial point.
......@@ -82,7 +84,8 @@
gradient of the function g is orthogonal to the current search
direction p to a relative accuracy of tolerance, where dot(p,g) <
tol |p| |g|."
"set"
:initialize-suffix "set"
:initialize-args
;; Could have one fewer argument: dimension=(dim0 initial)
((function-derivative :pointer) ((mpointer initial) :pointer)
(step-size :double) (tolerance :double)))
......
;; Univariate minimization
;; Liam Healy Tue Jan 8 2008 - 21:02
;; Time-stamp: <2009-01-24 14:46:49EST minimization-one.lisp>
;; Time-stamp: <2009-01-25 10:07:59EST minimization-one.lisp>
;; $Id$
(in-package :gsl)
......@@ -15,11 +15,13 @@
(defmobject one-dimensional-minimizer
"gsl_min_fminimizer"
((type :pointer))
"one-dimensional minimizer" ; FDL
"one-dimensional minimizer"
:documentation ; FDL
"Make an instance of a minimizer of the given type. Optionally
set to use the function and the initial search interval [lower,
upper], with a guess for the location of the minimum."
"set" ; should use set_with_values?
:initialize-suffix "set" ; should use set_with_values?
:initialize-args
((function :pointer) (minimum :double) (lower :double) (upper :double)))
(defmfun set-fminimizer-with-values
......
;; Nonlinear least squares fitting.
;; Liam Healy, 2008-02-09 12:59:16EST nonlinear-least-squares.lisp
;; Time-stamp: <2009-01-24 16:58:11EST nonlinear-least-squares.lisp>
;; Time-stamp: <2009-01-25 10:11:21EST nonlinear-least-squares.lisp>
;; $Id$
(in-package :gsl)
......@@ -16,10 +16,11 @@
(defmobject nonlinear-ffit "gsl_multifit_fsolver"
((solver-type :pointer) (number-of-observations sizet) (number-of-parameters sizet))
"nonlinear least squares fit with function only" ; FDL
"nonlinear least squares fit with function only"
:documentation ; FDL
"The number of observations must be greater than or equal to parameters."
"set"
((function :pointer) ((mpointer initial-guess) :pointer)))
:initialize-suffix "set"
:initialize-args ((function :pointer) ((mpointer initial-guess) :pointer)))
(defmfun name ((solver nonlinear-ffit))
"gsl_multifit_fsolver_name"
......@@ -34,12 +35,14 @@
;;;;****************************************************************************
(defmobject nonlinear-fdffit "gsl_multifit_fdfsolver"
((solver-type :pointer) (number-of-observations sizet) (number-of-parameters sizet))
"nonlinear least squares fit with function and derivative" ; FDL
((solver-type :pointer) (number-of-observations sizet)
(number-of-parameters sizet))
"nonlinear least squares fit with function and derivative"
:documentation ; FDL
"The number of observations must be greater than or
equal to parameters."
"set"
((function :pointer) ((mpointer initial-guess) :pointer)))
:initialize-suffix "set"
:initialize-args ((function :pointer) ((mpointer initial-guess) :pointer)))
(defmfun name ((solver nonlinear-fdffit))
"gsl_multifit_fdfsolver_name"
......
;;; Multivariate roots.
;;; Liam Healy 2008-01-12 12:49:08
;;; Time-stamp: <2009-01-24 20:09:17EST roots-multi.lisp>
;;; Time-stamp: <2009-01-25 10:06:14EST roots-multi.lisp>
;;; $Id$
(in-package :gsl)
......@@ -19,37 +19,42 @@
(defmobject multi-dimensional-root-solver-f "gsl_multiroot_fsolver"
((type :pointer) (dimension sizet))
"multi-dimensional root solver with function only" ; FDL
"multi-dimensional root solver with function only"
:documentation ; FDL
"Make an instance of a solver of the type specified for a system of
the specified number of dimensions. Optionally
set or reset an existing solver to use the function and the
initial guess gsl-vector."
"set"
((function :pointer) ((mpointer initial) :pointer))
:initialize-suffix "set"
:initialize-args ((function :pointer) ((mpointer initial) :pointer))
:arglists-function
(lambda (set)
`((type &optional function-or-dimension (initial nil ,set))
(:type type
:dimension
(if ,set (dim0 initial) function-or-dimension))
(:function function-or-dimension :initial initial)))
(initial))
:inputs (initial))
(defmobject multi-dimensional-root-solver-fdf "gsl_multiroot_fdfsolver"
((type :pointer) (dimension sizet))
"multi-dimensional root solver with function and derivative" ; FDL
"multi-dimensional root solver with function and derivative"
:documentation ; FDL