Commit 8a0ac730 authored by Liam Healy's avatar Liam Healy

Set mpointer vlaue, show relevant .h file; non-int return for reinitialize-instance

In defmobject, set the mpointer value if #'allocate is being called.
For each file that defines a defmobject, I put a comment at the top
showing the relevant GSL header file.  For generators and quasi, the
(re)initializing function returns void and not an :int, so that is
changed in the defmobject definition, which now permits a list of two
elements in initialize-suffix, with the second element indicating the
:c-return.
parent 297c08b2
;; Basis splines.
;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp
;; Time-stamp: <2008-12-26 12:51:25EST basis-splines.lisp>
;; Time-stamp: <2008-12-26 18:25:41EST basis-splines.lisp>
;; $Id$
(in-package :gsl)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; /usr/include/gsl/gsl_bspline.h
;;; Should be subclass of interpolation?
(defmobject basis-spline "gsl_bspline"
......
;; Chebyshev Approximations
;; Liam Healy Sat Nov 17 2007 - 20:36
;; Time-stamp: <2008-12-26 16:43:37EST chebyshev.lisp>
;; Time-stamp: <2008-12-26 18:21:11EST chebyshev.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_chebyshev.h
;;;;****************************************************************************
;;;; Creation and calculation of Chebyshev series
;;;;****************************************************************************
......
;; Eigenvectors and eigenvalues
;; Liam Healy, Sun May 21 2006 - 19:52
;; Time-stamp: <2008-12-26 17:03:39EST eigensystems.lisp>
;; Time-stamp: <2008-12-26 18:57:10EST eigensystems.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_eigen.h
;;;;****************************************************************************
;;;; Workspace
;;;;****************************************************************************
......
;; Discrete Hankel Transforms.
;; Liam Healy, Sat Dec 8 2007 - 16:50
;; Time-stamp: <2008-12-26 16:55:21EST hankel.lisp>
;; Time-stamp: <2008-12-26 18:46:20EST hankel.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_dht.h
;;; Everything compiles, but not tested -- need example.
;;; We don't use gsl_dht_new = gsl_dht_alloc + gsl_dht_init.
;;; Create the Hankel transform object and essential methods/functions.
(defmobject hankel "gsl_dht"
......@@ -13,9 +16,8 @@
"discrete Hankel Transform"
"Allocate a Discrete Hankel transform object of the given size and
optionally initialize the transform for the given values of nu and x."
"new"
"init"
((nu :double) (xmax :double)))
;;; We don't use gsl_dht_init because we use gsl_dht_new?
(defmfun apply-hankel (hankel array-in array-out)
"gsl_dht_apply"
......
;; Histogram probability distribution.
;; Liam Healy, Mon Jan 1 2007 - 17:51
;; Time-stamp: <2008-12-26 14:47:01EST probability-distribution.lisp>
;; Time-stamp: <2008-12-26 18:38:41EST probability-distribution.lisp>
;; $Id$
(in-package :gsl)
;; /usr/include/gsl/gsl_histogram.h
;; /usr/include/gsl/gsl_histogram2d.h
;;; /usr/include/gsl/gsl_histogram.h
;;; /usr/include/gsl/gsl_histogram2d.h
(defmobject histogram-pdf
"gsl_histogram_pdf"
......
;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21
;; Time-stamp: <2008-12-26 17:07:25EST mobject.lisp>
;; Time-stamp: <2008-12-26 18:13:24EST mobject.lisp>
;; $Id$
;;; GSL objects are represented in GSLL as and instance of a 'mobject.
......@@ -13,7 +13,7 @@
(in-package :gsl)
(defclass mobject ()
((mpointer :initarg :mpointer :reader mpointer
((mpointper :initarg :mpointer :reader mpointer
:documentation "A pointer to the GSL representation of the object.")))
(defmacro defmobject
......@@ -25,6 +25,8 @@
;; If prefix is a list, the first is the actual prefix, and the
;; second is the name of the allocateor. I'm looking at you,
;; discrete-random. Grrr.
;; Argument 'initialize-suffix: string appended to prefix for form GSL function name
;; or a list of such a string and the c-return argument.
(let* ((settingp (make-symbol "SETTINGP"))
(arglists
(when arglists-function
......@@ -51,7 +53,8 @@
((object ,class) &key mpointer ,@cl-alloc-args)
(unless mpointer
(setf mpointer
(allocate object ,@(symbol-keyword-symbol cl-alloc-args))))
(allocate object ,@(symbol-keyword-symbol cl-alloc-args))
(slot-value object 'mpointer) mpointer))
(trivial-garbage:finalize
object
(lambda ()
......@@ -62,10 +65,15 @@
,@(when initialize-suffix
`((defmfun reinitialize-instance
((object ,class) &key ,@cl-initialize-args)
,(format nil "~a_~a" realprefix initialize-suffix)
,(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
......
;; Interpolation allocation, initialization, and freeing.
;; Liam Healy, Sun Nov 4 2007 - 17:24
;; Time-stamp: <2008-12-26 11:20:11EST interpolation.lisp>
;; Time-stamp: <2008-12-26 18:19:19EST interpolation.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_interp.h
;;; /usr/include/gsl/gsl_spline.h
;;; A spline is an interpolation that also stores the arrays xa and ya,
;;; so they need not be supplied on each call.
(defmobject interpolation "gsl_interp"
......
;; Monte Carlo Integration
;; Liam Healy Sat Feb 3 2007 - 17:42
;; Time-stamp: <2008-12-26 17:05:48EST monte-carlo.lisp>
;; Time-stamp: <2008-12-26 18:59:23EST monte-carlo.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_monte.h
;;; /usr/include/gsl/gsl_monte_plain.h
;;; /usr/include/gsl/gsl_monte_miser.h
;;; /usr/include/gsl/gsl_monte_vegas.h
;;;;****************************************************************************
;;;; PLAIN Monte Carlo
;;;;****************************************************************************
......
;; Numerical integration
;; Liam Healy, Wed Jul 5 2006 - 23:14
;; Time-stamp: <2008-12-26 17:02:30EST numerical-integration.lisp>
;; Time-stamp: <2008-12-26 18:54:27EST numerical-integration.lisp>
;; $Id$
;;; To do: QAWS, QAWO, QAWF, more tests
(in-package :gsl)
;;; /usr/include/gsl/gsl_integration.h
;;;;****************************************************************************
;;;; QNG non-adaptive Gauss-Kronrod integration
;;;;****************************************************************************
......
;; Polynomials
;; Liam Healy, Tue Mar 21 2006 - 18:33
;; Time-stamp: <2008-12-26 17:01:15EST polynomial.lisp>
;; Time-stamp: <2008-12-26 18:53:14EST polynomial.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_poly.h
;;; Provide autotranslation from CL pure arrays?
;;; Divided differences not complete/tested.
......
;; Bernoulli distribution
;; Liam Healy, Sat Nov 25 2006 - 16:59
;; Time-stamp: <2008-12-26 11:38:55EST bernoulli.lisp>
;; Time-stamp: <2008-12-26 18:05:04EST bernoulli.lisp>
;; $Id$
(in-package :gsl)
(defmfun bernoulli (generator p)
"gsl_ran_bernoulli"
(((generator generator) :pointer) (p :double))
(((mpointer generator) :pointer) (p :double))
:c-return :uint
:documentation ; FDL
"Returns either 0 or 1, the result of a Bernoulli trial
......
;; Discrete random variables
;; Liam Healy, Sat Nov 11 2006 - 21:51
;; Time-stamp: <2008-12-26 17:00:20EST discrete.lisp>
;; Time-stamp: <2008-12-26 18:52:04EST discrete.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_randist.h
(defmobject discrete-random
("gsl_ran_discrete" "gsl_ran_discrete_preproc")
(((dim0 probabilities) sizet) ((c-pointer probabilities) :pointer))
......
;; Generators of random numbers.
;; Liam Healy, Sat Jul 15 2006 - 14:43
;; Time-stamp: <2008-12-26 17:08:09EST generators.lisp>
;; Time-stamp: <2008-12-26 18:17:35EST generators.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_rng.h
;;;;****************************************************************************
;;;; Object
;;;;****************************************************************************
......@@ -23,7 +25,7 @@
For example, the original Fortran source code for the *ranlux*
generator used a seed of 314159265, and so choosing s equal to zero
reproduces this when using *ranlux*."
"set"
("set" :void)
((value :ulong)))
;;;;****************************************************************************
......
;; Quasi-random sequences in arbitrary dimensions.
;; Liam Healy, Sun Jul 16 2006 - 15:54
;; Time-stamp: <2008-12-26 17:09:22EST quasi.lisp>
;; Time-stamp: <2008-12-26 18:49:30EST quasi.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_qrng.h
(defmobject quasi-random-number-generator
"gsl_qrng"
((rng-type :pointer) (dimension :uint))
......@@ -12,7 +14,7 @@
"Make and optionally initialize the generator q to its starting point.
Note that quasi-random sequences do not use a seed and always produce
the same set of values."
"init"
("init" :void)
nil)
(defmfun qrng-get (generator return-vector)
......
;; Series acceleration.
;; Liam Healy, Wed Nov 21 2007 - 18:41
;; Time-stamp: <2008-12-26 16:44:29EST series-acceleration.lisp>
;; Time-stamp: <2008-12-26 18:22:40EST series-acceleration.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_sum.h
;;;;****************************************************************************
;;;; Creation and calculation of Levin series acceleration
;;;;****************************************************************************
......
;; Linear least squares, or linear regression
;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp>
;; Time-stamp: <2008-12-26 16:51:06EST linear-least-squares.lisp>
;; Time-stamp: <2008-12-26 18:38:44EST linear-least-squares.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_fit.h
;;;;****************************************************************************
;;;; Linear regression
;;;;****************************************************************************
......
;; Multivariate minimization.
;; Liam Healy <Tue Jan 8 2008 - 21:28>
;; Time-stamp: <2008-12-26 17:21:08EST minimization-multi.lisp>
;; Time-stamp: <2008-12-26 18:33:28EST minimization-multi.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_multimin.h
;; In the parabaloid example, I notice that the consruct
;; (min-test-gradient (mfdfminimizer-gradient minimizer) 1.0d-3)
;; is constructing a CL vector-double-float (in mfdfminimizer-gradient) and
......
;; Univariate minimization
;; Liam Healy Tue Jan 8 2008 - 21:02
;; Time-stamp: <2008-12-26 17:21:37EST minimization-one.lisp>
;; Time-stamp: <2008-12-26 18:35:53EST minimization-one.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_min.h
;;;;****************************************************************************
;;;; Initialization
;;;;****************************************************************************
......
;; Nonlinear least squares fitting.
;; Liam Healy, 2008-02-09 12:59:16EST nonlinear-least-squares.lisp
;; Time-stamp: <2008-12-26 17:17:06EST nonlinear-least-squares.lisp>
;; Time-stamp: <2008-12-26 18:29:44EST nonlinear-least-squares.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_multifit_nlin.h
;;;;****************************************************************************
;;;; Function-only solver object
;;;;****************************************************************************
......@@ -31,7 +33,7 @@
;;;; Function and derivative solver object
;;;;****************************************************************************
(defmobject nonlinear-fdffit "gsl_multifit_fsolver"
(defmobject nonlinear-fdffit "gsl_multifit_fdfsolver"
((solver-type :pointer) (number-of-observations sizet) (number-of-parameters sizet))
"nonlinear least squares fit with function and derivative" ; FDL
"The number of observations must be greater than or
......
;;; Multivariate roots.
;;; Liam Healy 2008-01-12 12:49:08
;;; Time-stamp: <2008-12-26 17:18:53EST roots-multi.lisp>
;;; Time-stamp: <2008-12-26 18:37:15EST roots-multi.lisp>
;;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_multiroots.h
;;;;****************************************************************************
;;;; Function definition
;;;;****************************************************************************
......
;; One-dimensional root solver.
;; Liam Healy
;; Time-stamp: <2008-12-26 17:13:52EST roots-one.lisp>
;; Time-stamp: <2008-12-26 18:31:13EST roots-one.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_roots.h
;;;;****************************************************************************
;;;; Function definition
;;;;****************************************************************************
......
;; Make tests from examples.
;; Liam Healy 2008-09-07 21:00:48EDT generate-tests.lisp
;; Time-stamp: <2008-11-16 12:10:07EST generate-tests.lisp>
;; Time-stamp: <2008-12-26 17:54:49EST generate-tests.lisp>
;; $Id: $
;;; Througout the GSLL interface definition files are #'save-test
......@@ -65,6 +65,7 @@
;;; This is commented out because it shouldn't normally be run. It
;;; will regenerate all tests, so there will be no regression tests to
;;; previous versions. DON'T FORGET THE TRAILING SLASH ON THE PATH
;;; (write-tests "/home/liam/mathematics/gsl/tests/")
#+(or)
(defun write-tests (path)
"Write all the tests to the appropriate file."
......
;; Wavelet transforms.
;; Liam Healy, Mon Nov 26 2007 - 20:43
;; Time-stamp: <2008-12-26 17:13:59EST wavelet.lisp>
;; Time-stamp: <2008-12-26 18:48:14EST wavelet.lisp>
;; $Id$
(in-package :gsl)
;;; Examples do not agree with C results.
;;; /usr/include/gsl/gsl_wavelet.h
;;; Examples do not agree with C results.
;;;;****************************************************************************
;;;; Allocation of wavelets
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment