From 297c08b2842e9ea41350a20ea67c4322869ad041 Mon Sep 17 00:00:00 2001 From: Liam Healy <liam@thinkpad.local> Date: Fri, 26 Dec 2008 17:32:44 -0500 Subject: [PATCH] Calling mobjects with #'mpointer, generic function #'name GSL functions that take GSL objects as arguments must have #'mpointer called on each argument. Created a generic function #'name and changed all the *-name (or name-*) functions that acted on mobjects to this function. --- chebyshev.lisp | 16 ++--- documentation/documentation.html | 10 +-- eigensystems.lisp | 6 +- gsll.asd | 4 +- hankel.lisp | 8 +-- init/mobject.lisp | 6 +- interpolation/lookup.lisp | 4 +- interpolation/types.lisp | 8 ++- linear-algebra/blas1.lisp | 4 +- monte-carlo.lisp | 39 +++++++++--- numerical-integration.lisp | 28 ++++----- polynomial.lisp | 4 +- random/discrete.lisp | 6 +- random/generators.lisp | 32 +++++----- random/quasi.lisp | 16 ++--- series-acceleration.lisp | 6 +- solve-minimize-fit/linear-least-squares.lisp | 10 +-- solve-minimize-fit/minimization-multi.lisp | 30 ++++----- solve-minimize-fit/minimization-one.lisp | 26 ++++---- .../nonlinear-least-squares.lisp | 20 +++--- solve-minimize-fit/roots-multi.lisp | 28 +++++---- solve-minimize-fit/roots-one.lisp | 50 ++++++++------- wavelet.lisp | 63 ++++++++++--------- 23 files changed, 233 insertions(+), 191 deletions(-) diff --git a/chebyshev.lisp b/chebyshev.lisp index 446795c4..95ce63a0 100644 --- a/chebyshev.lisp +++ b/chebyshev.lisp @@ -1,6 +1,6 @@ ;; Chebyshev Approximations ;; Liam Healy Sat Nov 17 2007 - 20:36 -;; Time-stamp: <2008-12-26 11:21:25EST chebyshev.lisp> +;; Time-stamp: <2008-12-26 16:43:37EST chebyshev.lisp> ;; $Id$ (in-package :gsl) @@ -26,8 +26,8 @@ (defmfun evaluate-chebyshev (chebyshev x &optional order) ("gsl_cheb_eval" "gsl_cheb_eval_n") - (((chebyshev :pointer) (x :double)) - ((chebyshev :pointer) (order sizet) (x :double))) + ((((mpointer chebyshev) :pointer) (x :double)) + (((mpointer chebyshev) :pointer) (order sizet) (x :double))) :c-return :double :documentation ; FDL "Evaluate the Chebyshev series at a point x. If order is supplied, @@ -35,8 +35,10 @@ (defmfun evaluate-chebyshev-error (chebyshev x &optional order) ("gsl_cheb_eval_err" "gsl_cheb_eval_n_err") - (((chebyshev :pointer) (x :double) (result :double) (abserr :double)) - ((chebyshev :pointer) (order sizet) (x :double) (result :double) (abserr :double))) + ((((mpointer chebyshev) :pointer) (x :double) (result :double) + (abserr :double)) + (((mpointer chebyshev) :pointer) (order sizet) (x :double) + (result :double) (abserr :double))) :documentation ; FDL "Evaluate the Chebyshev series at a point x, returning result and an estimate of its absolute error. If order is supplied, @@ -48,7 +50,7 @@ (defmfun derivative-chebyshev (derivative chebyshev) "gsl_cheb_calc_deriv" - ((derivative :pointer) (chebyshev :pointer)) + ((derivative :pointer) ((mpointer chebyshev) :pointer)) :documentation ; FDL "Compute the derivative of the Chebyshev series, storing the derivative coefficients in the previously allocated series. @@ -56,7 +58,7 @@ (defmfun integral-chebyshev (integral chebyshev) "gsl_cheb_calc_integ" - ((integral :pointer) (chebyshev :pointer)) + ((integral :pointer) ((mpointer chebyshev) :pointer)) :documentation ; FDL "Compute the integral of the Chebyshev series, storing the integral coefficients in the previously allocated series. diff --git a/documentation/documentation.html b/documentation/documentation.html index e5521903..ee1ad8e7 100644 --- a/documentation/documentation.html +++ b/documentation/documentation.html @@ -46,9 +46,11 @@ to find that the Lisp function name is <code>#'jacobian-elliptic-functions</code <code>(examples 'higher-moments)</code>. The result will be a list of forms, each providing an example of usage in the relevant topic. If the - <a href="http://www.gnu.org/software/gsl/manual/">GSL documentation</a> - provides an example, there will usually be the same or similar - example provided in GSLL.</li> + <a href="http://www.gnu.org/software/gsl/manual/">GSL + documentation</a> provides an example, there will usually be the same + or similar example provided in GSLL. <i>Note:</i> Some of the + examples intentionally designed to signal an error, because the + examples also serve as a regression (unit) test suite for GSLL.</li> </ul> It is advisable to look at the examples first for calculations that require more complex setup (generally, the later chapters in the GSL @@ -205,7 +207,7 @@ gamma-randist, negative-binomial. <address><a href="mailto:gsll-devel@common-lisp.net">Liam Healy</a></address> <!-- hhmts start --> <small> - Time-stamp: <2008-11-30 19:28:51EST documentation.html> + Time-stamp: <2008-12-26 15:10:41EST documentation.html> </small> <!-- hhmts end --> </div> diff --git a/eigensystems.lisp b/eigensystems.lisp index a0b81a2e..3aba46d1 100644 --- a/eigensystems.lisp +++ b/eigensystems.lisp @@ -1,6 +1,6 @@ ;; Eigenvectors and eigenvalues ;; Liam Healy, Sun May 21 2006 - 19:52 -;; Time-stamp: <2008-12-26 11:14:06EST eigensystems.lisp> +;; Time-stamp: <2008-12-26 17:03:39EST eigensystems.lisp> ;; $Id$ (in-package :gsl) @@ -45,7 +45,7 @@ (double-float "gsl_eigen_symm" complex-double-float "gsl_eigen_herm") (((mpointer A) :pointer) - ((mpointer eigenvalues) :pointer) (ws :pointer)) + ((mpointer eigenvalues) :pointer) ((mpointer ws) :pointer)) :definition :generic :element-types :doubles :inputs (A) @@ -65,7 +65,7 @@ (double-float "gsl_eigen_symmv" complex-double-float "gsl_eigen_hermv") (((mpointer A) :pointer) ((mpointer eigenvalues) :pointer) - ((mpointer eigenvectors) :pointer) (ws :pointer)) + ((mpointer eigenvectors) :pointer) ((mpointer ws) :pointer)) :definition :generic :element-types :doubles :inputs (A) diff --git a/gsll.asd b/gsll.asd index 2f98e6ba..1fecd59f 100644 --- a/gsll.asd +++ b/gsll.asd @@ -1,6 +1,6 @@ ;; Definition of GSLL system ;; Liam Healy -;; Time-stamp: <2008-12-26 10:54:32EST gsll.asd> +;; Time-stamp: <2008-12-26 17:26:28EST gsll.asd> ;; $Id$ (asdf:defsystem "gsll" @@ -166,7 +166,7 @@ :depends-on (init) :components ((:file "interpolation") - (:file "types") + (:file "types" :depends-on (interpolation)) (:file "lookup") (:file "evaluation") (:file "spline-example" :depends-on (types)))) diff --git a/hankel.lisp b/hankel.lisp index db08744f..d20e876a 100644 --- a/hankel.lisp +++ b/hankel.lisp @@ -1,6 +1,6 @@ ;; Discrete Hankel Transforms. ;; Liam Healy, Sat Dec 8 2007 - 16:50 -;; Time-stamp: <2008-12-26 11:56:49EST hankel.lisp> +;; Time-stamp: <2008-12-26 16:55:21EST hankel.lisp> ;; $Id$ (in-package :gsl) @@ -19,7 +19,7 @@ (defmfun apply-hankel (hankel array-in array-out) "gsl_dht_apply" - ((hankel :pointer) ((c-pointer array-in) :pointer) + (((mpointer hankel) :pointer) ((c-pointer array-in) :pointer) ((c-pointer array-out) :pointer)) :documentation ; FDL "Apply the transform to the array array-in @@ -28,14 +28,14 @@ (defmfun sample-x-hankel (hankel n) "gsl_dht_x_sample" - ((hankel :pointer) (n :int)) + (((mpointer hankel) :pointer) (n :int)) :c-return :double :documentation ; FDL "The points where the function f(t) is assumed to be sampled.") (defmfun sample-k-hankel (hankel n) "gsl_dht_k_sample" - ((hankel :pointer) (n :int)) + (((mpointer hankel) :pointer) (n :int)) :c-return :double :documentation ; FDL "The value of the n-th sample point in k-space, j_{\nu,n+1}/X}.") diff --git a/init/mobject.lisp b/init/mobject.lisp index d9fb9ee8..5bf74a66 100644 --- a/init/mobject.lisp +++ b/init/mobject.lisp @@ -1,6 +1,6 @@ ;; Definition of GSL objects and ways to use them. ;; Liam Healy, Sun Dec 3 2006 - 10:21 -;; Time-stamp: <2008-12-26 13:21:44EST mobject.lisp> +;; Time-stamp: <2008-12-26 17:07:25EST mobject.lisp> ;; $Id$ ;;; GSL objects are represented in GSLL as and instance of a 'mobject. @@ -123,6 +123,10 @@ (:method :around ((object mobject)) (make-instance (class-of object) :mpointer (call-next-method)))) +(export 'name) +(defgeneric name (object) + (:documentation "The name given to the GSL object.")) + ;;; Pointer type (defconstant +foreign-pointer-class+ (class-name (class-of (cffi:null-pointer))) "The class in which foreign pointers fall. This will be assumed to be a diff --git a/interpolation/lookup.lisp b/interpolation/lookup.lisp index d286494c..a98e739f 100644 --- a/interpolation/lookup.lisp +++ b/interpolation/lookup.lisp @@ -1,6 +1,6 @@ ;; Index lookup and acceleration ;; Liam Healy, Sun Nov 4 2007 - 18:09 -;; Time-stamp: <2008-12-26 11:18:49EST lookup.lisp> +;; Time-stamp: <2008-12-26 16:41:21EST lookup.lisp> ;; $Id$ (in-package :gsl) @@ -24,7 +24,7 @@ (defmfun accelerated-interpolation-search (x-array x acceleration) "gsl_interp_accel_find" - ((acceleration :pointer) (x-array :pointer) (x :double)) + (((mpointer acceleration) :pointer) (x-array :pointer) (x :double)) :c-return sizet :documentation ; FDL "Search the data array x-array of size, using the given acceleration. diff --git a/interpolation/types.lisp b/interpolation/types.lisp index dde5333a..a8859dd6 100644 --- a/interpolation/types.lisp +++ b/interpolation/types.lisp @@ -1,6 +1,6 @@ ;; Interpolation types ;; Liam Healy, Sun Nov 4 2007 - 17:41 -;; Time-stamp: <2008-02-17 17:47:53EST types.lisp> +;; Time-stamp: <2008-12-26 17:23:12EST types.lisp> ;; $Id$ (in-package :gsl) @@ -45,9 +45,10 @@ "Non-rounded Akima spline with periodic boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.") -(defmfun interpolation-name (interpolation) +(defmfun name ((interpolation interpolation)) "gsl_interp_name" ((interpolation :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the interpolation type.") @@ -61,9 +62,10 @@ interpolation. For example, Akima spline interpolation requires a minimum of 5 points.") -(defmfun spline-name (interpolation) +(defmfun name ((interpolation spline)) "gsl_spline_name" ((interpolation :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the interpolation type.") diff --git a/linear-algebra/blas1.lisp b/linear-algebra/blas1.lisp index 5e20c315..03e31802 100644 --- a/linear-algebra/blas1.lisp +++ b/linear-algebra/blas1.lisp @@ -1,6 +1,6 @@ ;; BLAS level 1, Vector operations ;; Liam Healy, Wed Apr 26 2006 - 15:23 -;; Time-stamp: <2008-12-26 12:22:51EST blas1.lisp> +;; Time-stamp: <2008-12-26 16:30:16EST blas1.lisp> ;; $Id$ (in-package :gsl) @@ -162,7 +162,7 @@ (defmfun modified-givens-rotation ((d1 vector) (d2 vector) (b1 vector) b2 (P vector)) ("gsl_blas_" :type "rotmg") - (((c-pointer d1) :pointer) ((c-pointer d1) :pointer) + (((c-pointer d1) :pointer) ((c-pointer d2) :pointer) ((c-pointer b1) :pointer) (b2 :element-c-type) ((c-pointer P) :pointer)) :definition :generic diff --git a/monte-carlo.lisp b/monte-carlo.lisp index eb4e911a..faf96e6d 100644 --- a/monte-carlo.lisp +++ b/monte-carlo.lisp @@ -1,6 +1,6 @@ ;; Monte Carlo Integration ;; Liam Healy Sat Feb 3 2007 - 17:42 -;; Time-stamp: <2008-12-26 11:34:16EST monte-carlo.lisp> +;; Time-stamp: <2008-12-26 17:05:48EST monte-carlo.lisp> ;; $Id$ (in-package :gsl) @@ -21,6 +21,27 @@ (dim sizet) (x :pointer)) +(defmfun monte-carlo-integrate-plain + (function lower-limits upper-limits calls generator state) + "gsl_monte_plain_integrate" + ((function :pointer) + ((c-pointer lower-limits) :pointer) ((c-pointer upper-limits) :pointer) + ((dim0 lower-limits) sizet) (calls sizet) + ((mpointer generator) :pointer) + ((mpointer state) :pointer) + (result :double) (abserr :double)) + :inputs (lower-limits upper-limits) + :documentation ; FDL + "Uses the plain Monte Carlo algorithm to integrate the + function f over the hypercubic region defined by the + lower and upper limits in the arrays 'lower-limits and + 'upper-limits, each a gsl-vector of length dim. + The integration uses a fixed number + of function calls calls, and obtains random sampling points using + the random number generator 'generator. A previously allocated workspace + 'state must be supplied. The result of the integration is returned + with an estimated absolute error.") + ;;;;**************************************************************************** ;;;; MISER ;;;;**************************************************************************** @@ -81,7 +102,7 @@ ((c-pointer lower-limits) :pointer) ((c-pointer upper-limits) :pointer) ((dim0 lower-limits) sizet) (calls sizet) ((generator generator) :pointer) - (state :pointer) + ((mpointer state) :pointer) (result :double) (abserr :double)) :inputs (lower-limits upper-limits) :documentation ; FDL @@ -165,7 +186,7 @@ ((c-pointer lower-limits) :pointer) ((c-pointer upper-limits) :pointer) ((dim0 lower-limits) sizet) (calls sizet) ((generator generator) :pointer) - (state :pointer) + ((mpointer state) :pointer) (result :double) (abserr :double)) :inputs (lower-limits upper-limits) :documentation ; FDL @@ -212,9 +233,9 @@ (defun random-walk-plain-example (&optional (nsamples 500000)) (let ((ws (make-monte-carlo-plain 3)) - (lower #m(0.0d0 0.0d0 0.0d0)) - (upper (make-marray 'double-float :initial-contents (list pi pi pi))) - (rng (make-random-number-generator *mt19937* 0))) + (lower #m(0.0d0 0.0d0 0.0d0)) + (upper (make-marray 'double-float :initial-contents (list pi pi pi))) + (rng (make-random-number-generator *mt19937* 0))) (monte-carlo-integrate-plain monte-carlo-g lower upper nsamples rng ws))) (defun random-walk-miser-example (&optional (nsamples 500000)) @@ -226,9 +247,9 @@ (defun random-walk-vegas-example (&optional (nsamples 500000)) (let ((ws (make-monte-carlo-vegas 3)) - (lower #m(0.0d0 0.0d0 0.0d0)) - (upper (make-marray 'double-float :initial-contents (list pi pi pi))) - (rng (make-random-number-generator *mt19937* 0))) + (lower #m(0.0d0 0.0d0 0.0d0)) + (upper (make-marray 'double-float :initial-contents (list pi pi pi))) + (rng (make-random-number-generator *mt19937* 0))) (monte-carlo-integrate-vegas monte-carlo-g lower upper nsamples rng ws))) (save-test monte-carlo diff --git a/numerical-integration.lisp b/numerical-integration.lisp index e3732068..ffcdf7c1 100644 --- a/numerical-integration.lisp +++ b/numerical-integration.lisp @@ -1,6 +1,6 @@ ;; Numerical integration ;; Liam Healy, Wed Jul 5 2006 - 23:14 -;; Time-stamp: <2008-12-26 11:35:14EST numerical-integration.lisp> +;; Time-stamp: <2008-12-26 17:02:30EST numerical-integration.lisp> ;; $Id$ ;;; To do: QAWS, QAWO, QAWF, more tests @@ -56,7 +56,7 @@ ((function :pointer) (a :double) (b :double) (absolute-error :double) (relative-error :double) - (limit sizet) (method integrate-method) (workspace :pointer) + (limit sizet) (method integrate-method) ((mpointer workspace) :pointer) (result :double) (abserr :double)) :documentation ; FDL "Apply an integration rule adaptively until an estimate @@ -87,8 +87,8 @@ "gsl_integration_qags" ((function :pointer) (a :double) (b :double) - (absolute-error :double) (relative-error :double) (limit sizet) (workspace :pointer) - (result :double) (abserr :double)) + (absolute-error :double) (relative-error :double) (limit sizet) + ((mpointer workspace) :pointer) (result :double) (abserr :double)) :documentation ; FDL "Apply the Gauss-Kronrod 21-point integration rule adaptively until an estimate of the integral of f over @@ -112,8 +112,8 @@ "gsl_integration_qagp" ((function :pointer) ((mpointer points) :pointer) ((dim0 points) sizet) - (absolute-error :double) (relative-error :double) (limit sizet) (workspace :pointer) - (result :double) (abserr :double)) + (absolute-error :double) (relative-error :double) (limit sizet) + ((mpointer workspace) :pointer) (result :double) (abserr :double)) :inputs (points) :documentation ; FDL "Apply the adaptive integration algorithm QAGS taking @@ -135,8 +135,8 @@ (function limit workspace &optional (absolute-error 1.0d0) (relative-error 1.0d0)) "gsl_integration_qagi" ((function :pointer) - (absolute-error :double) (relative-error :double) (limit sizet) (workspace :pointer) - (result :double) (abserr :double)) + (absolute-error :double) (relative-error :double) (limit sizet) + ((mpointer workspace) :pointer) (result :double) (abserr :double)) :documentation ; FDL "Compute the integral of the function f over the infinite interval (-\infty,+\infty). The integral is mapped onto the @@ -152,8 +152,8 @@ (function a limit workspace &optional (absolute-error 1.0d0) (relative-error 1.0d0)) "gsl_integration_qagiu" ((function :pointer) (a :double) - (absolute-error :double) (relative-error :double) (limit sizet) (workspace :pointer) - (result :double) (abserr :double)) + (absolute-error :double) (relative-error :double) (limit sizet) + ((mpointer workspace) :pointer) (result :double) (abserr :double)) :documentation ; FDL "Compute the integral of the function f over the semi-infinite interval (a,+\infty). The integral is mapped onto the @@ -165,8 +165,8 @@ (function b limit workspace &optional (absolute-error 1.0d0) (relative-error 1.0d0)) "gsl_integration_qagil" ((function :pointer) (b :double) - (absolute-error :double) (relative-error :double) (limit sizet) (workspace :pointer) - (result :double) (abserr :double)) + (absolute-error :double) (relative-error :double) (limit sizet) + ((mpointer workspace) :pointer) (result :double) (abserr :double)) :documentation ; FDL "Compute the integral of the function f over the semi-infinite interval (-\infty,b). The integral is mapped onto the @@ -184,8 +184,8 @@ "gsl_integration_qawc" ((function :pointer) (a :double) (b :double) (c :double) - (absolute-error :double) (relative-error :double) (limit sizet) (workspace :pointer) - (result :double) (abserr :double)) + (absolute-error :double) (relative-error :double) (limit sizet) + ((mpointer workspace) :pointer) (result :double) (abserr :double)) :documentation ; FDL "Compute the Cauchy principal value of the integral of f over (a,b), with a singularity at c, diff --git a/polynomial.lisp b/polynomial.lisp index 86e7adf2..8b50ce7c 100644 --- a/polynomial.lisp +++ b/polynomial.lisp @@ -1,6 +1,6 @@ ;; Polynomials ;; Liam Healy, Tue Mar 21 2006 - 18:33 -;; Time-stamp: <2008-12-26 11:10:14EST polynomial.lisp> +;; Time-stamp: <2008-12-26 17:01:15EST polynomial.lisp> ;; $Id$ (in-package :gsl) @@ -144,7 +144,7 @@ (defmfun polynomial-solve-ws (coefficients workspace answer-pd) "gsl_poly_complex_solve" (((c-pointer coefficients) :pointer) ((dim0 coefficients) sizet) - (workspace :pointer) ((c-pointer answer-pd) :pointer)) + ((mpointer workspace) :pointer) ((c-pointer answer-pd) :pointer)) :return ((loop for i from 0 below (dim0 answer-pd) by 2 collect (complex (maref answer-pd i) diff --git a/random/discrete.lisp b/random/discrete.lisp index 69d869b4..c3cc35a2 100644 --- a/random/discrete.lisp +++ b/random/discrete.lisp @@ -1,6 +1,6 @@ ;; Discrete random variables ;; Liam Healy, Sat Nov 11 2006 - 21:51 -;; Time-stamp: <2008-12-26 11:50:24EST discrete.lisp> +;; Time-stamp: <2008-12-26 17:00:20EST discrete.lisp> ;; $Id$ (in-package :gsl) @@ -18,7 +18,7 @@ (defmfun discrete (generator table) "gsl_ran_discrete" - (((generator generator) :pointer) (table :pointer)) + (((mpointer generator) :pointer) (table :pointer)) :c-return sizet :documentation ; FDL "Generate discrete random numbers after running #'discrete-preprocess; @@ -26,7 +26,7 @@ (defmfun discrete-pdf (k table) "gsl_ran_discrete_pdf" - ((k sizet) (table :pointer)) + ((k sizet) ((mpointer table) :pointer)) :c-return :double :documentation ; FDL "The probability P[k] of observing the variable k. diff --git a/random/generators.lisp b/random/generators.lisp index 2fe5505f..8c2bf32f 100644 --- a/random/generators.lisp +++ b/random/generators.lisp @@ -1,6 +1,6 @@ ;; Generators of random numbers. ;; Liam Healy, Sat Jul 15 2006 - 14:43 -;; Time-stamp: <2008-12-26 11:36:03EST generators.lisp> +;; Time-stamp: <2008-12-26 17:08:09EST generators.lisp> ;; $Id$ (in-package :gsl) @@ -40,7 +40,7 @@ ;;;;**************************************************************************** (defmfun get-random-number (generator) - "gsl_rng_get" (((generator generator) :pointer)) + "gsl_rng_get" (((mpointer generator) :pointer)) :c-return :ulong :documentation ; FDL "Generate a random integer. The @@ -50,7 +50,7 @@ functions #'rng-max and #'rng-min.") (defmfun uniform (generator) - "gsl_rng_uniform" (((generator generator) :pointer)) + "gsl_rng_uniform" (((mpointer generator) :pointer)) :c-return :double :documentation ; FDL "A double precision floating point number uniformly @@ -63,7 +63,7 @@ :ulong.") (defmfun uniform>0 (generator) - "gsl_rng_uniform_pos" (((generator generator) :pointer)) + "gsl_rng_uniform_pos" (((mpointer generator) :pointer)) :c-return :double :documentation ; FDL "Return a positive double precision floating point number @@ -73,7 +73,8 @@ this function if you need to avoid a singularity at 0.0.") (defmfun uniform-fixnum (generator upperbound) - "gsl_rng_uniform_int" (((generator generator) :pointer) (upperbound :ulong)) + "gsl_rng_uniform_int" + (((mpointer generator) :pointer) (upperbound :ulong)) :c-return :ulong :documentation ; FDL "Generate a random integer from 0 to upperbound-1 inclusive. @@ -87,24 +88,19 @@ ;;;; Information functions about instances ;;;;**************************************************************************** -(export 'rng-name) -(defgeneric rng-name (rng-instance) - (:documentation ; FDL - "The name of the random number generator.")) - -(defmfun rng-name ((rng-instance random-number-generator)) - "gsl_rng_name" (((generator rng-instance) :pointer)) +(defmfun name ((rng-instance random-number-generator)) + "gsl_rng_name" (((mpointer rng-instance) :pointer)) :definition :method :c-return :string) (defmfun rng-max (rng-instance) - "gsl_rng_max" (((generator rng-instance) :pointer)) + "gsl_rng_max" (((mpointer rng-instance) :pointer)) :c-return :unsigned-long :documentation "The largest value that #'get-random-number can return.") (defmfun rng-min (rng-instance) - "gsl_rng_min" (((generator rng-instance) :pointer)) + "gsl_rng_min" (((mpointer rng-instance) :pointer)) :c-return :unsigned-long :documentation ; FDL "The smallest value that #'get-random-number @@ -118,7 +114,7 @@ "A pointer to the state of generator.")) (defmfun rng-state ((rng-instance random-number-generator)) - "gsl_rng_state" (((generator rng-instance) :pointer)) + "gsl_rng_state" (((mpointer rng-instance) :pointer)) :c-return :pointer :definition :method :index gsl-random-state) @@ -129,7 +125,7 @@ "The size of the generator.")) (defmfun rng-size ((rng-instance random-number-generator)) - "gsl_rng_size" (((generator rng-instance) :pointer)) + "gsl_rng_size" (((mpointer rng-instance) :pointer)) :c-return sizet :definition :method :index gsl-random-state) @@ -155,7 +151,7 @@ (defmfun copy ((destination random-number-generator) (source random-number-generator)) "gsl_rng_memcpy" - (((generator destination) :pointer) ((generator source) :pointer)) + (((mpointer destination) :pointer) ((mpointer source) :pointer)) :definition :method :documentation ; FDL "Copy the random number generator source into the @@ -164,7 +160,7 @@ of source. The two generators must be of the same type.") (defmfun clone ((instance random-number-generator)) - "gsl_rng_clone" (((generator instance) :pointer)) + "gsl_rng_clone" (((mpointer instance) :pointer)) :definition :method :c-return (mptr :pointer) :return ((make-instance 'random-number-generator :mpointer mptr))) diff --git a/random/quasi.lisp b/random/quasi.lisp index c426259e..cad056cf 100644 --- a/random/quasi.lisp +++ b/random/quasi.lisp @@ -1,6 +1,6 @@ ;; Quasi-random sequences in arbitrary dimensions. ;; Liam Healy, Sun Jul 16 2006 - 15:54 -;; Time-stamp: <2008-12-26 11:36:28EST quasi.lisp> +;; Time-stamp: <2008-12-26 17:09:22EST quasi.lisp> ;; $Id$ (in-package :gsl) @@ -17,7 +17,7 @@ (defmfun qrng-get (generator return-vector) "gsl_qrng_get" - (((generator generator) :pointer) ((c-pointer return-vector) :pointer)) + (((mpointer generator) :pointer) ((c-pointer return-vector) :pointer)) :outputs (return-vector) :return (return-vector) :documentation ; FDL @@ -26,20 +26,20 @@ dimension of the generator. The point will lie in the range 0 < x_i < 1 for each x_i.") -(defmfun rng-name ((instance quasi-random-number-generator)) - "gsl_qrng_name" (((generator instance) :pointer)) +(defmfun name ((instance quasi-random-number-generator)) + "gsl_qrng_name" (((mpointer instance) :pointer)) :definition :method :c-return :string) (defmfun rng-state ((instance quasi-random-number-generator)) - "gsl_qrng_state" (((generator instance) :pointer)) + "gsl_qrng_state" (((mpointer instance) :pointer)) :c-return :pointer :definition :method :export nil :index gsl-random-state) (defmfun rng-size ((instance quasi-random-number-generator)) - "gsl_qrng_size" (((generator instance) :pointer)) + "gsl_qrng_size" (((mpointer instance) :pointer)) :c-return sizet :definition :method :export nil @@ -49,7 +49,7 @@ ((destination quasi-random-number-generator) (source quasi-random-number-generator)) "gsl_qrng_memcpy" - (((generator destination) :pointer) ((generator source) :pointer)) + (((mpointer destination) :pointer) ((mpointer source) :pointer)) :definition :method :documentation ; FDL "Copy the quasi-random sequence generator src into the @@ -57,7 +57,7 @@ of src. The two generators must be of the same type.") (defmfun clone ((instance quasi-random-number-generator)) - "gsl_qrng_clone" (((generator instance) :pointer)) + "gsl_qrng_clone" (((mpointer instance) :pointer)) :definition :method :c-return (mptr :pointer) :return ((make-instance 'quasi-random-number-generator :mpointer mptr)) diff --git a/series-acceleration.lisp b/series-acceleration.lisp index 3d025035..9946f77d 100644 --- a/series-acceleration.lisp +++ b/series-acceleration.lisp @@ -1,6 +1,6 @@ ;; Series acceleration. ;; Liam Healy, Wed Nov 21 2007 - 18:41 -;; Time-stamp: <2008-12-26 12:17:53EST series-acceleration.lisp> +;; Time-stamp: <2008-12-26 16:44:29EST series-acceleration.lisp> ;; $Id$ (in-package :gsl) @@ -29,7 +29,7 @@ (defmfun accelerate (array levin) "gsl_sum_levin_u_accel" - (((c-pointer array) :pointer) ((dim0 array) sizet) (levin :pointer) + (((c-pointer array) :pointer) ((dim0 array) sizet) ((mpointer levin) :pointer) (accelerated-sum :double) (absolute-error :double)) :documentation ; FDL "From the terms of a series in array, compute the extrapolated @@ -55,7 +55,7 @@ (defmfun accelerate-truncated (array levin) "gsl_sum_levin_utrunc_accel" - (((c-pointer array) :pointer) ((dim0 array) sizet) (levin :pointer) + (((c-pointer array) :pointer) ((dim0 array) sizet) ((mpointer levin) :pointer) (accelerated-sum :double) (absolute-error :double)) :documentation ; FDL "From the terms of a series in array, compute the extrapolated diff --git a/solve-minimize-fit/linear-least-squares.lisp b/solve-minimize-fit/linear-least-squares.lisp index c5faa228..5d28d3af 100644 --- a/solve-minimize-fit/linear-least-squares.lisp +++ b/solve-minimize-fit/linear-least-squares.lisp @@ -1,6 +1,6 @@ ;; Linear least squares, or linear regression ;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp> -;; Time-stamp: <2008-12-26 13:26:43EST linear-least-squares.lisp> +;; Time-stamp: <2008-12-26 16:51:06EST linear-least-squares.lisp> ;; $Id$ (in-package :gsl) @@ -141,7 +141,7 @@ (((mpointer model) :pointer) ((mpointer observations) :pointer) (tolerance :double) ((mpointer parameters) :pointer) (covariance :pointer) (chisq :double) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :inputs (model observations) :outputs (parameters covariance) :documentation ; FDL @@ -165,7 +165,7 @@ (tolerance :double) (rank sizet) ((mpointer parameters) :pointer) (covariance :pointer) (chisq :double) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :inputs (model observations) :outputs (parameters covariance) :return ((dcref chisq) (scref rank)) @@ -195,7 +195,7 @@ ((mpointer observations) :pointer) ((mpointer parameters) :pointer) ((mpointer covariance) :pointer) (chisq :double) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :inputs (model observations) :outputs (parameters covariance) :documentation ; FDL @@ -220,7 +220,7 @@ (tolerance :double) (rank sizet) ((mpointer parameters) :pointer) (covariance :pointer) (chisq :double) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :inputs (model weight observations) :outputs (parameters covariance) :return ((dcref chisq) (scref rank)) diff --git a/solve-minimize-fit/minimization-multi.lisp b/solve-minimize-fit/minimization-multi.lisp index d7f0be4d..974263be 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: <2008-12-26 12:57:02EST minimization-multi.lisp> +;; Time-stamp: <2008-12-26 17:21:08EST minimization-multi.lisp> ;; $Id$ (in-package :gsl) @@ -81,16 +81,18 @@ ((function-derivative :pointer) ((mpointer initial) :pointer) (step-size :double) (tolerance :double))) -(defmfun mfminimizer-name (minimizer) +(defmfun name ((minimizer multi-dimensional-minimizer-f)) "gsl_multimin_fminimizer_name" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the minimizer.") -(defmfun mfdfminimizer-name (minimizer) +(defmfun name ((minimizer multi-dimensional-minimizer-fdf)) "gsl_multimin_fdfminimizer_name" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the minimizer.") @@ -101,7 +103,7 @@ (defmfun iterate-mfminimizer (minimizer) "gsl_multimin_fminimizer_iterate" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :documentation ; FDL "Perform a single iteration of the minimizer. If the iteration encounters an unexpected problem then an error code will be @@ -109,7 +111,7 @@ (defmfun iterate-mfdfminimizer (minimizer) "gsl_multimin_fdfminimizer_iterate" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :documentation ; FDL "Perform a single iteration of the minimizer. If the iteration encounters an unexpected problem then an error code will be @@ -117,7 +119,7 @@ (defmfun mfminimizer-x (minimizer) "gsl_multimin_fminimizer_x" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -125,7 +127,7 @@ (defmfun mfdfminimizer-x (minimizer) "gsl_multimin_fdfminimizer_x" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -133,28 +135,28 @@ (defmfun mfminimizer-minimum (minimizer) "gsl_multimin_fminimizer_minimum" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The current best estimate of the value of the minimum.") (defmfun mfdfminimizer-minimum (minimizer) "gsl_multimin_fdfminimizer_minimum" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The current best estimate of the value of the minimum.") (defmfun mfminimizer-size (minimizer) "gsl_multimin_fminimizer_size" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "A minimizer-specific characteristic size for the minimizer.") (defmfun mfdfminimizer-gradient (minimizer) "gsl_multimin_fdfminimizer_gradient" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -162,7 +164,7 @@ (defmfun mfdfminimizer-restart (minimizer) "gsl_multimin_fdfminimizer_restart" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :documentation ; FDL "Reset the minimizer to use the current point as a new starting point.") diff --git a/solve-minimize-fit/minimization-one.lisp b/solve-minimize-fit/minimization-one.lisp index a1a2d9c5..23a8bd53 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: <2008-12-26 13:26:06EST minimization-one.lisp> +;; Time-stamp: <2008-12-26 17:21:37EST minimization-one.lisp> ;; $Id$ (in-package :gsl) @@ -24,7 +24,7 @@ (minimizer function x-minimum x-lower x-upper f-minimum f-lower f-upper) "gsl_min_fminimizer_set_with_values" - ((minimizer :pointer) (function :pointer) + (((mpointer minimizer) :pointer) (function :pointer) (x-minimum :double) (x-lower :double) (x-upper :double) (f-minimum :double) (f-lower :double) (f-upper :double)) :documentation ; FDL @@ -33,9 +33,10 @@ upper], with a guess for the location of the minimum, using supplied rather than computed values of the function.") -(defmfun fminimizer-name (minimizer) +(defmfun name ((minimizer one-dimensional-minimizer)) "gsl_min_fminimizer_name" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the minimizer.") @@ -46,7 +47,7 @@ (defmfun iterate-fminimizer (minimizer) "gsl_min_fminimizer_iterate" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :success-continue :documentation ; FDL "Perform a single iteration of the minimizer. The following @@ -58,28 +59,28 @@ (defmfun fminimizer-x-minimum (minimizer) "gsl_min_fminimizer_x_minimum" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The current estimate of the position of the minimum for the minimizer.") (defmfun fminimizer-x-lower (minimizer) "gsl_min_fminimizer_x_lower" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The current lower bound of the interval for the minimizer.") (defmfun fminimizer-x-upper (minimizer) "gsl_min_fminimizer_x_upper" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The current upper bound of the interval for the minimizer.") (defmfun fminimizer-f-minimum (minimizer) "gsl_min_fminimizer_f_minimum" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The value of the function at the current estimate of the minimum for the @@ -87,7 +88,7 @@ (defmfun fminimizer-f-lower (minimizer) "gsl_min_fminimizer_f_lower" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The value of the function at the current estimate of the lower bound @@ -95,7 +96,7 @@ (defmfun fminimizer-f-upper (minimizer) "gsl_min_fminimizer_f_upper" - ((minimizer :pointer)) + (((mpointer minimizer) :pointer)) :c-return :double :documentation ; FDL "The value of the function at the current estimate of the upper bound @@ -105,8 +106,7 @@ ;;;; Stopping parameters ;;;;**************************************************************************** -(defmfun - min-test-interval (lower upper absolute-error relative-error) +(defmfun min-test-interval (lower upper absolute-error relative-error) "gsl_min_test_interval" ((lower :double) (upper :double) (absolute-error :double) (relative-error :double)) diff --git a/solve-minimize-fit/nonlinear-least-squares.lisp b/solve-minimize-fit/nonlinear-least-squares.lisp index e14348f1..77a3b515 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: <2008-12-26 12:56:25EST nonlinear-least-squares.lisp> +;; Time-stamp: <2008-12-26 17:17:06EST nonlinear-least-squares.lisp> ;; $Id$ (in-package :gsl) @@ -19,9 +19,10 @@ "set" ((function :pointer) ((mpointer initial-guess) :pointer))) -(defmfun name-ffit (solver) +(defmfun name ((solver nonlinear-ffit)) "gsl_multifit_fsolver_name" - ((solver :pointer)) + (((mpointer solver) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the solver type.") @@ -38,9 +39,10 @@ "set" ((function :pointer) ((mpointer initial-guess) :pointer))) -(defmfun name-fdffit (solver) +(defmfun name ((solver nonlinear-fdffit)) "gsl_multifit_fdfsolver_name" - ((solver :pointer)) + (((mpointer solver) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the solver type.") @@ -110,21 +112,21 @@ (defmfun iterate-ffit (solver) "gsl_multifit_fsolver_iterate" - ((solver :pointer)) + (((mpointer solver) :pointer)) :documentation ; FDL "Perform a single iteration of the solver. The solver maintains a current estimate of the best-fit parameters at all times. ") (defmfun iterate-fdffit (solver) "gsl_multifit_fdfsolver_iterate" - ((solver :pointer)) + (((mpointer solver) :pointer)) :documentation ; FDL "Perform a single iteration of the solver. The solver maintains a current estimate of the best-fit parameters at all times. ") (defmfun current-parameters-ffit (solver) "gsl_multifit_fsolver_position" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -132,7 +134,7 @@ (defmfun current-parameters-fdffit (solver) "gsl_multifit_fdfsolver_position" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL diff --git a/solve-minimize-fit/roots-multi.lisp b/solve-minimize-fit/roots-multi.lisp index 29ea6865..4ee11c83 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: <2008-12-26 13:28:05EST roots-multi.lisp> +;;; Time-stamp: <2008-12-26 17:18:53EST roots-multi.lisp> ;;; $Id$ (in-package :gsl) @@ -71,16 +71,18 @@ (:function function-or-dimension :initial initial))) (initial)) -(defmfun mfsolver-name (solver) +(defmfun name ((solver multi-dimensional-root-solver-f)) "gsl_multiroot_fsolver_name" - ((solver :pointer)) + (((mpointer solver) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the solver.") -(defmfun mfdfsolver-name (solver) +(defmfun name ((solver multi-dimensional-root-solver-fdf)) "gsl_multiroot_fdfsolver_name" - ((solver :pointer)) + (((mpointer solver) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the solver.") @@ -91,7 +93,7 @@ (defmfun iterate-mfsolver (solver) "gsl_multiroot_fsolver_iterate" - ((solver :pointer)) + (((mpointer solver) :pointer)) :documentation ; FDL "Perform a single iteration of the solver. The following errors may be signalled: 'bad-function-supplied, the iteration encountered a @@ -102,7 +104,7 @@ (defmfun iterate-mfdfsolver (solver) "gsl_multiroot_fdfsolver_iterate" - ((solver :pointer)) + (((mpointer solver) :pointer)) :documentation ; FDL "Perform a single iteration of the solver. The following errors may be signalled: 'bad-function-supplied, the iteration encountered a @@ -113,7 +115,7 @@ (defmfun mfsolver-root (solver) "gsl_multiroot_fsolver_root" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -121,7 +123,7 @@ (defmfun mfdfsolver-root (solver) "gsl_multiroot_fdfsolver_root" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation @@ -129,7 +131,7 @@ (defmfun mfsolver-f (solver) "gsl_multiroot_fsolver_f" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -137,7 +139,7 @@ (defmfun mfdfsolver-f (solver) "gsl_multiroot_fdfsolver_f" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -145,7 +147,7 @@ (defmfun mfsolver-dx (solver) "gsl_multiroot_fsolver_dx" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL @@ -153,7 +155,7 @@ (defmfun mfdfsolver-dx (solver) "gsl_multiroot_fsolver_dx" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :pointer :return (:c-return) :documentation ; FDL diff --git a/solve-minimize-fit/roots-one.lisp b/solve-minimize-fit/roots-one.lisp index 1f6d469f..2b94ceba 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: <2008-12-26 12:11:19EST roots-one.lisp> +;; Time-stamp: <2008-12-26 17:13:52EST roots-one.lisp> ;; $Id$ (in-package :gsl) @@ -58,16 +58,18 @@ "set" ((function-derivative :pointer) (root-guess :double))) -(defmfun fsolver-name (solver) +(defmfun name ((solver one-dimensional-root-solver-f)) "gsl_root_fsolver_name" - ((solver :pointer)) + (((mpointer solver) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the solver.") -(defmfun fdfsolver-name (solver) +(defmfun name ((solver one-dimensional-root-solver-fdf)) "gsl_root_fdfsolver_name" - ((solver :pointer)) + (((mpointer solver) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the solver.") @@ -79,7 +81,7 @@ ;; It appears that this is always returning :SUCCESS (0). (defmfun iterate-fsolver (solver) "gsl_root_fsolver_iterate" - ((solver :pointer)) + (((mpointer solver) :pointer)) :documentation ; FDL "Perform a single iteration of the solver. The following errors may be signalled: 'bad-function-supplied, the iteration encountered a @@ -90,7 +92,7 @@ (defmfun iterate-fdfsolver (solver) "gsl_root_fdfsolver_iterate" - ((solver :pointer)) + (((mpointer solver) :pointer)) :documentation ; FDL "Perform a single iteration of the solver. The following errors may be signalled: 'bad-function-supplied, the iteration encountered a @@ -101,28 +103,28 @@ (defmfun fsolver-root (solver) "gsl_root_fsolver_root" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :double :documentation ; FDL "The current estimate of the root for the solver.") (defmfun fdfsolver-root (solver) "gsl_root_fdfsolver_root" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :double :documentation ; FDL "The current estimate of the root for the solver.") (defmfun fsolver-lower (solver) "gsl_root_fsolver_x_lower" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :double :documentation ; FDL "The lower end of the current bracketing interval for the solver.") (defmfun fsolver-upper (solver) "gsl_root_fsolver_x_upper" - ((solver :pointer)) + (((mpointer solver) :pointer)) :c-return :double :documentation ; FDL "The upper end of the current bracketing interval for the solver.") @@ -315,20 +317,22 @@ (defun roots-one-example () "Solving a quadratic, the example given in Sec. 32.10 of the GSL manual." (let ((max-iter 50) - (solver (fsolver *brent-fsolver* quadratic 0.0d0 5.0d0))) + (solver + (make-one-dimensional-root-solver-f + *brent-fsolver* quadratic 0.0d0 5.0d0))) (format t "~&iter ~6t [lower ~24tupper] ~36troot ~44terr ~54terr(est)") (loop for iter from 0 - for root = (fsolver-root solver) - for lower = (fsolver-lower solver) - for upper = (fsolver-upper solver) - do (iterate-fsolver solver) - while (and (< iter max-iter) - (not (root-test-interval lower upper 0.0d0 0.001d0))) - do - (format t "~&~d~6t~10,6f~18t~10,6f~28t~12,9f ~44t~10,4g ~10,4g" - iter lower upper - root (- root (sqrt 5.0d0)) - (- upper lower))))) + for root = (fsolver-root solver) + for lower = (fsolver-lower solver) + for upper = (fsolver-upper solver) + do (iterate-fsolver solver) + while (and (< iter max-iter) + (not (root-test-interval lower upper 0.0d0 0.001d0))) + do + (format t "~&~d~6t~10,6f~18t~10,6f~28t~12,9f ~44t~10,4g ~10,4g" + iter lower upper + root (- root (sqrt 5.0d0)) + (- upper lower))))) ;;; Because def-solver-functions and def-single-function bind a symbol ;;; of the same name as the first function, and we want both to run, diff --git a/wavelet.lisp b/wavelet.lisp index 4fc0a88e..74d8e55c 100644 --- a/wavelet.lisp +++ b/wavelet.lisp @@ -1,6 +1,6 @@ ;; Wavelet transforms. ;; Liam Healy, Mon Nov 26 2007 - 20:43 -;; Time-stamp: <2008-12-26 13:16:29EST wavelet.lisp> +;; Time-stamp: <2008-12-26 17:13:59EST wavelet.lisp> ;; $Id$ (in-package :gsl) @@ -62,9 +62,10 @@ The implemented values of member = 100*i + j are 103, 105, 202, 204, 206, 208, 301, 303, 305 307, 309.") -(defmfun wavelet-name (wavelet) +(defmfun name ((wavelet wavelet)) "gsl_wavelet_name" - ((wavelet :pointer)) + (((mpointer wavelet) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the wavelet family.") @@ -86,9 +87,9 @@ (defmfun wavelet-transform (wavelet data stride direction workspace) "gsl_wavelet_transform" - ((wavelet :pointer) ((c-pointer data) :pointer) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) (stride sizet) ((dim0 data) sizet) ((forward-backward direction) :int) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute in-place forward and inverse discrete wavelet transforms on the array data. The length of the @@ -112,8 +113,8 @@ (defmfun wavelet-transform-forward (wavelet data stride workspace) "gsl_wavelet_transform_forward" - ((wavelet :pointer) ((c-pointer data) :pointer) - (stride sizet) ((dim0 data) sizet) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + (stride sizet) ((dim0 data) sizet) ((mpointer workspace) :pointer)) :documentation ; FDL "Compute in-place forward and inverse discrete wavelet transforms on the array data. The length of the transform @@ -134,8 +135,8 @@ (defmfun wavelet-transform-inverse (wavelet data stride workspace) "gsl_wavelet_transform_inverse" - ((wavelet :pointer) ((c-pointer data) :pointer) - (stride sizet) ((dim0 data) sizet) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + (stride sizet) ((dim0 data) sizet) ((mpointer workspace) :pointer)) :documentation ; FDL "Compute in-place inverse discrete wavelet transforms on the array data. The length of the transform @@ -160,9 +161,9 @@ (defmfun wavelet-2d-transform (wavelet data tda direction workspace) "gsl_wavelet2d_transform" - ((wavelet :pointer) ((c-pointer data) :pointer) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) (tda sizet) ((dim0 data) sizet) ((dim1 data) sizet) - ((forward-backward direction) :int) (workspace :pointer)) + ((forward-backward direction) :int) ((mpointer workspace) :pointer)) :documentation ; FDL "Compute in-place forward and inverse discrete wavelet transforms in standard and non-standard forms on the @@ -180,9 +181,9 @@ (defmfun wavelet-2d-transform-forward (wavelet data tda workspace) "gsl_wavelet2d_transform_forward" - ((wavelet :pointer) ((c-pointer data) :pointer) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) (tda sizet) ((dim0 data) sizet) ((dim1 data) sizet) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute two-dimensional in-place forward and inverse discrete wavelet transforms in standard and non-standard forms on the @@ -198,9 +199,9 @@ (defmfun wavelet-2d-transform-inverse (wavelet data tda workspace) "gsl_wavelet2d_transform_inverse" - ((wavelet :pointer) ((c-pointer data) :pointer) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) (tda sizet) ((dim0 data) sizet) ((dim1 data) sizet) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute two-dimensional in-place forward and inverse discrete wavelet transforms in standard and non-standard forms on the array @@ -214,65 +215,69 @@ (defmfun wavelet-2d-transform-matrix (wavelet data direction workspace) "gsl_wavelet2d_transform_matrix" - ((wavelet :pointer) ((c-pointer data) :pointer) - ((forward-backward direction) :int) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + ((forward-backward direction) :int) ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the two-dimensional in-place wavelet transform on a matrix.") (defmfun wavelet-2d-transform-matrix-forward (wavelet data workspace) "gsl_wavelet2d_transform_matrix_forward" - ((wavelet :pointer) ((c-pointer data) :pointer) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the two-dimensional in-place wavelet transform on a matrix.") (defmfun wavelet-2d-transform-matrix-inverse (wavelet data workspace) "gsl_wavelet2d_transform_matrix_inverse" - ((wavelet :pointer) ((c-pointer data) :pointer) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the two-dimensional in-place wavelet transform on a matrix.") (defmfun wavelet-2d-nonstandard-transform (wavelet data tda direction workspace) "gsl_wavelet2d_nstransform" - ((wavelet :pointer) ((c-pointer data) :pointer) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) (tda sizet) ((dim0 data) sizet) ((dim1 data) sizet) (direction :int) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the two-dimensional wavelet transform in non-standard form.") (defmfun wavelet-2d-nonstandard-transform-forward (wavelet data tda workspace) "gsl_wavelet2d_nstransform_forward" - ((wavelet :pointer) ((c-pointer data) :pointer) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) (tda sizet) ((dim0 data) sizet) ((dim1 data) sizet) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the two-dimensional wavelet transform in non-standard form.") (defmfun wavelet-2d-nonstandard-transform-inverse (wavelet data tda workspace) "gsl_wavelet2d_nstransform_inverse" - ((wavelet :pointer) ((c-pointer data) :pointer) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) (tda sizet) ((dim0 data) sizet) ((dim1 data) sizet) - (workspace :pointer)) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the two-dimensional wavelet transform in non-standard form.") (defmfun wavelet-2d-nonstandard-transform-matrix (wavelet data direction workspace) "gsl_wavelet2d_nstransform_matrix" - ((wavelet :pointer) ((c-pointer data) :pointer) - (direction :int) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + (direction :int) ((mpointer workspace) :pointer)) :documentation "Compute the non-standard form of the two-dimensional in-place wavelet transform on a matrix.") (defmfun wavelet-2d-nonstandard-transform-matrix-forward (wavelet data workspace) "gsl_wavelet2d_nstransform_matrix_forward" - ((wavelet :pointer) ((c-pointer data) :pointer) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the non-standard form of the two-dimensional in-place wavelet transform on a matrix.") (defmfun wavelet-2d-nonstandard-transform-matrix-inverse (wavelet data workspace) "gsl_wavelet2d_nstransform_matrix_inverse" - ((wavelet :pointer) ((c-pointer data) :pointer) (workspace :pointer)) + (((mpointer wavelet) :pointer) ((c-pointer data) :pointer) + ((mpointer workspace) :pointer)) :documentation ; FDL "Compute the non-standard form of the two-dimensional in-place wavelet transform on a matrix.") -- GitLab