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

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
No related branches found
No related tags found
No related merge requests found
Showing
with 207 additions and 160 deletions
;; 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)
#|
(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) (defmfun new-standard-control (absolute-error relative-error y-scaling dydt-scaling)
"gsl_odeiv_control_standard_new" "gsl_odeiv_control_standard_new"
((absolute-error :double) (relative-error :double) ((absolute-error :double) (relative-error :double)
......
;; Evolution functions for ODE integration. ;; Evolution functions for ODE integration.
;; Liam Healy, Sun Sep 30 2007 - 14:31 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
(defmobject ode-evolution "gsl_odeiv_evolve" (defmobject ode-evolution "gsl_odeiv_evolve"
((dimensions sizet)) ((dimensions sizet))
"evolution for ordinary differential equations" "evolution for ordinary differential equations"
:documentation
"Make an object to advance the ODE solution." "Make an object to advance the ODE solution."
"reset" nil) :initialize-suffix "reset"
:initialize-args nil)
(defmfun apply-evolution (defmfun apply-evolution
(evolve control step dydt time max-time step-size y) (evolve control step dydt time max-time step-size y)
......
;; Stepping functions for ODE systems. ;; Stepping functions for ODE systems.
;; Liam Healy, Mon Sep 24 2007 - 21:33 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -8,12 +8,14 @@ ...@@ -8,12 +8,14 @@
(defmobject ode-stepper "gsl_odeiv_step" (defmobject ode-stepper "gsl_odeiv_step"
((type :pointer) (dimensions sizet)) ((type :pointer) (dimensions sizet))
"stepper for ordinary differential equations" "stepper for ordinary differential equations"
:documentation
"Make a stepper for ordinary differential equations. The type is "Make a stepper for ordinary differential equations. The type is
one of the GSL-supplied types defined in stepping.lisp, and one of the GSL-supplied types defined in stepping.lisp, and
dimensions is the number of dependent variables. This instance dimensions is the number of dependent variables. This instance
should be reinitialized whenever the next use of it will not be a should be reinitialized whenever the next use of it will not be a
continuation of a previous step." continuation of a previous step."
"reset" nil) :initialize-suffix "reset"
:initialize-args nil)
(defmfun name ((object ode-stepper)) (defmfun name ((object ode-stepper))
"gsl_odeiv_step_name" "gsl_odeiv_step_name"
......
;; Discrete random variables ;; Discrete random variables
;; Liam Healy, Sat Nov 11 2006 - 21:51 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
(defmobject discrete-random (defmobject discrete-random
("gsl_ran_discrete" "gsl_ran_discrete_preproc" (probabilities)) ("gsl_ran_discrete" "gsl_ran_discrete_preproc" (probabilities))
(((dim0 probabilities) sizet) ((c-pointer probabilities) :pointer)) (((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 "Make a structure that contains the lookup
table for the discrete random number generator. The array probabilities contains table for the discrete random number generator. The array probabilities contains
the probabilities of the discrete events; these array elements must all be the probabilities of the discrete events; these array elements must all be
......
;; Generators of random numbers. ;; Generators of random numbers.
;; Liam Healy, Sat Jul 15 2006 - 14:43 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
(defmobject random-number-generator (defmobject random-number-generator
"gsl_rng" "gsl_rng"
((rng-type :pointer)) ((rng-type :pointer))
"random number generator" ; FDL "random number generator"
:documentation ; FDL
"Make and optionally initialize (or `seed') the random number "Make and optionally initialize (or `seed') the random number
generator of the specified type. If the generator is seeded with generator of the specified type. If the generator is seeded with
the same value of s on two different runs, the same stream of the same value of s on two different runs, the same stream of
...@@ -25,8 +26,8 @@ ...@@ -25,8 +26,8 @@
For example, the original Fortran source code for the *ranlux* For example, the original Fortran source code for the *ranlux*
generator used a seed of 314159265, and so choosing s equal to zero generator used a seed of 314159265, and so choosing s equal to zero
reproduces this when using *ranlux*." reproduces this when using *ranlux*."
("set" :void) :initialize-suffix ("set" :void)
((value :ulong))) :initialize-args ((value :ulong)))
;;;;**************************************************************************** ;;;;****************************************************************************
;;;; Seed ;;;; Seed
......
;; Quasi-random sequences in arbitrary dimensions. ;; Quasi-random sequences in arbitrary dimensions.
;; Liam Healy, Sun Jul 16 2006 - 15:54 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
(defmobject quasi-random-number-generator (defmobject quasi-random-number-generator
"gsl_qrng" "gsl_qrng"
((rng-type :pointer) (dimension :uint)) ((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. "Make and optionally initialize the generator q to its starting point.
Note that quasi-random sequences do not use a seed and always produce Note that quasi-random sequences do not use a seed and always produce
the same set of values." the same set of values."
("init" :void) :initialize-suffix ("init" :void)
nil) :initialize-args nil)
(defmfun qrng-get (generator return-vector) (defmfun qrng-get (generator return-vector)
"gsl_qrng_get" "gsl_qrng_get"
......
;; Series acceleration. ;; Series acceleration.
;; Liam Healy, Wed Nov 21 2007 - 18:41 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
(defmobject levin "gsl_sum_levin_u" (defmobject levin "gsl_sum_levin_u"
((order sizet)) ((order sizet))
"Levin u-transform" ; FDL "Levin u-transform"
:documentation ; FDL
"Make a workspace for a Levin u-transform of n "Make a workspace for a Levin u-transform of n
terms. The size of the workspace is O(2n^2 + 3n).") terms. The size of the workspace is O(2n^2 + 3n).")
...@@ -53,7 +54,8 @@ ...@@ -53,7 +54,8 @@
(defmobject levin-truncated "gsl_sum_levin_utrunc" (defmobject levin-truncated "gsl_sum_levin_utrunc"
((order sizet)) ((order sizet))
"truncated Levin u-transform" ; FDL "truncated Levin u-transform"
:documentation ; FDL
"Make a workspace for a Levin u-transform of n "Make a workspace for a Levin u-transform of n
terms, without error estimation. The size of the workspace is terms, without error estimation. The size of the workspace is
O(3n).") O(3n).")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment