diff --git a/basis-splines.lisp b/basis-splines.lisp index b2a05f4883918aa7c3f50d4b531041bb74d1034e..d108121e9e5f6292379a418170c1062b50aca80e 100644 --- a/basis-splines.lisp +++ b/basis-splines.lisp @@ -1,6 +1,6 @@ ;; Basis splines. ;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp -;; Time-stamp: <2009-12-27 09:42:10EST basis-splines.lisp> +;; Time-stamp: <2010-01-17 10:41:03EST basis-splines.lisp> ;; ;; Copyright 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -124,7 +124,7 @@ (dotimes (i ndata) (let* ((xi (coerce (* i (/ 15 (1- ndata))) 'double-float)) (yi (+ (* (cos xi) (exp (* -0.1d0 xi))) - (sample rng 'gaussian :sigma sigma)))) + (sample rng :gaussian :sigma sigma)))) (setf (maref x i) xi (maref y i) yi (maref w i) (/ (expt sigma 2))))) diff --git a/random/bernoulli.lisp b/random/bernoulli.lisp index e3259a7e1ee2944f5b0b6e25029da0a5a1a9bc9d..61c8305a6625dee45ad882be0e76dfa8b9dba4cb 100644 --- a/random/bernoulli.lisp +++ b/random/bernoulli.lisp @@ -1,6 +1,6 @@ ;; Bernoulli distribution ;; Liam Healy, Sat Nov 25 2006 - 16:59 -;; Time-stamp: <2009-12-27 10:00:04EST bernoulli.lisp> +;; Time-stamp: <2010-01-17 10:06:06EST bernoulli.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -20,9 +20,8 @@ (in-package :gsl) -(export 'bernoulli) (defmfun sample - ((generator random-number-generator) (type (eql 'bernoulli)) + ((generator random-number-generator) (type (eql :bernoulli)) &key probability) "gsl_ran_bernoulli" (((mpointer generator) :pointer) (probability :double)) @@ -41,12 +40,12 @@ :documentation ; FDL "The probability p(k) of obtaining k from a Bernoulli distribution with probability parameter - p, using the formula given in #'bernoulli.") + p, using the formula given in #'sample :bernoulli.") ;;; Examples and unit test (save-test bernoulli (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'bernoulli :probability 0.5d0))) + (sample rng :bernoulli :probability 0.5d0))) (bernoulli-pdf 0 0.5d0)) diff --git a/random/beta.lisp b/random/beta.lisp index e63ab29b29727b40d8488ea36b96e36f3e88755a..341a52b82c3cbcbb3386895fcc283dc372a477df 100644 --- a/random/beta.lisp +++ b/random/beta.lisp @@ -1,6 +1,6 @@ ;; Beta distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:00:04EST beta.lisp> +;; Time-stamp: <2010-01-17 10:05:21EST beta.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -20,9 +20,8 @@ (in-package :gsl) -(export 'beta) (defmfun sample - ((generator random-number-generator) (type (eql 'beta)) &key a b) + ((generator random-number-generator) (type (eql :beta)) &key a b) "gsl_ran_beta" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -38,7 +37,7 @@ :documentation ; FDL "The probability density p(x) at x for a beta distribution with parameters a and b, using the - formula given in #'beta.") + formula given in #'sample :beta.") (defmfun beta-P (x a b) "gsl_cdf_beta_P" ((x :double) (a :double) (b :double)) @@ -73,7 +72,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'beta :a 1.0d0 :b 2.0d0))) + (sample rng :beta :a 1.0d0 :b 2.0d0))) (beta-pdf 0.1d0 1.0d0 2.0d0) (beta-P 0.1d0 1.0d0 2.0d0) (beta-Q 0.1d0 1.0d0 2.0d0) diff --git a/random/cauchy.lisp b/random/cauchy.lisp index 88913a7ea005bb5433eedd3d5dcdc990cdee7f80..f754997ebc5db0b24fedf8eba6d6f4c94f445965 100644 --- a/random/cauchy.lisp +++ b/random/cauchy.lisp @@ -1,6 +1,6 @@ ;; Cauchy distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:00:03EST cauchy.lisp> +;; Time-stamp: <2010-01-17 10:05:32EST cauchy.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'cauchy) (defmfun sample - ((generator random-number-generator) (type (eql 'cauchy)) &key a) + ((generator random-number-generator) (type (eql :cauchy)) &key a) "gsl_ran_cauchy" (((mpointer generator) :pointer) (a :double)) :definition :method @@ -44,7 +43,7 @@ :documentation ; FDL "The probability density p(x) at x for a Cauchy distribution with scale parameter a, using the formula - given for #'cauchy.") + given for #'sample :cauchy.") (defmfun cauchy-P (x a) "gsl_cdf_cauchy_P" ((x :double) (a :double)) @@ -79,7 +78,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'cauchy :a 10.0d0))) + (sample rng :cauchy :a 10.0d0))) (cauchy-pdf 0.0d0 10.0d0) (cauchy-P 1.0d0 2.0d0) (cauchy-Q 1.0d0 2.0d0) diff --git a/random/chi-squared.lisp b/random/chi-squared.lisp index 6f2ed09f4f18b91957891b18352783ef7ca5c588..17b32a34033a37c41a8f28a44c276b09b1f0acb1 100644 --- a/random/chi-squared.lisp +++ b/random/chi-squared.lisp @@ -1,6 +1,6 @@ ;; Chi-squared distribution ;; Liam Healy, Sat Oct 7 2006 - 16:13 -;; Time-stamp: <2009-12-27 10:00:03EST chi-squared.lisp> +;; Time-stamp: <2010-01-17 10:07:11EST chi-squared.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'chi-squared) (defmfun sample - ((generator random-number-generator) (type (eql 'chi-squared)) &key nu) + ((generator random-number-generator) (type (eql :chi-squared)) &key nu) "gsl_ran_chisq" (((mpointer generator) :pointer) (nu :double)) :definition :method @@ -42,7 +41,7 @@ :documentation ; FDL "The probability density p(x) at x for a chi-squared distribution with nu degrees of freedom, using - the formula given in #'chi-squared.") + the formula given in #'sample :chi-squared.") (defmfun chi-squared-P (x nu) "gsl_cdf_chisq_P" ((x :double) (nu :double)) @@ -77,7 +76,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'chi-squared :nu 10.0d0))) + (sample rng :chi-squared :nu 10.0d0))) (chi-squared-pdf 0.5d0 1.0d0) (chi-squared-P 0.5d0 1.0d0) (chi-squared-Q 0.5d0 1.0d0) diff --git a/random/dirichlet.lisp b/random/dirichlet.lisp index 1618e48620041b0bfac26a15a4f90fe25d63aa7f..4ebf502fcf95595d60995cad25c0072ac68ff431 100644 --- a/random/dirichlet.lisp +++ b/random/dirichlet.lisp @@ -1,6 +1,6 @@ ;; Dirichlet distribution ;; Liam Healy, Sun Oct 29 2006 -;; Time-stamp: <2009-12-27 10:00:02EST dirichlet.lisp> +;; Time-stamp: <2010-01-17 10:09:21EST dirichlet.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'dirichlet) (defmfun sample - ((generator random-number-generator) (type (eql 'dirichlet)) + ((generator random-number-generator) (type (eql :dirichlet)) &key alpha (theta (vdf (dim0 alpha)))) "gsl_ran_dirichlet" (((mpointer generator) :pointer) @@ -64,7 +63,7 @@ :documentation ; FDL "The probability density p(\theta_1, ... , \theta_K) at theta[K] for a Dirichlet distribution with parameters - alpha[K], using the formula given for #'dirichlet.") + alpha[K], using the formula given for #'sample :dirichlet.") (defmfun dirichlet-log-pdf (alpha theta) "gsl_ran_dirichlet_lnpdf" @@ -84,7 +83,7 @@ (save-test dirichlet (let ((rng (make-random-number-generator +mt19937+ 0)) (alpha #m(1.0d0 2.0d0 3.0d0 4.0d0))) - (cl-array (sample rng 'dirichlet :alpha alpha))) + (cl-array (sample rng :dirichlet :alpha alpha))) (let ((alpha #m(1.0d0 2.0d0 3.0d0 4.0d0)) (theta #m(1.0d0 2.0d0 3.0d0 4.0d0))) (dirichlet-pdf alpha theta)) diff --git a/random/discrete.lisp b/random/discrete.lisp index c0dd53a8ecdee4762721ec6fe33ad9052cc40c91..e7451c7377ae12b38af25c08e2bf996fc65f4e55 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: <2009-12-27 10:00:02EST discrete.lisp> +;; Time-stamp: <2010-01-17 10:10:00EST discrete.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -35,9 +35,8 @@ generally as ``weights'')---the preprocessor will normalize appropriately. This return value is used as an argument to #'discrete.") -(export 'discrete) (defmfun sample - ((generator random-number-generator) (type (eql 'discrete)) + ((generator random-number-generator) (type (eql :discrete)) &key table) "gsl_ran_discrete" (((mpointer generator) :pointer) ((mpointer table) :pointer)) @@ -65,7 +64,7 @@ (rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'discrete :table table))) + (sample rng :discrete :table table))) (let* ((probabilities #m(0.25d0 0.5d0 0.25d0)) (table (make-discrete-random probabilities))) (discrete-pdf 1 table))) diff --git a/random/exponential-power.lisp b/random/exponential-power.lisp index a5f4844893ab0841e136cd8d4d4e10841ac40b24..36f900f17f4db0e35c0e1329ef7e957250061636 100644 --- a/random/exponential-power.lisp +++ b/random/exponential-power.lisp @@ -1,6 +1,6 @@ ;; Exponential power distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:00:02EST exponential-power.lisp> +;; Time-stamp: <2010-01-17 10:11:03EST exponential-power.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'exponential-power) (defmfun sample - ((generator random-number-generator) (type (eql 'exponential-power)) + ((generator random-number-generator) (type (eql :exponential-power)) &key a b) "gsl_ran_exppow" (((mpointer generator) :pointer) (a :double) (b :double)) @@ -45,7 +44,7 @@ :documentation ; FDL "The probability density p(x) at x for an exponential power distribution with scale parameter a - and exponent b, using the formula given for #'exponential-power.") + and exponent b, using the formula given for #'sample :exponential-power.") (defmfun exponential-power-P (x a b) "gsl_cdf_exppow_P" ((x :double) (a :double) (b :double)) @@ -68,7 +67,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'exponential-power :a 1.0d0 :b 2.0d0))) + (sample rng :exponential-power :a 1.0d0 :b 2.0d0))) (exponential-power-pdf 0.0d0 1.0d0 2.0d0) (exponential-power-P 1.0d0 1.0d0 2.0d0) (exponential-power-Q 1.0d0 1.0d0 2.0d0)) diff --git a/random/exponential.lisp b/random/exponential.lisp index 940497f28e3517230d8b859e692d2969b65801c1..cdd84eaed2d405c79b3f43d6cf46f701f4d3d4a8 100644 --- a/random/exponential.lisp +++ b/random/exponential.lisp @@ -1,6 +1,6 @@ ;; Exponential distribution ;; Liam Healy, Sat Sep 2 2006 - 19:04 -;; Time-stamp: <2009-12-27 10:00:02EST exponential.lisp> +;; Time-stamp: <2010-01-17 10:12:00EST exponential.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'exponential) (defmfun sample - ((generator random-number-generator) (type (eql 'exponential)) + ((generator random-number-generator) (type (eql :exponential)) &key mu) "gsl_ran_exponential" (((mpointer generator) :pointer) (mu :double)) @@ -43,7 +42,7 @@ :documentation ; FDL "The probability density p(x) at x for an exponential distribution with mean mu, using the formula - given for exponential.") + given for #'sample :exponential.") (defmfun exponential-P (x mu) "gsl_cdf_exponential_P" ((x :double) (mu :double)) @@ -78,7 +77,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'exponential :mu 10.0d0))) + (sample rng :exponential :mu 10.0d0))) (exponential-pdf 0.0d0 10.0d0) (exponential-p 1.0d0 2.0d0) (exponential-q 1.0d0 2.0d0) diff --git a/random/fdist.lisp b/random/fdist.lisp index cfd22c2fd1d5a009e11621459d1fb1906f30665d..dfbb5fc5bfb6dc2459f97674c805f74099896177 100644 --- a/random/fdist.lisp +++ b/random/fdist.lisp @@ -1,6 +1,6 @@ ;; Fdist distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:00:01EST fdist.lisp> +;; Time-stamp: <2010-01-17 10:12:32EST fdist.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'fdist) (defmfun sample - ((generator random-number-generator) (type (eql 'fdist)) &key nu1 nu2) + ((generator random-number-generator) (type (eql :fdist)) &key nu1 nu2) "gsl_ran_fdist" (((mpointer generator) :pointer) (nu1 :double) (nu2 :double)) :definition :method @@ -46,7 +45,7 @@ :documentation ; FDL "The probability density p(x) at x for an F-distribution with nu1 and nu2 degrees of freedom, - using the formula given #'fdist.") + using the formula given #'sample :fdist.") (defmfun fdist-P (x nu1 nu2) "gsl_cdf_fdist_P" ((x :double) (nu1 :double) (nu2 :double)) @@ -85,7 +84,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'fdist :nu1 1.0d0 :nu2 2.0d0))) + (sample rng :fdist :nu1 1.0d0 :nu2 2.0d0))) (fdist-pdf 1.2d0 1.0d0 2.0d0) (fdist-P 1.2d0 1.0d0 2.0d0) (fdist-Q 1.2d0 1.0d0 2.0d0) diff --git a/random/flat.lisp b/random/flat.lisp index 4841913d3b285cdb1ff9b879d075553ecebf1c51..40cdf39ab5ff77c9121a0e5e5717778dbda1b25c 100644 --- a/random/flat.lisp +++ b/random/flat.lisp @@ -1,6 +1,6 @@ ;; Flat distribution ;; Liam Healy, Oct 7 2006 -;; Time-stamp: <2009-12-27 10:00:01EST flat.lisp> +;; Time-stamp: <2010-01-17 10:13:12EST flat.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'flat) (defmfun sample - ((generator random-number-generator) (type (eql 'flat)) &key a b) + ((generator random-number-generator) (type (eql :flat)) &key a b) "gsl_ran_flat" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -41,7 +40,7 @@ :documentation ; FDL "The probability density p(x) at x for a uniform distribution from a to b, using the formula - given for #'flat.") + given for #'sample :flat.") (defmfun flat-P (x a b) "gsl_cdf_flat_P" ((x :double) (a :double) (b :double)) @@ -76,7 +75,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'flat :a 1.0d0 :b 2.0d0))) + (sample rng :flat :a 1.0d0 :b 2.0d0))) (flat-pdf 1.2d0 1.0d0 2.0d0) (flat-P 1.2d0 1.0d0 2.0d0) (flat-Q 1.2d0 1.0d0 2.0d0) diff --git a/random/gamma.lisp b/random/gamma.lisp index d02a4c401bda5e0e3688b4f8c0ee230f20c71d7a..f2898b6941ea65220b1a88afb671a501acfa727f 100644 --- a/random/gamma.lisp +++ b/random/gamma.lisp @@ -1,6 +1,6 @@ ;; Gamma distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:00:00EST gamma.lisp> +;; Time-stamp: <2010-01-17 10:14:35EST gamma.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'gamma) (defmfun sample - ((generator random-number-generator) (type (eql 'gamma)) &key a b) + ((generator random-number-generator) (type (eql :gamma)) &key a b) "gsl_ran_gamma" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -38,9 +37,8 @@ is known as the Erlang distribution. The variates are computed using the algorithms from Knuth (vol 2).") -(export 'gamma-mt) (defmfun sample - ((generator random-number-generator) (type (eql 'gamma-mt)) &key a b) + ((generator random-number-generator) (type (eql :gamma-mt)) &key a b) "gsl_ran_gamma_mt" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -54,7 +52,7 @@ :documentation ; FDL "The probability density p(x) at x for a gamma distribution with parameters a and b, using the - formula given in #'gamma.") + formula given in #'sample :gamma.") (defmfun gamma-P (x a b) "gsl_cdf_gamma_P" ((x :double) (a :double) (b :double)) @@ -89,11 +87,11 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'gamma :a 1.0d0 :b 2.0d0))) + (sample rng :gamma :a 1.0d0 :b 2.0d0))) (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'gamma-mt :a 1.0d0 :b 2.0d0))) + (sample rng :gamma-mt :a 1.0d0 :b 2.0d0))) (gamma-pdf 0.1d0 1.0d0 2.0d0) (gamma-P 0.1d0 1.0d0 2.0d0) (gamma-Q 0.1d0 1.0d0 2.0d0) diff --git a/random/gaussian-bivariate.lisp b/random/gaussian-bivariate.lisp index 2c72ecd7de8b61ffdc290ecfe3f84e8866056260..50b8e816dedb6de44737dcbbc40340c3f4427665 100644 --- a/random/gaussian-bivariate.lisp +++ b/random/gaussian-bivariate.lisp @@ -1,6 +1,6 @@ ;; Gaussian bivariate distribution ;; Liam Healy, Sat Sep 2 2006 - 16:32 -;; Time-stamp: <2009-12-27 10:00:00EST gaussian-bivariate.lisp> +;; Time-stamp: <2010-01-17 10:15:54EST gaussian-bivariate.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'gaussian-bivariate) (defmfun sample - ((generator random-number-generator) (type (eql 'gaussian-bivariate)) + ((generator random-number-generator) (type (eql :bivariate-gaussian)) &key sigma-x sigma-y rho) "gsl_ran_bivariate_gaussian" (((mpointer generator) :pointer) (sigma-x :double) (sigma-y :double) (rho :double) @@ -52,7 +51,7 @@ "The probability density p(x,y) at (x,y) for a bivariate Gaussian distribution with standard deviations sigma_x, sigma_y and correlation coefficient - rho, using the formula given for bivariate-gaussian.") + rho, using the formula given for #'sample :bivariate-gaussian.") ;;; Examples and unit test (save-test gaussian-bivariate @@ -60,7 +59,7 @@ (loop for i from 0 to 10 collect (sample - rng 'gaussian-bivariate + rng :bivariate-gaussian :sigma-x 1.0d0 :sigma-y 0.75d0 :rho 0.25d0))) (bivariate-gaussian-pdf 0.25d0 0.5d0 0.25d0 0.4d0 0.2d0)) diff --git a/random/gaussian-tail.lisp b/random/gaussian-tail.lisp index f2b0817b5ad9232fa36ca500ab0c501fca709c63..0681bc59d93662828d4b193bc346a5a1d5db5b90 100644 --- a/random/gaussian-tail.lisp +++ b/random/gaussian-tail.lisp @@ -1,6 +1,6 @@ ;; Gaussian tail distribution ;; Liam Healy, Mon Aug 21 2006 - 21:52 -;; Time-stamp: <2009-12-27 10:01:43EST gaussian-tail.lisp> +;; Time-stamp: <2010-01-17 10:17:01EST gaussian-tail.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'gaussian-tail) (defmfun sample - ((generator random-number-generator) (type (eql 'gaussian-tail)) + ((generator random-number-generator) (type (eql :gaussian-tail)) &key a sigma) "gsl_ran_gaussian_tail" (((mpointer generator) :pointer) (a :double) (sigma :double)) @@ -51,9 +50,8 @@ for a Gaussian tail distribution with standard deviation sigma and lower limit a, using the formula given for gaussian-tail.") -(export 'ugaussian-tail) (defmfun sample - ((generator random-number-generator) (type (eql 'ugaussian-tail)) + ((generator random-number-generator) (type (eql :ugaussian-tail)) &key a) "gsl_ran_ugaussian_tail" (((mpointer generator) :pointer) (a :double)) @@ -74,10 +72,10 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'gaussian-tail :a 50.0d0 :sigma 10.0d0))) + (sample rng :gaussian-tail :a 50.0d0 :sigma 10.0d0))) (gaussian-tail-pdf 52.0d0 50.0d0 10.0d0) (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'ugaussian-tail :a 5.0d0))) + (sample rng :ugaussian-tail :a 5.0d0))) (ugaussian-tail-pdf 5.2d0 5.0d0)) diff --git a/random/gaussian.lisp b/random/gaussian.lisp index d714a3d2363d8a74b1b1f6c50aa4eb1242bf85e8..cf2f9d4bf9afb43fa0f1cfa4ca889b5ac5390b6c 100644 --- a/random/gaussian.lisp +++ b/random/gaussian.lisp @@ -1,6 +1,6 @@ ;; Gaussian distribution ;; Liam Healy, Sun Jul 16 2006 - 22:09 -;; Time-stamp: <2009-12-27 10:00:00EST gaussian.lisp> +;; Time-stamp: <2010-01-17 10:19:46EST gaussian.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'gaussian) (defmfun sample - ((generator random-number-generator) (type (eql 'gaussian)) + ((generator random-number-generator) (type (eql :gaussian)) &key sigma) "gsl_ran_gaussian" (((mpointer generator) :pointer) (sigma :double)) @@ -38,7 +37,7 @@ p(x) dx = {1 \over \sqrt{2 \pi \sigma^2}} \exp (-x^2 / 2\sigma^2) dx for x in the range -\infty to +\infty. Use the transformation z = \mu + x on the numbers returned by - #'gaussian to obtain a Gaussian distribution with mean + this function to obtain a Gaussian distribution with mean mu. This function uses the Box-Mueller algorithm which requires two calls to the random number generator r.") @@ -49,9 +48,8 @@ "Compute the probability density p(x) at x for a Gaussian distribution with standard deviation sigma.") -(export 'gaussian-ziggurat) (defmfun sample - ((generator random-number-generator) (type (eql 'gaussian-ziggurat)) + ((generator random-number-generator) (type (eql :gaussian-ziggurat)) &key sigma) "gsl_ran_gaussian_ziggurat" (((mpointer generator) :pointer) (sigma :double)) @@ -62,9 +60,8 @@ Marsaglia-Tsang ziggurat method. The Ziggurat algorithm is the fastest available algorithm in most cases.") -(export 'gaussian-ratio-method) (defmfun sample - ((generator random-number-generator) (type (eql 'gaussian-ratio-method)) + ((generator random-number-generator) (type (eql :gaussian-ratio-method)) &key sigma) "gsl_ran_gaussian_ratio_method" (((mpointer generator) :pointer) (sigma :double)) @@ -74,16 +71,15 @@ "Compute a Gaussian random variate using the Kinderman-Monahan-Leva ratio method.") -(export 'ugaussian) (defmfun sample - ((generator random-number-generator) (type (eql 'ugaussian)) &key) + ((generator random-number-generator) (type (eql :ugaussian)) &key) "gsl_ran_ugaussian" (((mpointer generator) :pointer)) :definition :method :c-return :double :documentation ; FDL "Compute results for the unit Gaussian distribution, - equivalent to the #'gaussian with a standard deviation of one, - sigma = 1.") + equivalent to the #'sample :gaussian with a standard deviation of + one, sigma = 1.") (defmfun ugaussian-pdf (x) "gsl_ran_ugaussian_pdf" ((x :double)) @@ -93,9 +89,8 @@ equivalent to the #'gaussian-pdf with a standard deviation of one, sigma = 1.") -(export 'ugaussian-ratio-method) (defmfun sample - ((generator random-number-generator) (type (eql 'ugaussian-ratio-method)) + ((generator random-number-generator) (type (eql :ugaussian-ratio-method)) &key) "gsl_ran_ugaussian_ratio_method" (((mpointer generator) :pointer)) @@ -103,8 +98,8 @@ :c-return :double :documentation ; FDL "Compute results for the unit Gaussian distribution, - equivalent to the #'gaussian-ration-method with a - standard deviation of one, sigma = 1.") + equivalent to the #'sample :gaussian-ration-method with a standard + deviation of one, sigma = 1.") (defmfun gaussian-P (x sigma) "gsl_cdf_gaussian_P" ((x :double) (sigma :double)) @@ -168,12 +163,12 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'gaussian :sigma 10.0d0))) + (sample rng :gaussian :sigma 10.0d0))) (gaussian-pdf 0.0d0 10.0d0) (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'gaussian-ziggurat :sigma 10.0d0))) + (sample rng :gaussian-ziggurat :sigma 10.0d0))) ;; Given in examples in GSL documentation (ugaussian-p 2.0d0) (ugaussian-q 2.0d0) diff --git a/random/generators.lisp b/random/generators.lisp index 5e2f968302ee859d38a27bdfededd8edf251e568..1038e80a07ca9df46327cac8ed7763c9732a28bf 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: <2009-12-27 10:01:42EST generators.lisp> +;; Time-stamp: <2010-01-17 10:21:31EST generators.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -77,8 +77,7 @@ (:documentation "Sample from the probability distribution.")) -(export 'uniform) -(defmfun sample ((source random-number-generator) (type (eql 'uniform)) &key) +(defmfun sample ((source random-number-generator) (type (eql :uniform)) &key) "gsl_rng_uniform" (((mpointer source) :pointer)) :definition :method :c-return :double @@ -92,8 +91,7 @@ (the maximum number of bits that can be portably represented in a single :ulong.") -(export 'uniform>0) -(defmfun sample ((source random-number-generator) (type (eql 'uniform>0)) &key) +(defmfun sample ((source random-number-generator) (type (eql :uniform>0)) &key) "gsl_rng_uniform_pos" (((mpointer source) :pointer)) :definition :method :c-return :double @@ -104,9 +102,8 @@ type 'uniform until a non-zero value is obtained. You can use this function if you need to avoid a singularity at 0.0.") -(export 'uniform-fixnum) (defmfun sample - ((source random-number-generator) (type (eql 'uniform-fixnum)) + ((source random-number-generator) (type (eql :uniform-fixnum)) &key upperbound) "gsl_rng_uniform_int" (((mpointer source) :pointer) (upperbound :ulong)) @@ -205,6 +202,6 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'uniform-fixnum :upperbound 1000))) + (sample rng :uniform-fixnum :upperbound 1000))) (let ((rng (make-random-number-generator *cmrg* 0))) (loop for i from 0 to 10 collect (sample rng 'uniform)))) diff --git a/random/geometric.lisp b/random/geometric.lisp index e38106bd29687c5a7bd8c7c28c27ac51f0cd1745..ee146242ac834ae5913d4fe46c5dc7a42463cf9c 100644 --- a/random/geometric.lisp +++ b/random/geometric.lisp @@ -1,6 +1,6 @@ ;; Geometric distribution ;; Liam Healy, Sat Nov 25 2006 - 16:00 -;; Time-stamp: <2009-12-27 10:01:43EST geometric.lisp> +;; Time-stamp: <2010-01-17 10:22:14EST geometric.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'geometric) (defmfun sample - ((generator random-number-generator) (type (eql 'geometric)) + ((generator random-number-generator) (type (eql :geometric)) &key probability) "gsl_ran_geometric" (((mpointer generator) :pointer) (probability :double)) @@ -45,7 +44,7 @@ :documentation ; FDL "The probability p(k) of obtaining k from a geometric distribution with probability parameter p, using - the formula given in #'geometric.") + the formula given in #'sample :geometric.") (defmfun geometric-P (k p) "gsl_cdf_geometric_P" ((k :uint) (p :double)) @@ -66,7 +65,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'geometric :probability 0.4d0))) + (sample rng :geometric :probability 0.4d0))) (geometric-pdf 2 0.4d0) (geometric-P 2 0.4d0) (geometric-Q 2 0.4d0)) diff --git a/random/gumbel1.lisp b/random/gumbel1.lisp index fe33b907c99a990a81d7e88012669f3df7ccf2a1..793d8fe2ebe41ce81202fd595ae892cffaaf3185 100644 --- a/random/gumbel1.lisp +++ b/random/gumbel1.lisp @@ -1,6 +1,6 @@ ;; The Gumbel type 1 random number distribution ;; Liam Healy, Sun Oct 29 2006 -;; Time-stamp: <2009-12-27 10:01:41EST gumbel1.lisp> +;; Time-stamp: <2010-01-17 10:22:56EST gumbel1.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'geometric) (defmfun sample - ((generator random-number-generator) (type (eql 'gumbel1)) &key a b) + ((generator random-number-generator) (type (eql :gumbel1)) &key a b) "gsl_ran_gumbel1" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -42,7 +41,7 @@ :documentation ; FDL "The probability density p(x) at x for a Type-1 Gumbel distribution with parameters a and b, - using the formula given for #'gumbel1.") + using the formula given for #'sample :gumbel1.") (defmfun gumbel1-P (x a b) "gsl_cdf_gumbel1_P" ((x :double) (a :double) (b :double)) @@ -80,7 +79,7 @@ (save-test gumbel1 (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 - collect (sample rng 'gumbel1 :a 1.0d0 :b 2.0d0))) + collect (sample rng :gumbel1 :a 1.0d0 :b 2.0d0))) (gumbel1-pdf 0.1d0 1.0d0 2.0d0) (gumbel1-P 0.1d0 1.0d0 2.0d0) (gumbel1-Q 0.1d0 1.0d0 2.0d0) diff --git a/random/gumbel2.lisp b/random/gumbel2.lisp index ea692184c08ae63136252ed3de9c363f48383673..87ed32174e4e778f9495622238786f343e4c2618 100644 --- a/random/gumbel2.lisp +++ b/random/gumbel2.lisp @@ -1,6 +1,6 @@ ;; The Gumbel type 2 random number distribution ;; Liam Healy, Sun Oct 29 2006 -;; Time-stamp: <2009-12-27 10:01:40EST gumbel2.lisp> +;; Time-stamp: <2010-01-17 10:23:29EST gumbel2.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'gumbel2) (defmfun sample - ((generator random-number-generator) (type (eql 'gumbel2)) &key a b) + ((generator random-number-generator) (type (eql :gumbel2)) &key a b) "gsl_ran_gumbel2" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -41,7 +40,7 @@ :documentation ; FDL "The probability density p(x) at x for a Type-2 Gumbel distribution with parameters a and b, - using the formula given in #'gumbel2.") + using the formula given in #'sample :gumbel2.") (defmfun gumbel2-P (x a b) "gsl_cdf_gumbel2_P" ((x :double) (a :double) (b :double)) @@ -79,7 +78,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'gumbel2 :a 1.0d0 :b 2.0d0))) + (sample rng :gumbel2 :a 1.0d0 :b 2.0d0))) (gumbel2-pdf 5.0d0 1.0d0 2.0d0) (gumbel2-P 10.0d0 1.0d0 2.0d0) (gumbel2-Q 10.0d0 1.0d0 2.0d0) diff --git a/random/hypergeometric.lisp b/random/hypergeometric.lisp index a307cea408ac8e06289df5e0269a2f761b1abf65..a00c991ea41c03b276a07e0613d286c2fdeef24c 100644 --- a/random/hypergeometric.lisp +++ b/random/hypergeometric.lisp @@ -1,6 +1,6 @@ ;; Hypergeometric distribution ;; Liam Healy, Sat Nov 25 2006 - 16:00 -;; Time-stamp: <2009-12-27 10:03:54EST hypergeometric.lisp> +;; Time-stamp: <2010-01-17 10:24:31EST hypergeometric.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'hypergeometric) (defmfun sample - ((generator random-number-generator) (type (eql 'hypergeometric)) + ((generator random-number-generator) (type (eql :hypergeometric)) &key n1 n2 tt) "gsl_ran_hypergeometric" (((mpointer generator) :pointer) (n1 :uint) (n2 :uint)(tt :uint)) @@ -51,7 +50,7 @@ :documentation ; FDL "The probability p(k) of obtaining k from a hypergeometric distribution with parameters n1, n2, - tt, using the formula given in #'hypergeometric.") + tt, using the formula given in #'sample :hypergeometric.") (defmfun hypergeometric-P (k n1 n2 tt) "gsl_cdf_hypergeometric_P" ((k :uint) (n1 :uint) (n2 :uint)(tt :uint)) @@ -72,7 +71,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'hypergeometric :n1 3 :n2 6 :tt 3))) + (sample rng :hypergeometric :n1 3 :n2 6 :tt 3))) (hypergeometric-pdf 0 2 6 3) (hypergeometric-P 1 2 6 3) (hypergeometric-Q 1 2 6 3)) diff --git a/random/landau.lisp b/random/landau.lisp index 087775a786f1246ada57aef01df1ee4e8f837fa5..409f65b7c4785ef6bfc09977d9a65e686bd3d169 100644 --- a/random/landau.lisp +++ b/random/landau.lisp @@ -1,6 +1,6 @@ ;; Landau distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:03:54EST landau.lisp> +;; Time-stamp: <2010-01-17 10:24:59EST landau.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'landau) (defmfun sample - ((generator random-number-generator) (type (eql 'landau)) &key) + ((generator random-number-generator) (type (eql :landau)) &key) "gsl_ran_landau" (((mpointer generator) :pointer)) :definition :method @@ -44,11 +43,11 @@ :documentation ; FDL "The probability density p(x) at x for the Landau distribution using an approximation to the formula given - in #'landau.") + in #'sample :landau.") ;;; Examples and unit test (save-test landau (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 - collect (sample rng 'landau))) + collect (sample rng :landau))) (landau-pdf 0.25d0)) diff --git a/random/laplace.lisp b/random/laplace.lisp index a8d7d37694b8a3e4e05f78538878dd8007a05ecf..b44f03d5320a5bf22b2a97db077b3b0936f0ec0b 100644 --- a/random/laplace.lisp +++ b/random/laplace.lisp @@ -1,6 +1,6 @@ ;; Exponential distribution ;; Liam Healy, Sun Sep 17 2006 -;; Time-stamp: <2009-12-27 10:03:53EST laplace.lisp> +;; Time-stamp: <2010-01-17 10:25:36EST laplace.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'laplace) (defmfun sample - ((generator random-number-generator) (type (eql 'laplace)) &key a) + ((generator random-number-generator) (type (eql :laplace)) &key a) "gsl_ran_laplace" (((mpointer generator) :pointer) (a :double)) :definition :method @@ -42,7 +41,7 @@ :documentation ; FDL "The probability density p(x) at x for a Laplace distribution with width a, using the formula - given for #'laplace.") + given for #'sample :laplace.") (defmfun laplace-P (x a) "gsl_cdf_laplace_P" ((x :double) (a :double)) @@ -77,7 +76,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'laplace :a 10.0d0))) + (sample rng :laplace :a 10.0d0))) (laplace-pdf 0.0d0 10.0d0) (laplace-p 1.0d0 2.0d0) (laplace-q 1.0d0 2.0d0) diff --git a/random/levy.lisp b/random/levy.lisp index 9a9589b805cfd0ec6e9cdbc8a0bae10984eeb42a..8bf0f646709541330a4ac700f337bfea7ad08ed6 100644 --- a/random/levy.lisp +++ b/random/levy.lisp @@ -1,6 +1,6 @@ ;; Levy distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:03:53EST levy.lisp> +;; Time-stamp: <2010-01-17 10:26:16EST levy.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'levy) (defmfun sample - ((generator random-number-generator) (type (eql 'levy)) &key c alpha) + ((generator random-number-generator) (type (eql :levy)) &key c alpha) "gsl_ran_levy" (((mpointer generator) :pointer) (c :double) (alpha :double)) :definition :method @@ -41,9 +40,8 @@ For \alpha < 1 the tails of the distribution become extremely wide. The algorithm only works for 0 < alpha <= 2.") -(export 'levy-skew) (defmfun sample - ((generator random-number-generator) (type (eql 'levy-skew)) + ((generator random-number-generator) (type (eql :levy-skew)) &key c alpha beta) "gsl_ran_levy_skew" (((mpointer generator) :pointer) (c :double) (alpha :double) (beta :double)) @@ -71,8 +69,8 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'levy :c 1.0d0 :alpha 2.0d0))) + (sample rng :levy :c 1.0d0 :alpha 2.0d0))) (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'levy-skew :c 1.0d0 :alpha 2.0d0 :beta 1.0d0)))) + (sample rng :levy-skew :c 1.0d0 :alpha 2.0d0 :beta 1.0d0)))) diff --git a/random/logarithmic.lisp b/random/logarithmic.lisp index d8999ef6f0254d26553c6f9eca71f534784ff497..0df7a8d00f0da135b97fc291bb67f4ea426e0491 100644 --- a/random/logarithmic.lisp +++ b/random/logarithmic.lisp @@ -1,6 +1,6 @@ ;; Logarithmic distribution ;; Liam Healy, Sat Nov 25 2006 - 16:00 -;; Time-stamp: <2009-12-27 10:03:53EST logarithmic.lisp> +;; Time-stamp: <2010-01-17 10:26:45EST logarithmic.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'logarithmic) (defmfun sample - ((generator random-number-generator) (type (eql 'logarithmic)) + ((generator random-number-generator) (type (eql :logarithmic)) &key probability) "gsl_ran_logarithmic" (((mpointer generator) :pointer) (probability :double)) @@ -42,12 +41,12 @@ :documentation "The probability p(k) of obtaining k from a logarithmic distribution with probability parameter p, - using the formula given in #'logarithmic.") + using the formula given in #'sample :logarithmic.") ;;; Examples and unit test (save-test logarithmic (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'logarithmic :probability 0.9d0))) + (sample rng :logarithmic :probability 0.9d0))) (logarithmic-pdf 2 0.4d0)) diff --git a/random/logistic.lisp b/random/logistic.lisp index b2ec5b52e96bbe88429209b60a43c29c990c4d5a..2a1b1212af3c7128027d82ef10d02775dc035799 100644 --- a/random/logistic.lisp +++ b/random/logistic.lisp @@ -1,6 +1,6 @@ ;; Logistic distribution ;; Liam Healy, Sat Oct 7 2006 - 16:13 -;; Time-stamp: <2009-12-27 10:03:53EST logistic.lisp> +;; Time-stamp: <2010-01-17 10:27:24EST logistic.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'logistic) (defmfun sample - ((generator random-number-generator) (type (eql 'logistic)) &key a) + ((generator random-number-generator) (type (eql :logistic)) &key a) "gsl_ran_logistic" (((mpointer generator) :pointer) (a :double)) :definition :method @@ -41,7 +40,7 @@ :documentation ; FDL "The probability density p(x) at x for a logistic distribution with scale parameter a, using the - formula given in #'logistic.") + formula given in #'sample :logistic.") (defmfun logistic-P (x a) "gsl_cdf_logistic_P" ((x :double) (a :double)) @@ -76,7 +75,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'logistic :a 10.0d0))) + (sample rng :logistic :a 10.0d0))) (logistic-pdf 0.5d0 1.0d0) (logistic-P 0.5d0 1.0d0) (logistic-Q 0.5d0 1.0d0) diff --git a/random/lognormal.lisp b/random/lognormal.lisp index 6594532010509ce87e3381f993e30ff6ad10b672..933309c23010ee859aa4c7ed6943e024fe99191a 100644 --- a/random/lognormal.lisp +++ b/random/lognormal.lisp @@ -1,6 +1,6 @@ ;; Lognormal distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:03:52EST lognormal.lisp> +;; Time-stamp: <2010-01-17 10:27:47EST lognormal.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -20,9 +20,8 @@ (in-package :gsl) -(export 'lognormal) (defmfun sample - ((generator random-number-generator) (type (eql 'lognormal)) + ((generator random-number-generator) (type (eql :lognormal)) &key zeta sigma) "gsl_ran_lognormal" (((mpointer generator) :pointer) (zeta :double) (sigma :double)) @@ -40,7 +39,7 @@ :documentation ; FDL "The probability density p(x) at X for a lognormal distribution with parameters zeta and sigma, - using the formula given in #'lognormal.") + using the formula given in #'sample :lognormal.") (defmfun lognormal-P (x zeta sigma) "gsl_cdf_lognormal_P" ((x :double) (zeta :double) (sigma :double)) @@ -78,7 +77,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'lognormal :zeta 1.0d0 :sigma 2.0d0))) + (sample rng :lognormal :zeta 1.0d0 :sigma 2.0d0))) (lognormal-pdf 1.2d0 1.0d0 2.0d0) (lognormal-P 1.2d0 1.0d0 2.0d0) (lognormal-Q 1.2d0 1.0d0 2.0d0) diff --git a/random/multinomial.lisp b/random/multinomial.lisp index 24336b8c0c390b7cacaed5b519686ee81884a696..6af8b3a288c4dc1d03a495a1cdae7e5d2c12fb5e 100644 --- a/random/multinomial.lisp +++ b/random/multinomial.lisp @@ -1,6 +1,6 @@ ;; Multinomial distribution ;; Liam Healy, Sat Nov 25 2006 - 16:00 -;; Time-stamp: <2009-12-27 10:03:52EST multinomial.lisp> +;; Time-stamp: <2010-01-17 10:28:22EST multinomial.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'multinomial) (defmfun sample - ((generator random-number-generator) (type (eql 'multinomial)) + ((generator random-number-generator) (type (eql :multinomial)) &key sum probabilities (n (make-marray '(signed-byte 32) :dimensions (dim0 probabilities)))) @@ -63,7 +62,7 @@ :documentation ; FDL "Compute the probability P(n_1, n_2, ..., n_K) of sampling n[K] from a multinomial distribution - with parameters p[K], using the formula given for #'multinomial.") + with parameters p[K], using the formula given for #'sample :multinomial.") (defmfun multinomial-log-pdf (p n) "gsl_ran_multinomial_lnpdf" @@ -73,13 +72,13 @@ :documentation ; FDL "Compute the natural logarithm of the probability P(n_1, n_2, ..., n_K) of sampling n[K] from a multinomial distribution - with parameters p[K], using the formula given for #'multinomial.") + with parameters p[K], using the formula given for #'sample :multinomial.") ;;; Examples and unit test (save-test multinomial (let ((rng (make-random-number-generator +mt19937+ 0)) (p #m(0.1d0 0.2d0 0.3d0 0.4d0))) - (cl-array (sample rng 'multinomial :sum 8 :probabilities p))) + (cl-array (sample rng :multinomial :sum 8 :probabilities p))) (let ((p #m(0.1d0 0.2d0 0.3d0 0.4d0)) (n #31m(5 0 1 2))) (multinomial-pdf p N)) diff --git a/random/negative-binomial.lisp b/random/negative-binomial.lisp index bddcb66f87b994607e142373de36758f3fe9f3a9..397ed56039776b45da40006cb2a521057e724ddb 100644 --- a/random/negative-binomial.lisp +++ b/random/negative-binomial.lisp @@ -1,6 +1,6 @@ ;; Negative binomial and Pascal distributions ;; Liam Healy, Sat Nov 25 2006 - 16:00 -;; Time-stamp: <2009-12-27 10:03:52EST negative-binomial.lisp> +;; Time-stamp: <2010-01-17 10:29:42EST negative-binomial.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -26,9 +26,8 @@ ;;;; Negative binomial ;;;;**************************************************************************** -(export 'negative-binomial) (defmfun sample - ((generator random-number-generator) (type (eql 'negative-binomial)) + ((generator random-number-generator) (type (eql :negative-binomial)) &key probability n) "gsl_ran_negative_binomial" (((mpointer generator) :pointer) (probability :double) (n :double)) @@ -49,7 +48,7 @@ :documentation ; FDL "The probability p(k) of obtaining k from a negative binomial distribution with parameters p and - n, using the formula given in #'negative-binomial.") + n, using the formula given in #'sample :negative-binomial.") (defmfun negative-binomial-P (k p n) "gsl_cdf_negative_binomial_P" ((k :uint) (p :double) (n :double)) @@ -71,9 +70,8 @@ ;;;; Pascal ;;;;**************************************************************************** -(export 'pascal) (defmfun sample - ((generator random-number-generator) (type (eql 'pascal)) + ((generator random-number-generator) (type (eql :pascal)) &key probability n) "gsl_ran_pascal" (((mpointer generator) :pointer) (probability :double) (n :uint)) @@ -92,7 +90,7 @@ :documentation ; FDL "The probability p(k) of obtaining k from a Pascal distribution with parameters p and - n, using the formula given in #'pascal.") + n, using the formula given in #'sample :pascal.") (defmfun pascal-P (k p n) "gsl_cdf_pascal_P" ((k :uint) (p :double) (n :uint)) @@ -118,14 +116,14 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'negative-binomial :probability 0.4d0 :n 12.0d0))) + (sample rng :negative-binomial :probability 0.4d0 :n 12.0d0))) (negative-binomial-pdf 5 0.4d0 12.0d0) (negative-binomial-P 5 0.4d0 12.0d0) (negative-binomial-Q 5 0.4d0 12.0d0) (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'pascal :probability 0.4d0 :n 12))) + (sample rng :pascal :probability 0.4d0 :n 12))) (pascal-pdf 5 0.4d0 12) (pascal-P 5 0.4d0 12) (pascal-Q 5 0.4d0 12)) diff --git a/random/pareto.lisp b/random/pareto.lisp index d5dea2be9e344c6c2548916307c43a04d9a0d8c4..bc7641446e33ac2ec014400077a684a2b233be45 100644 --- a/random/pareto.lisp +++ b/random/pareto.lisp @@ -1,6 +1,6 @@ ;; Pareto distribution ;; Liam Healy, Sat Oct 8 2006 - 21:23 -;; Time-stamp: <2009-12-27 10:03:51EST pareto.lisp> +;; Time-stamp: <2010-01-17 10:30:11EST pareto.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'pareto) (defmfun sample - ((generator random-number-generator) (type (eql 'pareto)) &key a b) + ((generator random-number-generator) (type (eql :pareto)) &key a b) "gsl_ran_pareto" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -42,7 +41,7 @@ :documentation ; FDL "The probability density p(x) at x for a Pareto distribution with exponent a and scale b, using - the formula given in #'pareto.") + the formula given in #'sample :pareto.") (defmfun pareto-P (x a b) "gsl_cdf_pareto_P" ((x :double) (a :double) (b :double)) @@ -77,7 +76,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'pareto :a 1.0d0 :b 2.0d0))) + (sample rng :pareto :a 1.0d0 :b 2.0d0))) (pareto-pdf 1.5d0 1.3d0 1.0d0) (pareto-P 3.5d0 1.3d0 2.0d0) (pareto-Q 3.5d0 1.3d0 2.0d0) diff --git a/random/poisson.lisp b/random/poisson.lisp index 36c512d2fa704f6d378ec626c9558772ec104771..80012e03ec52f27e3d2ce9d6f6477b74bce2c610 100644 --- a/random/poisson.lisp +++ b/random/poisson.lisp @@ -1,6 +1,6 @@ ;; Poisson distribution ;; Liam Healy, Sat Nov 25 2006 - 16:00 -;; Time-stamp: <2009-12-27 10:03:51EST poisson.lisp> +;; Time-stamp: <2010-01-17 10:30:48EST poisson.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'poisson) (defmfun sample - ((generator random-number-generator) (type (eql 'poisson)) &key mu) + ((generator random-number-generator) (type (eql :poisson)) &key mu) "gsl_ran_poisson" (((mpointer generator) :pointer) (mu :double)) :definition :method @@ -42,7 +41,7 @@ :documentation ; FDL "The probability p(k) of obtaining k from a Poisson distribution with mean mu using the formula - given in #'poisson.") + given in #'sample :poisson.") (defmfun poisson-P (k mu) "gsl_cdf_poisson_P" ((k :uint) (mu :double)) @@ -63,7 +62,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'poisson :mu 10.0d0))) + (sample rng :poisson :mu 10.0d0))) (poisson-pdf 8 10.0d0) (poisson-P 8 10.0d0) (poisson-Q 8 10.0d0)) diff --git a/random/rayleigh-tail.lisp b/random/rayleigh-tail.lisp index 3416606934c02f7b2865cd5c6031016ae3928dc3..3de5d4258c82af50a5970f88466ad337d05cdde2 100644 --- a/random/rayleigh-tail.lisp +++ b/random/rayleigh-tail.lisp @@ -1,6 +1,6 @@ ;; Rayleigh tail distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:03:50EST rayleigh-tail.lisp> +;; Time-stamp: <2010-01-17 10:31:22EST rayleigh-tail.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'rayleigh-tail) (defmfun sample - ((generator random-number-generator) (type (eql 'rayleigh-tail)) + ((generator random-number-generator) (type (eql :rayleigh-tail)) &key a sigma) "gsl_ran_rayleigh_tail" (((mpointer generator) :pointer) (a :double) (sigma :double)) @@ -43,11 +42,11 @@ :documentation ; FDL "The probability density p(x) at x for a Rayleigh tail distribution with scale parameter sigma and - lower limit a, using the formula given in #'rayleigh-tail.") + lower limit a, using the formula given in #'sample :rayleigh-tail.") ;;; Examples and unit test (save-test rayleigh-tail (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 - collect (sample rng 'rayleigh-tail :a 1.0d0 :sigma 10.0d0))) + collect (sample rng :rayleigh-tail :a 1.0d0 :sigma 10.0d0))) (rayleigh-tail-pdf 0.25d0 -2.0d0 2.0d0)) diff --git a/random/rayleigh.lisp b/random/rayleigh.lisp index e68fefa8cdc9eadb57af05320a825be99bd9daa0..9cb900bd15912d42a5f54b7ec443fadd3d229121 100644 --- a/random/rayleigh.lisp +++ b/random/rayleigh.lisp @@ -1,6 +1,6 @@ ;; Rayleigh distribution ;; Liam Healy, Sat Sep 30 2006 -;; Time-stamp: <2009-12-27 10:03:51EST rayleigh.lisp> +;; Time-stamp: <2010-01-17 10:31:48EST rayleigh.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'rayleigh) (defmfun sample - ((generator random-number-generator) (type (eql 'rayleigh)) + ((generator random-number-generator) (type (eql :rayleigh)) &key sigma) "gsl_ran_rayleigh" (((mpointer generator) :pointer) (sigma :double)) @@ -42,7 +41,7 @@ :documentation ; FDL "The probability density p(x) at x for a Rayleigh distribution with scale parameter sigma, using the - formula given for #'rayleigh.") + formula given for #'sample :rayleigh.") (defmfun rayleigh-P (x sigma) "gsl_cdf_rayleigh_P" ((x :double) (sigma :double)) @@ -81,7 +80,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'rayleigh :sigma 10.0d0))) + (sample rng :rayleigh :sigma 10.0d0))) (rayleigh-pdf 0.5d0 1.0d0) (rayleigh-P 1.0d0 2.0d0) (rayleigh-Q 1.0d0 2.0d0) diff --git a/random/shuffling-sampling.lisp b/random/shuffling-sampling.lisp index fc26b09d4c4f49b8452417378015e056fa8c0c7b..83a248ce3a9f00a38f74a443761c96082941c846 100644 --- a/random/shuffling-sampling.lisp +++ b/random/shuffling-sampling.lisp @@ -1,6 +1,6 @@ ;; Shuffling and sampling ;; Liam Healy, Sat Dec 2 2006 - 18:40 -;; Time-stamp: <2009-12-27 10:03:50EST shuffling-sampling.lisp> +;; Time-stamp: <2010-01-17 10:33:13EST shuffling-sampling.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; These are currently defined only for vectors. -(export 'shuffle) (defmfun sample - ((generator random-number-generator) (type (eql 'shuffle)) + ((generator random-number-generator) (type (eql :shuffle)) &key base) "gsl_ran_shuffle" (((mpointer generator) :pointer) @@ -41,9 +40,8 @@ permutations with equal probability, assuming a perfect source of random numbers.") -(export 'choose-random) (defmfun sample - ((generator random-number-generator) (type (eql 'choose-random)) + ((generator random-number-generator) (type (eql :choose-random)) &key src (dest (dim0 src)) &aux (destarr @@ -68,11 +66,10 @@ only appear once in destarr[k]. It is required that k be less than or equal to n. The objects in destarr will be in the same relative order as those in src. You will need to call - with 'shuffle if you want to randomize the order.") + with :shuffle if you want to randomize the order.") -(export 'random-sample) (defmfun sample - ((generator random-number-generator) (type (eql 'random-sample)) + ((generator random-number-generator) (type (eql :random-sample)) &key src (dest (dim0 src)) &aux (destarr @@ -88,20 +85,19 @@ :outputs (destarr) :c-return :void :documentation - "Like #'choose-random, but samples k items - from the original array of n items src with replacement, so - the same object can appear more than once in the output sequence - dest. There is no requirement that k be less than n - in this case.") + "Like :choose-random, but samples k items from the original array of + n items src with replacement, so the same object can appear more + than once in the output sequence dest. There is no requirement + that k be less than n in this case.") ;;; Examples and unit test (save-test shuffling-sampling (let ((rng (make-random-number-generator +mt19937+ 0)) (v1 #31m(1 2 3 4 5 6 7 8))) - (cl-array (sample rng 'shuffle :base v1))) + (cl-array (sample rng :shuffle :base v1))) (let ((rng (make-random-number-generator +mt19937+ 0)) (v1 #31m(1 2 3 4 5 6 7 8))) - (cl-array (sample rng 'choose-random :src v1 :dest 4))) + (cl-array (sample rng :choose-random :src v1 :dest 4))) (let ((rng (make-random-number-generator +mt19937+ 0)) (v1 #31m(1 2 3 4 5 6 7 8))) - (cl-array (sample rng 'random-sample :src v1 :dest 10)))) + (cl-array (sample rng :random-sample :src v1 :dest 10)))) diff --git a/random/spherical-vector.lisp b/random/spherical-vector.lisp index 0fa5533a1538a93b1bb7f1dc9dde4101f600f75b..249844ad0c1e3f0770754ff1103ee90b3d686d05 100644 --- a/random/spherical-vector.lisp +++ b/random/spherical-vector.lisp @@ -1,6 +1,6 @@ ;; Spherical Vector distribution ;; Liam Healy, Sun Oct 22 2006 -;; Time-stamp: <2009-12-27 10:03:49EST spherical-vector.lisp> +;; Time-stamp: <2010-01-17 10:35:25EST spherical-vector.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -24,9 +24,8 @@ ;;; No test for #'direction-Nd yet. -(export 'direction-2d) (defmfun sample - ((generator random-number-generator) (type (eql 'direction-2d)) &key) + ((generator random-number-generator) (type (eql :direction-2d)) &key) "gsl_ran_dir_2d" (((mpointer generator) :pointer) (x (:pointer :double)) (y (:pointer :double))) @@ -37,9 +36,8 @@ two dimensions. The vector is normalized such that |v|^2 = x^2 + y^2 = 1.") -(export 'direction-2d-trig-method) (defmfun sample - ((generator random-number-generator) (type (eql 'direction-2d-trig-method)) &key) + ((generator random-number-generator) (type (eql :direction-2d-trig-method)) &key) "gsl_ran_dir_2d_trig_method" (((mpointer generator) :pointer) (x (:pointer :double)) (y (:pointer :double))) @@ -50,9 +48,8 @@ two dimensions. The vector is normalized such that |v|^2 = x^2 + y^2 = 1. Uses trigonometric functions.") -(export 'direction-3d) (defmfun sample - ((generator random-number-generator) (type (eql 'direction-3d)) &key) + ((generator random-number-generator) (type (eql :direction-3d)) &key) "gsl_ran_dir_3d" (((mpointer generator) :pointer) (x (:pointer :double)) (y (:pointer :double)) (z (:pointer :double))) @@ -67,9 +64,8 @@ projected along any axis is actually uniform (this is only true for 3 dimensions).") -(export 'direction-Nd) (defmfun sample - ((generator random-number-generator) (type (eql 'direction-Nd)) &key vector) + ((generator random-number-generator) (type (eql :direction-Nd)) &key vector) "gsl_ran_dir_nd" (((mpointer generator) :pointer) ((dim0 vector) sizet) ((c-pointer vector) :pointer)) @@ -92,12 +88,12 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 4 append - (multiple-value-list (sample rng 'direction-2d)))) + (multiple-value-list (sample rng :direction-2d)))) (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 4 append - (multiple-value-list (sample rng 'direction-2d-trig-method)))) + (multiple-value-list (sample rng :direction-2d-trig-method)))) (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 2 append - (multiple-value-list (sample rng 'direction-3d))))) + (multiple-value-list (sample rng :direction-3d))))) diff --git a/random/tdist.lisp b/random/tdist.lisp index 804b7311588c1798d15b4ed6d61db4421d78b9af..735302b0f6916ff5166dbd44ed412724db981cd2 100644 --- a/random/tdist.lisp +++ b/random/tdist.lisp @@ -1,6 +1,6 @@ ;; Tdist distribution ;; Liam Healy, Sat Oct 7 2006 - 16:13 -;; Time-stamp: <2009-12-27 10:03:49EST tdist.lisp> +;; Time-stamp: <2010-01-17 10:36:02EST tdist.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -22,9 +22,8 @@ ;;; /usr/include/gsl/gsl_randist.h -(export 'tdist) (defmfun sample - ((generator random-number-generator) (type (eql 'tdist)) &key nu) + ((generator random-number-generator) (type (eql :tdist)) &key nu) "gsl_ran_tdist" (((mpointer generator) :pointer) (nu :double)) :definition :method @@ -42,7 +41,7 @@ :documentation ; FDL "The probability density p(x) at x for a t-distribution with nu degrees of freedom, using the formula - given in #'tdist.") + given in #'sample :tdist.") (defmfun tdist-P (x nu) "gsl_cdf_tdist_P" ((x :double) (nu :double)) @@ -77,7 +76,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'tdist :nu 10.0d0))) + (sample rng :tdist :nu 10.0d0))) (tdist-pdf 0.5d0 1.0d0) (tdist-P 0.5d0 1.0d0) (tdist-Q 0.5d0 1.0d0) diff --git a/random/weibull.lisp b/random/weibull.lisp index 82dce05a7ff35a023e71e3e3aecae672dbe19389..52a51eaddfdec4dd8911da89d61a175b0f20c43d 100644 --- a/random/weibull.lisp +++ b/random/weibull.lisp @@ -1,6 +1,6 @@ ;; Weibull distribution ;; Liam Healy, Sun Oct 22 2006 -;; Time-stamp: <2009-12-27 10:03:49EST weibull.lisp> +;; Time-stamp: <2010-01-17 10:36:26EST weibull.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,9 +23,8 @@ ;;; /usr/include/gsl/gsl_randist.h ;;; /usr/include/gsl/gsl_cdf.h -(export 'weibull) (defmfun sample - ((generator random-number-generator) (type (eql 'weibull)) &key a b) + ((generator random-number-generator) (type (eql :weibull)) &key a b) "gsl_ran_weibull" (((mpointer generator) :pointer) (a :double) (b :double)) :definition :method @@ -41,7 +40,7 @@ :documentation ; FDL "The probability density p(x) at x for a Weibull distribution with scale a and exponent b, - using the formula given in #'weibull.") + using the formula given in #'sample :weibull.") (defmfun weibull-P (x a b) "gsl_cdf_weibull_P" ((x :double) (a :double) (b :double)) @@ -76,7 +75,7 @@ (let ((rng (make-random-number-generator +mt19937+ 0))) (loop for i from 0 to 10 collect - (sample rng 'weibull :a 1.0d0 :b 2.0d0))) + (sample rng :weibull :a 1.0d0 :b 2.0d0))) (weibull-pdf 1.5d0 1.3d0 1.0d0) (weibull-P 3.5d0 1.3d0 2.0d0) (weibull-Q 3.5d0 1.3d0 2.0d0) diff --git a/solve-minimize-fit/linear-least-squares.lisp b/solve-minimize-fit/linear-least-squares.lisp index ea1308cf2e9b385c7a9168e63de96cc9c85737f5..8874334dee16b1167d8074699b9f5e4d7be06085 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: <2009-12-27 10:05:33EST linear-least-squares.lisp> +;; Time-stamp: <2010-01-17 10:40:22EST linear-least-squares.lisp> ;; ;; Copyright 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -341,7 +341,7 @@ for y0 = (exp xd) for sigma = (* 0.1d0 y0) collect - (list xd (+ y0 (sample rng 'gaussian :sigma sigma)) sigma)))) + (list xd (+ y0 (sample rng :gaussian :sigma sigma)) sigma)))) (defun linear-least-squares-multivariate-example (data &optional (print-details t)) "Second example in Section 36.5 of the GSL manual. Returns the diff --git a/solve-minimize-fit/nonlinear-least-squares.lisp b/solve-minimize-fit/nonlinear-least-squares.lisp index 5ffd0d6f73e6265f26991a6891aad50f489bc716..a7279fb9e71714c592e2551929bcbf10f7c3ec2b 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: <2009-12-27 10:05:32EST nonlinear-least-squares.lisp> +;; Time-stamp: <2010-01-17 10:41:47EST nonlinear-least-squares.lisp> ;; ;; Copyright 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -298,7 +298,7 @@ (dotimes (i number-of-observations arr) (setf (maref arr i) (+ 1 (* 5 (exp (* -1/10 i))) - (sample rng 'gaussian :sigma 0.1d0))))) + (sample rng :gaussian :sigma 0.1d0))))) :sigma (make-marray 'double-float :dimensions number-of-observations :initial-element 0.1d0))) diff --git a/tests/bernoulli.lisp b/tests/bernoulli.lisp index 3eaa7866aeb21eef57dba43d181ed0101f489eaf..753657de12ac0bb7c1928c96464eda2d92a9a7b3 100644 --- a/tests/bernoulli.lisp +++ b/tests/bernoulli.lisp @@ -24,7 +24,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'bernoulli :probability 0.5d0))))) + (sample rng :bernoulli :probability 0.5d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.5d0) (MULTIPLE-VALUE-LIST (BERNOULLI-PDF 0 0.5d0)))) diff --git a/tests/beta.lisp b/tests/beta.lisp index 1991c42906ad80c1ab9c667c4c8b9d4e7092ae3d..1c2b95b8b33476e8f39d95ed6322bc29ed696be7 100644 --- a/tests/beta.lisp +++ b/tests/beta.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'beta :a 1.0d0 :b 2.0d0))))) + (sample rng :beta :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 1.8000000000000016d0) (MULTIPLE-VALUE-LIST (BETA-PDF 0.1d0 1.0d0 2.0d0))) diff --git a/tests/cauchy.lisp b/tests/cauchy.lisp index ec06490b41290767d99c5832138dd745b5280c77..0e80be723e3f6356ad9437b34306a6e10110c771 100644 --- a/tests/cauchy.lisp +++ b/tests/cauchy.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'cauchy :a 10.0d0))))) + (sample rng :cauchy :a 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.03183098861837907d0) (MULTIPLE-VALUE-LIST (CAUCHY-PDF 0.0d0 10.0d0))) diff --git a/tests/chi-squared.lisp b/tests/chi-squared.lisp index 717b9eb31106393670777c5b9712f4649114367f..97ddcf6fe7bed6bebd217f573c017b0a1f8afdc0 100644 --- a/tests/chi-squared.lisp +++ b/tests/chi-squared.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'chi-squared :nu 10.0d0))))) + (sample rng :chi-squared :nu 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.43939128946772227d0) (MULTIPLE-VALUE-LIST (CHI-SQUARED-PDF 0.5d0 1.0d0))) diff --git a/tests/dirichlet.lisp b/tests/dirichlet.lisp index 9a8719ff5ca2646ff881d2cbcdfbcfbfb2f05d97..4d517f1b29f5cb7fae4c9002a77330c1e64c6072 100644 --- a/tests/dirichlet.lisp +++ b/tests/dirichlet.lisp @@ -26,7 +26,7 @@ (MULTIPLE-VALUE-LIST (let ((rng (make-random-number-generator +mt19937+ 0)) (alpha #m(1.0d0 2.0d0 3.0d0 4.0d0))) - (cl-array (sample rng 'dirichlet :alpha alpha))))) + (cl-array (sample rng :dirichlet :alpha alpha))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 1080.0000000000025d0) (MULTIPLE-VALUE-LIST diff --git a/tests/discrete.lisp b/tests/discrete.lisp index 6d456451dc8bb909d0eac1043e1175e7598a4d3a..4f5334891402a8902e22c04beec3b78136f643bb 100644 --- a/tests/discrete.lisp +++ b/tests/discrete.lisp @@ -29,7 +29,7 @@ (RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'discrete :table table))))) + (sample rng :discrete :table table))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.5d0) (MULTIPLE-VALUE-LIST diff --git a/tests/exponential-power.lisp b/tests/exponential-power.lisp index ebef61cd7e0f75941edee5a9e175c6843443d081..c80e4e1a3198f1a85ad8b2a1b44b2eeb4a84de0c 100644 --- a/tests/exponential-power.lisp +++ b/tests/exponential-power.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'exponential-power :a 1.0d0 :b 2.0d0))))) + (sample rng :exponential-power :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.5641895835477557d0) (MULTIPLE-VALUE-LIST diff --git a/tests/exponential.lisp b/tests/exponential.lisp index 7b90b9c0e0a8b58d9687bf92148e09c779993379..7070be5834e0b6d2acddc133721b36bf2715f967 100644 --- a/tests/exponential.lisp +++ b/tests/exponential.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'exponential :mu 10.0d0))))) + (sample rng :exponential :mu 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.1d0) (MULTIPLE-VALUE-LIST (EXPONENTIAL-PDF diff --git a/tests/fdist.lisp b/tests/fdist.lisp index 5ee33e67080d2a458cfc0fab03fd501a640fca32..47c1501ea543a6693070e2ae0fffc658cc3f864b 100644 --- a/tests/fdist.lisp +++ b/tests/fdist.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'fdist :nu1 1.0d0 :nu2 2.0d0))))) + (sample rng :fdist :nu1 1.0d0 :nu2 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.1594719884624466d0) (MULTIPLE-VALUE-LIST (FDIST-PDF 1.2d0 1.0d0 2.0d0))) diff --git a/tests/flat.lisp b/tests/flat.lisp index 15516dcb22101b20fef4ee021c939b55158fd672..90fcd433a8cf8ab2476e94937fa5f155a13c8c68 100644 --- a/tests/flat.lisp +++ b/tests/flat.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'flat :a 1.0d0 :b 2.0d0))))) + (sample rng :flat :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 1.0d0) (MULTIPLE-VALUE-LIST (FLAT-PDF 1.2d0 1.0d0 2.0d0))) diff --git a/tests/gamma-randist.lisp b/tests/gamma-randist.lisp index 0d9b8cc92558a762777299d6e61fbd501f67c71e..d994790fc50ad78592d1cf30fb0923d7ed411e8e 100644 --- a/tests/gamma-randist.lisp +++ b/tests/gamma-randist.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'gamma :a 1.0d0 :b 2.0d0))))) + (sample rng :gamma :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST (LIST 3.012983063768798d0 2.216796987787054d0 @@ -42,7 +42,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'gamma-mt :a 1.0d0 :b 2.0d0))))) + (sample rng :gamma-mt :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.475614712250357d0) (MULTIPLE-VALUE-LIST (GAMMA-PDF 0.1d0 1.0d0 2.0d0))) diff --git a/tests/gaussian-bivariate.lisp b/tests/gaussian-bivariate.lisp index 359fd500aa127f3dca5abeeb0b2ab6ce110b46d2..8cfb9eafba504e3ed61b3169b2be54bde33a04c0 100644 --- a/tests/gaussian-bivariate.lisp +++ b/tests/gaussian-bivariate.lisp @@ -31,7 +31,7 @@ (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT (sample - rng 'gaussian-bivariate + rng :bivariate-gaussian :sigma-x 1.0d0 :sigma-y 0.75d0 :rho 0.25d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.5548265557970462d0) diff --git a/tests/gaussian-tail.lisp b/tests/gaussian-tail.lisp index f8534346fcce8248b61b6e7a3029816e6a3e6945..edd37bb183001bef828dbaaba7e27797c248386e 100644 --- a/tests/gaussian-tail.lisp +++ b/tests/gaussian-tail.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'gaussian-tail :a 50.0d0 :sigma 10.0d0))))) + (sample rng :gaussian-tail :a 50.0d0 :sigma 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.18702270877331703d0) (MULTIPLE-VALUE-LIST @@ -46,7 +46,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'ugaussian-tail :a 5.0d0))))) + (sample rng :ugaussian-tail :a 5.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 1.8702270877331704d0) (MULTIPLE-VALUE-LIST (UGAUSSIAN-TAIL-PDF 5.2d0 5.0d0)))) diff --git a/tests/gaussian.lisp b/tests/gaussian.lisp index 7d9c10d6d84af53ed19799c9c91c7780a49c252a..a84b83f4fb455440b4c811271322d2e35a315ddc 100644 --- a/tests/gaussian.lisp +++ b/tests/gaussian.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'gaussian :sigma 10.0d0))))) + (sample rng :gaussian :sigma 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.039894228040143274d0) (MULTIPLE-VALUE-LIST (GAUSSIAN-PDF 0.0d0 10.0d0))) @@ -45,7 +45,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'gaussian-ziggurat :sigma 10.0d0))))) + (sample rng :gaussian-ziggurat :sigma 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.9772498680518208d0) (MULTIPLE-VALUE-LIST (UGAUSSIAN-P 2.0d0))) diff --git a/tests/geometric.lisp b/tests/geometric.lisp index 7db346f55d879bfa910295a0ba1a5002b2c2bd8f..9362f9fece601eeebc561ec17c27d6c322ace475 100644 --- a/tests/geometric.lisp +++ b/tests/geometric.lisp @@ -24,7 +24,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'geometric :probability 0.4d0))))) + (sample rng :geometric :probability 0.4d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.24d0) (MULTIPLE-VALUE-LIST (GEOMETRIC-PDF 2 0.4d0))) diff --git a/tests/gumbel1.lisp b/tests/gumbel1.lisp index 2d7bd8b0976220f6b4b2692785ade3cd354adb11..aa3ac5886ebb56937e9d5af00d737cdfcd972fdc 100644 --- a/tests/gumbel1.lisp +++ b/tests/gumbel1.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'gumbel1 :a 1.0d0 :b 2.0d0))))) + (sample rng :gumbel1 :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.29625708964974956d0) (MULTIPLE-VALUE-LIST (GUMBEL1-PDF 0.1d0 1.0d0 2.0d0))) diff --git a/tests/gumbel2.lisp b/tests/gumbel2.lisp index 5e6399d48466217cf76cd0fe899d48f8f458c53d..5861ccbdc8b2584a17e21ad8815cd28ddef1c8d8 100644 --- a/tests/gumbel2.lisp +++ b/tests/gumbel2.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'gumbel2 :a 1.0d0 :b 2.0d0))))) + (sample rng :gumbel2 :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.053625603682851145d0) (MULTIPLE-VALUE-LIST (GUMBEL2-PDF 5.0d0 1.0d0 2.0d0))) diff --git a/tests/hypergeometric-randist.lisp b/tests/hypergeometric-randist.lisp index 57dd77de82f83aea011f5b236c8ef41d7d5de206..ed8d6e5da6be6526bd8cbcbc7c050817ff950604 100644 --- a/tests/hypergeometric-randist.lisp +++ b/tests/hypergeometric-randist.lisp @@ -24,7 +24,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'hypergeometric :n1 3 :n2 6 :tt 3))))) + (sample rng :hypergeometric :n1 3 :n2 6 :tt 3))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.35714285714285693d0) (MULTIPLE-VALUE-LIST (HYPERGEOMETRIC-PDF 0 2 6 3))) diff --git a/tests/landau.lisp b/tests/landau.lisp index 201b91b46ac7f69f102d8d29968b4428c29ae3cd..e030a1ece3647aebcc7fbd1f283946bd0b245c6e 100644 --- a/tests/landau.lisp +++ b/tests/landau.lisp @@ -29,7 +29,7 @@ 4.681506208977819d0)) (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) - (LOOP FOR I FROM 0 TO 10 COLLECT (sample rng 'landau))))) + (LOOP FOR I FROM 0 TO 10 COLLECT (sample rng :landau))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.17331968995860203d0) (MULTIPLE-VALUE-LIST (LANDAU-PDF 0.25d0)))) diff --git a/tests/laplace.lisp b/tests/laplace.lisp index ec58b3caf9c9256067830329b55f820bd879b116..a40bee9d82a890d92b7ea3bc7591fc243358c8b6 100644 --- a/tests/laplace.lisp +++ b/tests/laplace.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'laplace :a 10.0d0))))) + (sample rng :laplace :a 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.05d0) (MULTIPLE-VALUE-LIST (LAPLACE-PDF 0.0d0 diff --git a/tests/levy.lisp b/tests/levy.lisp index e5d68184e26bc805abe8ea1531bf6a8d89aa1d17..a33f9b7110862215d9723bc6bb7cc202b87a2110 100644 --- a/tests/levy.lisp +++ b/tests/levy.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'levy :c 1.0d0 :alpha 2.0d0))))) + (sample rng :levy :c 1.0d0 :alpha 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST (LIST 2.6941098332360465d0 -0.2939543864467665d0 @@ -42,5 +42,5 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'levy-skew :c 1.0d0 :alpha 2.0d0 :beta 1.0d0)))))) + (sample rng :levy-skew :c 1.0d0 :alpha 2.0d0 :beta 1.0d0)))))) diff --git a/tests/logarithmic.lisp b/tests/logarithmic.lisp index b29e5aeb99ba05145853aa55ef47403c2dc5b277..ad098e0a3bcaa034b146d3f177d5bd648efc12ab 100644 --- a/tests/logarithmic.lisp +++ b/tests/logarithmic.lisp @@ -24,7 +24,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'logarithmic :probability 0.9d0))))) + (sample rng :logarithmic :probability 0.9d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.15660921511769743d0) (MULTIPLE-VALUE-LIST (LOGARITHMIC-PDF 2 0.4d0)))) diff --git a/tests/logistic.lisp b/tests/logistic.lisp index 4ed7fe38a6aebb7eac015c57ebaebfeaf2f2dae9..37672f05567e61494199b629fb1cf7e17756b92d 100644 --- a/tests/logistic.lisp +++ b/tests/logistic.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'logistic :a 10.0d0))))) + (sample rng :logistic :a 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.2350037122015945d0) (MULTIPLE-VALUE-LIST (LOGISTIC-PDF 0.5d0 1.0d0))) diff --git a/tests/lognormal.lisp b/tests/lognormal.lisp index 89088ad414d8c825f5ad3bdf3401f0355c80487f..c0c11f84079924e854ae0f1a28d2b0d0d9bbcb15 100644 --- a/tests/lognormal.lisp +++ b/tests/lognormal.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'lognormal :zeta 1.0d0 :sigma 2.0d0))))) + (sample rng :lognormal :zeta 1.0d0 :sigma 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.15289833965691607d0) (MULTIPLE-VALUE-LIST diff --git a/tests/multinomial.lisp b/tests/multinomial.lisp index b0efb30a28a11b63e58c3ddc3ab95ec170ae9efa..82bd53285585d5ad6896bf57f07bdd9c59f35f7a 100644 --- a/tests/multinomial.lisp +++ b/tests/multinomial.lisp @@ -24,7 +24,7 @@ (MULTIPLE-VALUE-LIST (let ((rng (make-random-number-generator +mt19937+ 0)) (p #m(0.1d0 0.2d0 0.3d0 0.4d0))) - (cl-array (sample rng 'multinomial :sum 8 :probabilities p))))) + (cl-array (sample rng :multinomial :sum 8 :probabilities p))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 8.064000000000026d-5) (MULTIPLE-VALUE-LIST diff --git a/tests/negative-binomial.lisp b/tests/negative-binomial.lisp index 90d7fd22141c163f818194933890b9288a4b1e90..aaa2e82521a8b2fcfa40e7ad70198a45c6928cba 100644 --- a/tests/negative-binomial.lisp +++ b/tests/negative-binomial.lisp @@ -24,7 +24,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'negative-binomial :probability 0.4d0 :n 12.0d0))))) + (sample rng :negative-binomial :probability 0.4d0 :n 12.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.0056984767089869d0) (MULTIPLE-VALUE-LIST @@ -42,7 +42,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'pascal :probability 0.4d0 :n 12))))) + (sample rng :pascal :probability 0.4d0 :n 12))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.0056984767089869d0) (MULTIPLE-VALUE-LIST (PASCAL-PDF 5 0.4d0 12))) diff --git a/tests/pareto.lisp b/tests/pareto.lisp index 326f8618b414851b52bb25a1ba759fad6899197c..5d0b022a0fbd6e3e80e6069d7b50989561a0bd16 100644 --- a/tests/pareto.lisp +++ b/tests/pareto.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'pareto :a 1.0d0 :b 2.0d0))))) + (sample rng :pareto :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.5116034405707658d0) (MULTIPLE-VALUE-LIST (PARETO-PDF 1.5d0 1.3d0 1.0d0))) diff --git a/tests/poisson.lisp b/tests/poisson.lisp index 2855d281ce2acb31f244d27397abddfe6fa058d8..f3cb98a263513065909d2df0ba470c10daf3d45f 100644 --- a/tests/poisson.lisp +++ b/tests/poisson.lisp @@ -24,7 +24,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'poisson :mu 10.0d0))))) + (sample rng :poisson :mu 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.11259903214902009d0) (MULTIPLE-VALUE-LIST (POISSON-PDF 8 10.0d0))) diff --git a/tests/random-number-generators.lisp b/tests/random-number-generators.lisp index b9ce6b2bd6a57e401267c6cda3a08d6c481b901c..2b8389585f793169cfee84c08a7c493ac9af2d4d 100644 --- a/tests/random-number-generators.lisp +++ b/tests/random-number-generators.lisp @@ -25,7 +25,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'uniform-fixnum :upperbound 1000))))) + (sample rng :uniform-fixnum :upperbound 1000))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST (LIST 0.11177622997750353d0 0.9591667949963206d0 @@ -36,4 +36,4 @@ 0.9311084621265104d0)) (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +CMRG+ 0))) - (LOOP FOR I FROM 0 TO 10 COLLECT (sample rng 'uniform)))))) + (LOOP FOR I FROM 0 TO 10 COLLECT (sample rng :uniform)))))) diff --git a/tests/rayleigh-tail.lisp b/tests/rayleigh-tail.lisp index 10ca805f38d9009dfc92d09606c5a4f26d50daaf..315e675f0c88ec88623a83d280bbb6eac85dc905 100644 --- a/tests/rayleigh-tail.lisp +++ b/tests/rayleigh-tail.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'rayleigh-tail :a 1.0d0 :sigma 10.0d0))))) + (sample rng :rayleigh-tail :a 1.0d0 :sigma 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.10224317624874313d0) (MULTIPLE-VALUE-LIST diff --git a/tests/rayleigh.lisp b/tests/rayleigh.lisp index 8dcabc830ff0a2a15580fff28cc1623778d9e1f6..a2d05c47e67e004340349fd9e2e255f77a3e4ada 100644 --- a/tests/rayleigh.lisp +++ b/tests/rayleigh.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'rayleigh :sigma 10.0d0))))) + (sample rng :rayleigh :sigma 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.4412484512922977d0) (MULTIPLE-VALUE-LIST (RAYLEIGH-PDF 0.5d0 1.0d0))) diff --git a/tests/shuffling-sampling.lisp b/tests/shuffling-sampling.lisp index 3a5d9fd19bbad82c1f254edf209bd1df53c2f2a3..e1198415bb793057c4a85b95eb0e66cab7d20302 100644 --- a/tests/shuffling-sampling.lisp +++ b/tests/shuffling-sampling.lisp @@ -24,16 +24,16 @@ (MULTIPLE-VALUE-LIST (let ((rng (make-random-number-generator +mt19937+ 0)) (v1 #31m(1 2 3 4 5 6 7 8))) - (cl-array (sample rng 'shuffle :base v1))))) + (cl-array (sample rng :shuffle :base v1))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(2 3 5 8)) (MULTIPLE-VALUE-LIST (let ((rng (make-random-number-generator +mt19937+ 0)) (v1 #31m(1 2 3 4 5 6 7 8))) - (cl-array (sample rng 'choose-random :src v1 :dest 4))))) + (cl-array (sample rng :choose-random :src v1 :dest 4))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(8 2 3 8 2 4 8 6 5 6)) (MULTIPLE-VALUE-LIST (let ((rng (make-random-number-generator +mt19937+ 0)) (v1 #31m(1 2 3 4 5 6 7 8))) - (cl-array (sample rng 'random-sample :src v1 :dest 10)))))) + (cl-array (sample rng :random-sample :src v1 :dest 10)))))) diff --git a/tests/spherical-vector.lisp b/tests/spherical-vector.lisp index 4f874528407d11fddddabc31fa64fcde87d983f8..35e79bd63768f43861876546cf6964823a1a9273 100644 --- a/tests/spherical-vector.lisp +++ b/tests/spherical-vector.lisp @@ -29,7 +29,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 4 APPEND - (MULTIPLE-VALUE-LIST (sample rng 'direction-2d)))))) + (MULTIPLE-VALUE-LIST (sample rng :direction-2d)))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST (LIST 0.9999986835208556d0 -0.0016226387631051197d0 @@ -40,7 +40,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 4 APPEND - (MULTIPLE-VALUE-LIST (sample rng 'direction-2d-trig-method)))))) + (MULTIPLE-VALUE-LIST (sample rng :direction-2d-trig-method)))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST (LIST -0.09129925750445994d0 0.18782185357162273d0 @@ -51,5 +51,5 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 2 APPEND - (MULTIPLE-VALUE-LIST (sample rng 'direction-3d))))))) + (MULTIPLE-VALUE-LIST (sample rng :direction-3d))))))) diff --git a/tests/tdist.lisp b/tests/tdist.lisp index 3ac50168609a54a21cc71d469c97fd33fa1ccca1..1ea7b75fed89540fffce7594a734daa20284cc21 100644 --- a/tests/tdist.lisp +++ b/tests/tdist.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'tdist :nu 10.0d0))))) + (sample rng :tdist :nu 10.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.2546479089470325d0) (MULTIPLE-VALUE-LIST (TDIST-PDF 0.5d0 1.0d0))) diff --git a/tests/weibull.lisp b/tests/weibull.lisp index fba79104315b868775b9962ff6a762a59d9c50bf..84770ed05d675153aa51d0f9589a9c111441f6fb 100644 --- a/tests/weibull.lisp +++ b/tests/weibull.lisp @@ -30,7 +30,7 @@ (MULTIPLE-VALUE-LIST (LET ((RNG (MAKE-RANDOM-NUMBER-GENERATOR +MT19937+ 0))) (LOOP FOR I FROM 0 TO 10 COLLECT - (sample rng 'weibull :a 1.0d0 :b 2.0d0))))) + (sample rng :weibull :a 1.0d0 :b 2.0d0))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.24263174972226745d0) (MULTIPLE-VALUE-LIST (WEIBULL-PDF 1.5d0 1.3d0 1.0d0)))