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. ;; Basis splines.
;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
(defmobject basis-spline "gsl_bspline" (defmobject basis-spline "gsl_bspline"
((order sizet) (number-of-breakpoints sizet)) ((order sizet) (number-of-breakpoints sizet))
"basis spline" ; FDL "basis spline"
:documentation ; FDL
"Allocate a workspace for computing B-splines. The number of "Allocate a workspace for computing B-splines. The number of
breakpoints is given by number-of-breakpoints. This leads to n = breakpoints is given by number-of-breakpoints. This leads to n =
nbreak + k - 2 basis functions where k = order. Cubic B-splines are nbreak + k - 2 basis functions where k = order. Cubic B-splines are
......
;; Monte Carlo Integration ;; Monte Carlo Integration
;; Liam Healy Sat Feb 3 2007 - 17:42 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -17,10 +17,11 @@ ...@@ -17,10 +17,11 @@
(defmobject monte-carlo-plain (defmobject monte-carlo-plain
"gsl_monte_plain" "gsl_monte_plain"
((dim sizet)) ((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." "Make and initialize a workspace for Monte Carlo integration in dim dimensions."
"init" :initialize-suffix "init"
nil) :initialize-args nil)
(cffi:defcstruct plain-state (cffi:defcstruct plain-state
(dim sizet) (dim sizet)
...@@ -59,12 +60,13 @@ ...@@ -59,12 +60,13 @@
(defmobject monte-carlo-miser (defmobject monte-carlo-miser
"gsl_monte_miser" "gsl_monte_miser"
((dim sizet)) ((dim sizet))
"miser Monte Carlo integration" ; FDL "miser Monte Carlo integration"
:documentation ; FDL
"Make and initialize a workspace for Monte Carlo integration in "Make and initialize a workspace for Monte Carlo integration in
dim dimensions. The workspace is used to maintain dim dimensions. The workspace is used to maintain
the state of the integration." the state of the integration."
"init" :initialize-suffix "init"
nil) :initialize-args nil)
(cffi:defcstruct miser-state (cffi:defcstruct miser-state
(min-calls sizet) (min-calls sizet)
...@@ -133,12 +135,13 @@ ...@@ -133,12 +135,13 @@
(defmobject monte-carlo-vegas (defmobject monte-carlo-vegas
"gsl_monte_vegas" "gsl_monte_vegas"
((dim sizet)) ((dim sizet))
"vegas Monte Carlo integration" ; FDL "vegas Monte Carlo integration"
:documentation ; FDL
"Make and initialize a workspace for Monte Carlo integration in "Make and initialize a workspace for Monte Carlo integration in
dim dimensions. The workspace is used to maintain dim dimensions. The workspace is used to maintain
the state of the integration. Returns a pointer to vegas-state." the state of the integration. Returns a pointer to vegas-state."
"init" :initialize-suffix "init"
nil) :initialize-args nil)
(cffi:defcstruct vegas-state (cffi:defcstruct vegas-state
;; grid ;; grid
......
;; Numerical integration ;; Numerical integration
;; Liam Healy, Wed Jul 5 2006 - 23:14 ;; 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$ ;; $Id$
;;; To do: QAWS, QAWO, QAWF, more tests ;;; To do: QAWS, QAWO, QAWF, more tests
...@@ -40,9 +40,10 @@ ...@@ -40,9 +40,10 @@
(defmobject integration-workspace (defmobject integration-workspace
"gsl_integration_workspace" ((size sizet)) "gsl_integration_workspace" ((size sizet))
"integration workspace" ; FDL "integration workspace"
:documentation ; FDL
"Make a workspace sufficient to hold n double "Make a workspace sufficient to hold n double
precision intervals, their integration results and error estimates.") precision intervals, their integration results and error estimates.")
(cffi:defcenum integrate-method (cffi:defcenum integrate-method
:gauss15 :gauss21 :gauss31 :gauss15 :gauss21 :gauss31
......
;; Chebyshev Approximations ;; Chebyshev Approximations
;; Liam Healy Sat Nov 17 2007 - 20:36 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
(defmobject chebyshev "gsl_cheb" (defmobject chebyshev "gsl_cheb"
((order sizet)) ((order sizet))
"Chebyshev series" ; FDL "Chebyshev series"
:documentation ; FDL
"Make a Chebyshev series of specified order." "Make a Chebyshev series of specified order."
"init" :initialize-suffix "init"
:initialize-args
((function :pointer) (lower-limit :double) (upper-limit :double))) ((function :pointer) (lower-limit :double) (upper-limit :double)))
;;;;**************************************************************************** ;;;;****************************************************************************
......
;; Eigenvectors and eigenvalues ;; Eigenvectors and eigenvalues
;; Liam Healy, Sun May 21 2006 - 19:52 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -17,15 +17,17 @@ ...@@ -17,15 +17,17 @@
(defmobject eigen-symm (defmobject eigen-symm
"gsl_eigen_symm" ((n sizet)) "gsl_eigen_symm" ((n sizet))
"symmetric eigenvalue workspace" ; FDL "symmetric eigenvalue workspace"
:documentation ; FDL
"Make a workspace for computing eigenvalues of "Make a workspace for computing eigenvalues of
n-by-n real symmetric matrices. The size of the workspace n-by-n real symmetric matrices. The size of the workspace
is O(2n).") is O(2n).")
;; V 1.9
(defmobject eigen-nonsymm (defmobject eigen-nonsymm
"gsl_eigen_nonsymm" ((n sizet)) "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 "Make a workspace for computing eigenvalues of
n-by-n real non-symmetric matrices. The size of the workspace n-by-n real non-symmetric matrices. The size of the workspace
is O(2n).") is O(2n).")
...@@ -41,15 +43,17 @@ ...@@ -41,15 +43,17 @@
(defmobject eigen-symmv (defmobject eigen-symmv
"gsl_eigen_symmv" ((n sizet)) "gsl_eigen_symmv" ((n sizet))
"symmetric eigensystem workspace" ; FDL "symmetric eigensystem workspace"
:documentation ; FDL
"Make a workspace for computing eigenvalues and "Make a workspace for computing eigenvalues and
eigenvectors of n-by-n real symmetric matrices. The size of eigenvectors of n-by-n real symmetric matrices. The size of
the workspace is O(4n).") the workspace is O(4n).")
;; V 1.9
(defmobject eigen-nonsymmv (defmobject eigen-nonsymmv
"gsl_eigen_nonsymmv" ((n sizet)) "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 "Make a workspace for computing for computing eigenvalues and
eigenvectors of n-by-n real nonsymmetric matrices. The size of the eigenvectors of n-by-n real nonsymmetric matrices. The size of the
workspace is O(5n).") workspace is O(5n).")
...@@ -57,13 +61,15 @@ ...@@ -57,13 +61,15 @@
(defmobject eigen-herm (defmobject eigen-herm
"gsl_eigen_herm" ((n sizet)) "gsl_eigen_herm" ((n sizet))
"Hermitian eigenvalue workspace" ; FDL "Hermitian eigenvalue workspace" ; FDL
:documentation ; FDL
"Make a workspace for computing eigenvalues of "Make a workspace for computing eigenvalues of
n-by-n complex Hermitian matrices. The size of the workspace n-by-n complex Hermitian matrices. The size of the workspace
is O(3n).") is O(3n).")
(defmobject eigen-hermv (defmobject eigen-hermv
"gsl_eigen_hermv" ((n sizet)) "gsl_eigen_hermv" ((n sizet))
"Hermitian eigensystem workspace" ; FDL "Hermitian eigensystem workspace"
:documentation ; FDL
"Make a workspace for computing eigenvalues and "Make a workspace for computing eigenvalues and
eigenvectors of n-by-n complex hermitian matrices. The size of eigenvectors of n-by-n complex hermitian matrices. The size of
the workspace is O(5n).") the workspace is O(5n).")
......
;; Discrete Hankel Transforms. ;; Discrete Hankel Transforms.
;; Liam Healy, Sat Dec 8 2007 - 16:50 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
(defmobject hankel "gsl_dht" (defmobject hankel "gsl_dht"
((size sizet)) ((size sizet))
"discrete Hankel Transform" "discrete Hankel Transform"
:documentation
"Allocate a Discrete Hankel transform object of the given size and "Allocate a Discrete Hankel transform object of the given size and
optionally initialize the transform for the given values of nu and x." optionally initialize the transform for the given values of nu and x."
"init" :initialize-suffix "init"
((nu :double) (xmax :double))) :initialize-args ((nu :double) (xmax :double)))
(defmfun apply-hankel (hankel array-in array-out) (defmfun apply-hankel (hankel array-in array-out)
"gsl_dht_apply" "gsl_dht_apply"
......
;; The histogram structure ;; The histogram structure
;; Liam Healy, Mon Jan 1 2007 - 11:32 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -14,16 +14,15 @@ ...@@ -14,16 +14,15 @@
"gsl_histogram" "gsl_histogram"
((number-of-bins sizet)) ((number-of-bins sizet))
"one-dimensional histogram, including bin boundaries and bin contents." "one-dimensional histogram, including bin boundaries and bin contents."
NIL :initialize-suffix "set_ranges"
"set_ranges" :initialize-args (((c-pointer ranges) :pointer) ((dim0 ranges) sizet)))
(((c-pointer ranges) :pointer) ((dim0 ranges) sizet)))
(defmobject histogram2d (defmobject histogram2d
"gsl_histogram2d" "gsl_histogram2d"
((number-of-bins-x sizet) (number-of-bins-y sizet)) ((number-of-bins-x sizet) (number-of-bins-y sizet))
"two-dimensional histogram, including bin boundaries and bin contents." "two-dimensional histogram, including bin boundaries and bin contents."
NIL :initialize-suffix "set_ranges"
"set_ranges" :initialize-args
(((c-pointer x-ranges) :pointer) ((dim0 x-ranges) sizet) (((c-pointer x-ranges) :pointer) ((dim0 x-ranges) sizet)
((c-pointer y-ranges) :pointer) ((dim0 y-ranges) sizet))) ((c-pointer y-ranges) :pointer) ((dim0 y-ranges) sizet)))
......
;; Histogram probability distribution. ;; Histogram probability distribution.
;; Liam Healy, Mon Jan 1 2007 - 17:51 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -12,23 +12,25 @@ ...@@ -12,23 +12,25 @@
"gsl_histogram_pdf" "gsl_histogram_pdf"
((number-of-bins sizet)) ((number-of-bins sizet))
"one-dimensional histogram PDF" "one-dimensional histogram PDF"
:documentation
"Optionally initialize the probability distribution pdf with the contents "Optionally initialize the probability distribution pdf with the contents
of the histogram. If any of the bins are negative then an of the histogram. If any of the bins are negative then an
input-domain error is signalled because a probability distribution input-domain error is signalled because a probability distribution
cannot contain negative values." cannot contain negative values."
"init" :initialize-suffix "init"
(((mpointer histogram) :pointer))) :initialize-args (((mpointer histogram) :pointer)))
(defmobject histogram2d-pdf (defmobject histogram2d-pdf
"gsl_histogram2d_pdf" "gsl_histogram2d_pdf"
((number-of-bins-x sizet) (number-of-bins-y sizet)) ((number-of-bins-x sizet) (number-of-bins-y sizet))
"two-dimensional histogram PDF" "two-dimensional histogram PDF"
:documentation
"Optionally initialize the probability distribution pdf with the contents "Optionally initialize the probability distribution pdf with the contents
of the histogram. If any of the bins are negative then an of the histogram. If any of the bins are negative then an
input-domain error is signalled because a probability distribution input-domain error is signalled because a probability distribution
cannot contain negative values." cannot contain negative values."
"init" :initialize-suffix "init"
(((mpointer histogram) :pointer))) :initialize-args (((mpointer histogram) :pointer)))
(export 'sample) (export 'sample)
(defgeneric sample (pdf value) (defgeneric sample (pdf value)
......
;; Helpers that define a single GSL function interface ;; Helpers that define a single GSL function interface
;; Liam Healy 2009-01-07 22:02:20EST defmfun-single.lisp ;; 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: $ ;; $Id: $
(in-package :gsl) (in-package :gsl)
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
qualifier gsl-version &allow-other-keys) qualifier gsl-version &allow-other-keys)
key-args key-args
(declare (ignorable inputs outputs)) ; workaround for compiler errors that don't see it's used (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 `(,definition
,@(when (and name (not (defgeneric-method-p name))) ,@(when (and name (not (defgeneric-method-p name)))
(list name)) (list name))
......
;; Macros to interface GSL functions, including definitions necessary for defmfun. ;; Macros to interface GSL functions, including definitions necessary for defmfun.
;; Liam Healy ;; Liam Healy
;; Time-stamp: <2009-01-06 18:49:56EST interface.lisp> ;; Time-stamp: <2009-01-25 10:30:39EST interface.lisp>
;; $Id$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -143,13 +143,14 @@ ...@@ -143,13 +143,14 @@
(map-name '*gsl-version* "gsl_version") (map-name '*gsl-version* "gsl_version")
(export '*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 "The GSL version currently running is at least the specified
major/minor version." major/minor version."
(let* ((sep-pos (position #\. *gsl-version*)) (or (null major-minor)
(my-major (let* ((sep-pos (position #\. *gsl-version*))
(read-from-string *gsl-version* nil nil :end sep-pos)) (my-major
(my-minor (read-from-string *gsl-version* nil nil :end sep-pos))
(read-from-string *gsl-version* nil nil :start (1+ sep-pos)))) (my-minor
(and (>= my-major major) (read-from-string *gsl-version* nil nil :start (1+ sep-pos))))
(>= my-minor minor)))) (and (>= my-major (first major-minor))
(>= my-minor (second major-minor))))))
;; Definition of GSL objects and ways to use them. ;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21 ;; 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$ ;; $Id$
;;; GSL objects are represented in GSLL as and instance of a 'mobject. ;;; GSL objects are represented in GSLL as and instance of a 'mobject.
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
(defmacro defmobject (defmacro defmobject
(class prefix allocation-args description (class prefix allocation-args description
&optional docstring initialize-suffix initialize-args arglists-function &key documentation initialize-suffix initialize-args arglists-function
inputs) inputs gsl-version)
"Define the class, the allocate, initialize-instance and "Define the class, the allocate, initialize-instance and
reinitialize-instance methods, and the make-* function for the GSL object." reinitialize-instance methods, and the make-* function for the GSL object."
;; If prefix is a list, the first is the actual prefix, and the ;; If prefix is a list, the first is the actual prefix, and the
...@@ -40,82 +40,89 @@ ...@@ -40,82 +40,89 @@
(cl-initialize-args (cl-initialize-args
(variables-used-in-c-arguments initialize-args)) (variables-used-in-c-arguments initialize-args))
(realprefix (if (listp prefix) (first prefix) prefix))) (realprefix (if (listp prefix) (first prefix) prefix)))
`(progn (if (have-at-least-gsl-version gsl-version)
(defclass ,class (mobject) `(progn
() (defclass ,class (mobject)
(:documentation ()
,(format nil "The GSL representation of the ~a." description))) (:documentation
,(format nil "The GSL representation of the ~a." description)))
(defmfun allocate ((object ,class) &key ,@cl-alloc-args)
,(if (listp prefix) (second prefix) (format nil "~a_alloc" prefix)) (defmfun allocate ((object ,class) &key ,@cl-alloc-args)
,allocation-args ,(if (listp prefix) (second prefix) (format nil "~a_alloc" prefix))
,@(if (and (listp prefix) (third prefix)) ,allocation-args
`(:inputs ,(third prefix))) ,@(if (and (listp prefix) (third prefix))
:definition :method `(:inputs ,(third prefix)))
:c-return :pointer :definition :method
:index ,maker) :c-return :pointer
:index ,maker)
(defmethod initialize-instance :after
((object ,class) &key mpointer ,@(union cl-alloc-args cl-initialize-args)) (defmethod initialize-instance :after
,@(let ((not-alloc (set-difference cl-initialize-args cl-alloc-args))) ((object ,class) &key mpointer ,@(union cl-alloc-args cl-initialize-args))
(when not-alloc) ,@(let ((not-alloc (set-difference cl-initialize-args cl-alloc-args)))
`((declare (ignore ,@not-alloc)))) (when not-alloc)
(unless mpointer `((declare (ignore ,@not-alloc))))
(setf mpointer (unless mpointer
(allocate object ,@(symbol-keyword-symbol cl-alloc-args)) (setf mpointer
(slot-value object 'mpointer) mpointer)) (allocate object ,@(symbol-keyword-symbol cl-alloc-args))
(tg:finalize object (slot-value object 'mpointer) mpointer))
(lambda () (tg:finalize object
(cffi:foreign-funcall (lambda ()
,(format nil "~a_free" realprefix) (cffi:foreign-funcall
:pointer mpointer :void)))) ,(format nil "~a_free" realprefix)
:pointer mpointer :void))))
,@(when initialize-suffix
`((defmfun reinitialize-instance
((object ,class) &key ,@cl-initialize-args)
,(format nil "~a_~a" realprefix
(if (listp initialize-suffix)
(first initialize-suffix)
initialize-suffix))
(((mpointer object) :pointer) ,@initialize-args)
:definition :method
:qualifier :after
,@(when (listp initialize-suffix)
`(:c-return ,(second initialize-suffix)))
:return (object)
,@(when inputs `(:inputs ,inputs))
:export nil
:index (reinitialize-instance ,class))))
(export ',maker)
(defun ,maker
,(if arglists
(first arglists)
`(,@cl-alloc-args
,@(when initialize-args
(append
(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)
(let ((object
(make-instance
',class
,@(if arglists
(second arglists)
(symbol-keyword-symbol cl-alloc-args)))))
;; There is an initialization step
,@(when initialize-suffix ,@(when initialize-suffix
(if initialize-args ; with arguments `((defmfun reinitialize-instance
`((when ,settingp ((object ,class) &key ,@cl-initialize-args)
(reinitialize-instance ,(format nil "~a_~a" realprefix
object (if (listp initialize-suffix)
,@(if arglists (first initialize-suffix)
(third arglists) initialize-suffix))
(symbol-keyword-symbol cl-initialize-args))))) (((mpointer object) :pointer) ,@initialize-args)
'((reinitialize-instance object)))) ; without arguments :definition :method
object))))) :qualifier :after
,@(when (listp initialize-suffix)
`(:c-return ,(second initialize-suffix)))
:return (object)
,@(when inputs `(:inputs ,inputs))
:export nil
:index (reinitialize-instance ,class))))
(export ',maker)
(defun ,maker
,(if arglists
(first arglists)
`(,@cl-alloc-args
,@(when initialize-args
(append
(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 documentation)
(let ((object
(make-instance
',class
,@(if arglists
(second arglists)
(symbol-keyword-symbol cl-alloc-args)))))
;; There is an initialization step
,@(when initialize-suffix
(if initialize-args ; with arguments
`((when ,settingp
(reinitialize-instance
object
,@(if arglists
(third arglists)
(symbol-keyword-symbol cl-initialize-args)))))
'((reinitialize-instance object)))) ; without arguments
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) (defun symbol-keyword-symbol (symbol)
(if (listp symbol) (if (listp symbol)
......
;; Interpolation allocation, initialization, and freeing. ;; Interpolation allocation, initialization, and freeing.
;; Liam Healy, Sun Nov 4 2007 - 17:24 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -12,27 +12,33 @@ ...@@ -12,27 +12,33 @@
;;; so they need not be supplied on each call. ;;; so they need not be supplied on each call.
(defmobject interpolation "gsl_interp" (defmobject interpolation "gsl_interp"
((type :pointer) (size sizet)) ((type :pointer) (size sizet))
"interpolation" ; FDL "interpolation"
:documentation ; FDL
"Make an interpolation object of type for size data-points, "Make an interpolation object of type for size data-points,
and optionally initialize the interpolation object interp for the and optionally initialize the interpolation object interp for the
data (xa,ya) where xa and ya are vectors. The interpolation object does not save 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 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 computed from the data. The xa data array is always assumed to be
strictly ordered; the behavior for other arrangements is not defined." 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)) (((c-pointer xa) :pointer) ((c-pointer ya) :pointer) ((dim0 xa) sizet))
:arglists-function
(lambda (set) (lambda (set)
`((type &optional xa-or-size (ya nil ,set)) `((type &optional xa-or-size (ya nil ,set))
(:type type :size (if ,set (dim0 ya) xa-or-size)) (:type type :size (if ,set (dim0 ya) xa-or-size))
(:xa xa-or-size :ya ya)))) (:xa xa-or-size :ya ya))))
(defmobject spline "gsl_spline" (defmobject spline "gsl_spline"
((type :pointer) (size sizet)) ((type :pointer) (size sizet))
"spline" ; FDL "spline"
:documentation ; FDL
"Make an interpolation object of type for size data-points." "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)) (((c-pointer xa) :pointer) ((c-pointer ya) :pointer) ((dim0 xa) sizet))
:arglists-function
(lambda (set) (lambda (set)
`((type &optional xa-or-size (ya nil ,set)) `((type &optional xa-or-size (ya nil ,set))
(:type type :size (if ,set (dim0 ya) xa-or-size)) (:type type :size (if ,set (dim0 ya) xa-or-size))
(:xa xa-or-size :ya ya)))) (:xa xa-or-size :ya ya))))
;; Index lookup and acceleration ;; Index lookup and acceleration
;; Liam Healy, Sun Nov 4 2007 - 18:09 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
(defmobject acceleration "gsl_interp_accel" (defmobject acceleration "gsl_interp_accel"
() ()
"acceleration for interpolation" ; FDL "acceleration for interpolation"
:documentation ; FDL
"Make an accelerator object, which is a "Make an accelerator object, which is a
kind of iterator for interpolation lookups. It tracks the state of kind of iterator for interpolation lookups. It tracks the state of
lookups, thus allowing for application of various acceleration lookups, thus allowing for application of various acceleration
......
;; Adaptive step-size control ;; Adaptive step-size control
;; Liam Healy 2008-02-17 17:30:04EST control.lisp ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)