From 8c92fe167c851b51c46c8a66281a3571ae6a9a92 Mon Sep 17 00:00:00 2001 From: liam <liam@a3d8a0fb-c1db-0310-ace7-a616afeb9e30> Date: Tue, 20 Feb 2007 04:32:06 +0000 Subject: [PATCH] Add dependency. Fix minor spelling errors. Add mathematica test. Add #'generator method. git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3184 a3d8a0fb-c1db-0310-ace7-a616afeb9e30 --- data/vector.lisp | 4 ++-- gsll.asd | 4 ++-- random/generators.lisp | 12 ++++++++++-- random/quasi.lisp | 9 +++++---- special-functions/airy.lisp | 15 ++++++++++++++- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/data/vector.lisp b/data/vector.lisp index 97f104d8..02849cbc 100644 --- a/data/vector.lisp +++ b/data/vector.lisp @@ -3,7 +3,7 @@ ; description: Vectors ; date: Sun Mar 26 2006 - 11:51 ; author: Liam M. Healy -; modified: Sun Dec 3 2006 - 18:44 +; modified: Sun Feb 18 2007 - 19:08 ;******************************************************** ;;; $Id: $ @@ -72,7 +72,7 @@ deallocated with the vector. args)) (defmethod gsl-array ((object gsl-vector)) - (foreign-slot-value (pointer object) 'gsl-vector-c 'data)) + (cffi:foreign-slot-value (pointer object) 'gsl-vector-c 'data)) ;;;;**************************************************************************** ;;;; Getting values diff --git a/gsll.asd b/gsll.asd index 989af871..14a136d8 100644 --- a/gsll.asd +++ b/gsll.asd @@ -3,7 +3,7 @@ ; description: Definition of GSLL system ; date: ; author: Liam Healy -; modified: Sun Feb 4 2007 - 23:06 +; modified: Sun Feb 11 2007 - 16:14 ;******************************************************** ;;; $Id: $ @@ -151,4 +151,4 @@ (:file "read-write" :depends-on (histogram)) (:file "probability-distribution" :depends-on (histogram)) (:file "ntuple"))) - (:file "monte-carlo" :depends-on (init data random)))) + (:file "monte-carlo" :depends-on (init data random numerical-integration)))) diff --git a/random/generators.lisp b/random/generators.lisp index d48f7d0a..ec3a04e1 100644 --- a/random/generators.lisp +++ b/random/generators.lisp @@ -3,7 +3,7 @@ ; description: Generators of random numbers. ; date: Sat Jul 15 2006 - 14:43 ; author: Liam M. Healy -; modified: Sun Jul 16 2006 - 17:41 +; modified: Sat Feb 17 2007 - 21:56 ;******************************************************** ;;; $Id: $ @@ -13,6 +13,13 @@ (export '(random-number-generator make-random-number-generator)) +(defgeneric generator (object) + (:method ((object t)) + (if (cffi:pointerp object) + object + (call-next-method))) + (:documentation "The foreign pointer to the GSL generator function.")) + (defclass gsl-random () ((type :initarg :type :reader rng-type) (generator :initarg :generator :accessor generator))) @@ -207,7 +214,7 @@ :type :method :documentation "Create a new generator which is an exact copy of the original. - Dont' use; use #'make-random-number-generator, #'copy instead.") + Don't use; use #'make-random-number-generator, #'copy instead.") (defun-gsl write-binary ((object random-number-generator) stream) @@ -227,6 +234,7 @@ (defparameter *rng-mt19937* (make-random-number-generator *mt19937*)) (defparameter *rng-cmrg* (make-random-number-generator *cmrg*)) +;;; (defparameter *rng-default* (make-random-number-generator *default-type*)) (lisp-unit:define-test random-number-generators (lisp-unit:assert-equal diff --git a/random/quasi.lisp b/random/quasi.lisp index ed825e70..34081899 100644 --- a/random/quasi.lisp +++ b/random/quasi.lisp @@ -1,9 +1,9 @@ ;******************************************************** ; file: quasi.lisp -; description: Quasi-Random Number Generators +; description: Quasi-random sequences in arbitrary dimensions. ; date: Sun Jul 16 2006 - 15:54 ; author: Liam M. Healy -; modified: Sun Dec 31 2006 - 22:59 +; modified: Sat Feb 17 2007 - 17:45 ;******************************************************** ;;; $Id: $ @@ -106,7 +106,7 @@ :type :method :documentation "Create a new generator which is an exact copy of the original. - Dont' use; use #'make-random-number-generator, #'copy instead.") + Don't use; use #'make-random-number-generator, #'copy instead.") (def-rng-type *niederreiter2* "Described in Bratley, Fox, Niederreiter, @@ -115,7 +115,8 @@ "gsl_qrng_niederreiter_2") (eval-when (:load-toplevel :execute) - (setf *default-quasi-random-number-generator* *niederreiter2*)) + (setf *default-quasi-random-number-generator* + (make-quasi-random-number-generator 2 *niederreiter2*))) (def-rng-type *sobol* "This generator uses the Sobol sequence described in Antonov, Saleev, diff --git a/special-functions/airy.lisp b/special-functions/airy.lisp index 7b96876c..fcf745b5 100644 --- a/special-functions/airy.lisp +++ b/special-functions/airy.lisp @@ -3,7 +3,7 @@ ; description: Airy functions ; date: Fri Mar 17 2006 - 18:41 ; author: Liam M. Healy -; modified: Wed Jun 7 2006 - 17:32 +; modified: Sun Feb 18 2007 - 12:16 ;******************************************************** (in-package :gsl) @@ -92,3 +92,16 @@ (lisp-unit:assert-first-fp-equal "-0.117371322271d+01" (airy-zero-bi 1)) (lisp-unit:assert-first-fp-equal "-0.101879297165d+01" (airy-zero-ai-deriv 1)) (lisp-unit:assert-first-fp-equal "-0.229443968261d+01" (airy-zero-bi-deriv 1))) + + +#| +;;; Mathematica results +In[4]:= AiryAi[2.5] +Out[4]= 0.01572592338047049 +In[5]:= AiryBi[2.5] +Out[5]= 6.481660738460579 +In[6]:= AiryAiPrime[2.5] +Out[6]= -0.02625088103590323 +In[7]:= AiryBiPrime[2.5] +Out[7]= 9.4214233173343 +|# -- GitLab