Commit 46514f3f authored by liam's avatar liam

Eliminate specials of rng instances *rng-mt19937*, *rng-cmrg*,

*rng-default*, in favor of the more approprate letm-bound objects.


git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3281 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent 15147fea
;; Linear least squares, or linear regression
;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp>
;; Time-stamp: <2008-02-02 21:01:35EST linear-least-squares.lisp>
;; Time-stamp: <2008-02-03 11:31:47EST linear-least-squares.lisp>
;; $Id: $
(in-package :gsl)
......@@ -290,13 +290,13 @@
(defun mv-linear-least-squares-data ()
"Generate data for second example in Section 36.5 of the GSL
manual."
(rng-set *rng-mt19937* 0)
(loop for x from 1/10 below 2 by 1/10
for xd = (coerce x 'double-float)
for y0 = (exp xd)
for sigma = (* 0.1d0 y0)
collect
(list xd (+ y0 (gaussian *rng-mt19937* sigma)) sigma)))
(letm ((rng (random-number-generator *mt19937* 0)))
(loop for x from 1/10 below 2 by 1/10
for xd = (coerce x 'double-float)
for y0 = (exp xd)
for sigma = (* 0.1d0 y0)
collect
(list xd (+ y0 (gaussian rng sigma)) sigma))))
(defun mv-linear-least-squares-example (data)
"Second example in Section 36.5 of the GSL manual."
......
;; Monte Carlo Integration
;; Liam Healy Sat Feb 3 2007 - 17:42
;; Time-stamp: <2008-02-02 21:11:35EST monte-carlo.lisp>
;; Time-stamp: <2008-02-03 11:35:59EST monte-carlo.lisp>
;; $Id: $
(in-package :gsl)
......@@ -288,46 +288,25 @@
(def-mc-function monte-carlo-g 3)
(defun random-walk-plain-example (&optional (nsamples 500000))
(letm ((ws (monte-carlo-plain 3)))
(with-data (lower vector-double 3)
(with-data (upper vector-double 3)
(setf (data lower) #(0.0d0 0.0d0 0.0d0)
(data upper) (vector pi pi pi))
(rng-set *rng-mt19937* 0)
(monte-carlo-integrate-plain
monte-carlo-g
lower upper
nsamples
*rng-mt19937*
ws)))))
(letm ((ws (monte-carlo-plain 3))
(lower (vector-double #(0.0d0 0.0d0 0.0d0)))
(upper (vector-double (vector pi pi pi)))
(rng (random-number-generator *mt19937* 0)))
(monte-carlo-integrate-plain monte-carlo-g lower upper nsamples rng ws)))))
(defun random-walk-miser-example (&optional (nsamples 500000))
(letm ((ws (monte-carlo-miser 3)))
(with-data (lower vector-double 3)
(with-data (upper vector-double 3)
(setf (data lower) #(0.0d0 0.0d0 0.0d0)
(data upper) (vector pi pi pi))
(rng-set *rng-mt19937* 0)
(monte-carlo-integrate-miser
monte-carlo-g
lower upper
nsamples
*rng-mt19937*
ws)))))
(letm ((ws (monte-carlo-miser 3))
(lower (vector-double #(0.0d0 0.0d0 0.0d0)))
(upper (vector-double (vector pi pi pi)))
(rng (random-number-generator *mt19937* 0)))
(monte-carlo-integrate-miser monte-carlo-g lower upper nsamples rng ws)))))
(defun random-walk-vegas-example (&optional (nsamples 500000))
(letm ((ws (monte-carlo-vegas 3)))
(with-data (lower vector-double 3)
(with-data (upper vector-double 3)
(setf (data lower) #(0.0d0 0.0d0 0.0d0)
(data upper) (vector pi pi pi))
(rng-set *rng-mt19937* 0)
(monte-carlo-integrate-vegas
monte-carlo-g
lower upper
nsamples
*rng-mt19937*
ws)))))
(letm ((ws (monte-carlo-vegas 3))
(lower (vector-double #(0.0d0 0.0d0 0.0d0)))
(upper (vector-double (vector pi pi pi)))
(rng (random-number-generator *mt19937* 0)))
(monte-carlo-integrate-vegas monte-carlo-g lower upper nsamples rng ws)))))
(lisp-unit:define-test monte-carlo
(lisp-unit:assert-first-fp-equal
......
;********************************************************
; file: bernoulli.lisp
; description: Bernoulli distribution
; date: Sat Nov 25 2006 - 16:59
; author: Liam M. Healy
; modified: Sat Nov 25 2006 - 17:01
;********************************************************
;;; $Id: $
;; Bernoulli distribution
;; Liam Healy, Sat Nov 25 2006 - 16:59
;; Time-stamp: <2008-02-03 11:16:35EST bernoulli.lisp>
;; $Id: $
(in-package :gsl)
......@@ -13,9 +9,9 @@
"gsl_ran_bernoulli"
(((generator generator) :pointer) (p :double))
:c-return :uint
:documentation
:documentation ; FDL
"Returns either 0 or 1, the result of a Bernoulli trial
with probability @var{p}. The probability distribution for
with probability p. The probability distribution for
a Bernoulli trial is
p(0) = 1 - p
p(1) = p.")
......@@ -23,19 +19,19 @@
(defun-gsl bernoulli-pdf (k p)
"gsl_ran_bernoulli_pdf" ((k :uint) (p :double))
:c-return :double
:documentation "The probability @math{p(k)} of obtaining
@var{k} from a Bernoulli distribution with probability parameter
@var{p}, using the formula given in #'bernoulli.")
:documentation ; FDL
"The probability p(k) of obtaining
k from a Bernoulli distribution with probability parameter
p, using the formula given in #'bernoulli.")
;;; Examples and unit test
(lisp-unit:define-test bernoulli
(lisp-unit:assert-equal
'(0 1 1 0 1 1 0 0 0 0 0)
(progn
(rng-set *rng-mt19937* 0)
(letm ((rng (random-number-generator *mt19937* 0)))
(loop for i from 0 to 10
collect
(bernoulli *rng-mt19937* 0.5d0))))
collect
(bernoulli rng 0.5d0))))
(lisp-unit:assert-first-fp-equal
"0.500000000000d+00"
(bernoulli-pdf 0 0.5d0)))
;; Beta distribution
;; Liam Healy, Sat Sep 30 2006
;; Time-stamp: <2008-02-02 23:04:13EST beta.lisp>
;; Time-stamp: <2008-02-03 09:52:01EST beta.lisp>
;; $Id: $
(in-package :gsl)
......@@ -10,42 +10,46 @@
"gsl_ran_beta"
(((generator generator) :pointer) (a :double) (b :double))
:c-return :double
:documentation
:documentation ; FDL
"A random variate from the beta distribution. The distribution function is
p(x) dx = {\Gamma(a+b) \over \Gamma(a) \Gamma(b)} x^{a-1} (1-x)^{b-1} dx
@math{0 <= x <= 1}.")
0 <= x <= 1.")
(defun-gsl beta-pdf (x a b)
"gsl_ran_beta_pdf" ((x :double) (a :double) (b :double))
:c-return :double
:documentation
"The probability density @math{p(x)} at @var{x}
for a beta distribution with parameters @var{a} and @var{b}, using the
:documentation ; FDL
"The probability density p(x) at x
for a beta distribution with parameters a and b, using the
formula given in #'beta.")
(defun-gsl beta-P (x a b)
"gsl_cdf_beta_P" ((x :double) (a :double) (b :double))
:c-return :double
:documentation "The cumulative distribution functions
@math{P(x)} for the beta distribution with parameters @var{a} and @var{b}.")
:documentation ; FDL
"The cumulative distribution functions
P(x) for the beta distribution with parameters a and b.")
(defun-gsl beta-Q (x a b)
"gsl_cdf_beta_Q" ((x :double) (a :double) (b :double))
:c-return :double
:documentation "The cumulative distribution functions
@math{Q(x)} for the beta distribution with parameters @var{a} and @var{b}.")
:documentation ; FDL
"The cumulative distribution functions
Q(x) for the beta distribution with parameters a and b.")
(defun-gsl beta-Pinv (P a b)
"gsl_cdf_beta_Pinv" ((P :double) (a :double) (b :double))
:c-return :double
:documentation "The inverse cumulative distribution functions
@math{P(x)} for the beta distribution with parameters @var{a} and @var{b}.")
:documentation ; FDL
"The inverse cumulative distribution functions
P(x) for the beta distribution with parameters a and b.")
(defun-gsl beta-Qinv (Q a b)
"gsl_cdf_beta_Qinv" ((Q :double) (a :double) (b :double))
:c-return :double
:documentation "The inverse cumulative distribution functions
@math{Q(x)} for the beta distribution with parameters @var{a} and @var{b}.")
:documentation ; FDL
"The inverse cumulative distribution functions
Q(x) for the beta distribution with parameters a and b.")
;;; Examples and unit test
(lisp-unit:define-test beta
......
;********************************************************
; file: binomial.lisp
; description: Binomial distribution
; date: Sat Nov 25 2006 - 16:00
; author: Liam M. Healy
; modified: Sat Nov 25 2006 - 18:08
;********************************************************
;;; $Id: $
;; Binomial distribution
;; Liam Healy, Sat Nov 25 2006 - 16:00
;; Time-stamp: <2008-02-03 11:25:08EST binomial.lisp>
;; $Id: $
(in-package :gsl)
......@@ -13,44 +9,44 @@
"gsl_ran_binomial"
(((generator generator) :pointer) (p :double) (n :uint))
:c-return :uint
:documentation
:documentation ; FDL
"A random integer from the binomial distribution,
the number of successes in @var{n} independent trials with probability
@var{p}. The probability distribution for binomial variates is,
the number of successes in n independent trials with probability
p. The probability distribution for binomial variates is,
p(k) = {n! \over k! (n-k)!} p^k (1-p)^{n-k}
@math{0 <= k <= n}.")
0 <= k <= n.")
(defun-gsl binomial-pdf (k p n)
"gsl_ran_binomial_pdf" ((k :uint) (p :double) (n :uint))
:c-return :double
:documentation
"The probability @math{p(k)} of obtaining @var{k}
from a binomial distribution with parameters @var{p} and @var{n}, using
:documentation ; FDL
"The probability p(k) of obtaining k
from a binomial distribution with parameters p and n, using
the formula given in #'binomial.")
(defun-gsl binomial-P (k p n)
"gsl_cdf_binomial_P" ((k :uint) (p :double) (n :uint))
:c-return :double
:documentation "The cumulative distribution functions
@math{P(k)} for the Binomial distribution
with parameters @var{p} and @var{n}.")
:documentation ; FDL
"The cumulative distribution functions
P(k) for the Binomial distribution with parameters p and n.")
(defun-gsl binomial-Q (k p n)
"gsl_cdf_binomial_Q" ((k :uint) (p :double) (n :uint))
:c-return :double
:documentation "The cumulative distribution functions
@math{Q(k)} for the Binomial distribution
with parameters @var{p} and @var{n}.")
:documentation ; FDL
"The cumulative distribution functions
Q(k) for the Binomial distribution
with parameters p and n.")
;;; Examples and unit test
(lisp-unit:define-test binomial
(lisp-unit:assert-equal
'(11 3 4 8 4 5 8 6 5 6 6)
(progn
(rng-set *rng-mt19937* 0)
(letm ((rng (random-number-generator *mt19937* 0)))
(loop for i from 0 to 10
collect
(binomial *rng-mt19937* 0.4d0 12))))
collect
(binomial rng 0.4d0 12))))
(lisp-unit:assert-first-fp-equal
"0.227030335488d+00"
(binomial-pdf 5 0.4d0 12))
......
;********************************************************
; file: cauchy.lisp
; description: Cauchy distribution
; date: Sat Sep 30 2006
; author: Liam M. Healy
; modified: Sat Sep 30 2006 - 19:15
;********************************************************
;;; $Id: $
;; Cauchy distribution
;; Liam Healy, Sat Sep 30 2006
;; Time-stamp: <2008-02-03 11:02:19EST cauchy.lisp>
;; $Id: $
(in-package :gsl)
......@@ -13,45 +9,49 @@
"gsl_ran_cauchy"
(((generator generator) :pointer) (a :double))
:c-return :double
:documentation
:documentation ; FDL
"A random variate from the Cauchy distribution with
scale parameter @var{a}. The probability distribution for Cauchy
scale parameter a. The probability distribution for Cauchy
random variates is,
p(x) dx = {1 \over a\pi (1 + (x/a)^2) } dx
for @math{x} in the range @math{-\infty} to @math{+\infty}. The Cauchy
for x in the range -\infty to +\infty. The Cauchy
distribution is also known as the Lorentz distribution.")
(defun-gsl cauchy-pdf (x a)
"gsl_ran_cauchy_pdf" ((x :double) (a :double))
:c-return :double
:documentation
"The probability density @math{p(x)} at @var{x}
for a Cauchy distribution with scale parameter @var{a}, using the formula
:documentation ; FDL
"The probability density p(x) at x
for a Cauchy distribution with scale parameter a, using the formula
given for #'cauchy.")
(defun-gsl cauchy-P (x a)
"gsl_cdf_cauchy_P" ((x :double) (a :double))
:c-return :double
:documentation "The cumulative distribution functions
@math{P(x)} for the Cauchy distribution with scale parameter @var{a}.")
:documentation ; FDL
"The cumulative distribution functions
P(x) for the Cauchy distribution with scale parameter a.")
(defun-gsl cauchy-Q (x a)
"gsl_cdf_cauchy_Q" ((x :double) (a :double))
:c-return :double
:documentation "The cumulative distribution functions
@math{Q(x)} for the Cauchy distribution with scale parameter @var{a}.")
:documentation ; FDL
"The cumulative distribution functions
Q(x) for the Cauchy distribution with scale parameter a.")
(defun-gsl cauchy-Pinv (P a)
"gsl_cdf_cauchy_Pinv" ((P :double) (a :double))
:c-return :double
:documentation "The inverse cumulative distribution functions
@math{P(x)} for the Cauchy distribution with scale parameter @var{a}.")
:documentation ; FDL
"The inverse cumulative distribution functions
P(x) for the Cauchy distribution with scale parameter a.")
(defun-gsl cauchy-Qinv (Q a)
"gsl_cdf_cauchy_Qinv" ((Q :double) (a :double))
:c-return :double
:documentation "The inverse cumulative distribution functions
@math{Q(x)} for the Cauchy distribution with scale parameter @var{a}.")
:documentation ; FDL
"The inverse cumulative distribution functions
Q(x) for the Cauchy distribution with scale parameter a.")
;;; Examples and unit test
(lisp-unit:define-test cauchy
......@@ -61,11 +61,10 @@
"-0.134390491844d+01" "-0.103643632829d+02" "-0.790709314248d+02"
"-0.106520710880d+02" "-0.939394824349d+01")
(lisp-unit:fp-sequence
(progn
(rng-set *rng-mt19937* 0)
(letm ((rng (random-number-generator *mt19937* 0)))
(loop for i from 0 to 10
collect
(cauchy *rng-mt19937* 10.0d0)))))
(cauchy rng 10.0d0)))))
(lisp-unit:assert-first-fp-equal
"0.318309886184d-01"
(cauchy-pdf 0.0d0 10.0d0))
......
;********************************************************
; file: chi-squared.lisp
; description: Chi-squared distribution
; date: Sat Oct 7 2006 - 16:13
; author: Liam M. Healy
; modified: Sun Oct 8 2006 - 16:41
;********************************************************
;;; $Id: $
;; Chi-squared distribution
;; Liam Healy, Sat Oct 7 2006 - 16:13
;; Time-stamp: <2008-02-03 10:23:21EST chi-squared.lisp>
;; $Id: $
(in-package :gsl)
......@@ -13,43 +9,47 @@
"gsl_ran_chisq"
(((generator generator) :pointer) (nu :double))
:c-return :double
:documentation
:documentation ; FDL
"A random variate from the chi-squared distribution
with @var{nu} degrees of freedom. The distribution function is
with nu degrees of freedom. The distribution function is
p(x) dx = {1 \over 2 \Gamma(\nu/2) } (x/2)^{\nu/2 - 1} \exp(-x/2) dx
@math{x >= 0}. ")
x >= 0. ")
(defun-gsl chi-squared-pdf (x nu)
"gsl_ran_chisq_pdf" ((x :double) (nu :double))
:c-return :double
:documentation
"The probability density @math{p(x)} at @var{x}
for a chi-squared distribution with @var{nu} degrees of freedom, using
: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.")
(defun-gsl chi-squared-P (x nu)
"gsl_cdf_chisq_P" ((x :double) (nu :double))
:c-return :double
:documentation "The cumulative distribution functions
@math{P(x)} for the chi-squared distribution with @var{nu} degrees of freedom.")
:documentation ; FDL
"The cumulative distribution functions
P(x) for the chi-squared distribution with nu degrees of freedom.")
(defun-gsl chi-squared-Q (x nu)
"gsl_cdf_chisq_Q" ((x :double) (nu :double))
:c-return :double
:documentation "The cumulative distribution functions
@math{Q(x)} for the chi-squared distribution with @var{nu} degrees of freedom.")
:documentation ; FDL
"The cumulative distribution functions
Q(x) for the chi-squared distribution with nu degrees of freedom.")
(defun-gsl chi-squared-Pinv (P nu)
"gsl_cdf_chisq_Pinv" ((P :double) (nu :double))
:c-return :double
:documentation "The inverse cumulative distribution functions
@math{P(x)} for the chi-squared distribution with @var{nu} degrees of freedom.")
:documentation ; FDL
"The inverse cumulative distribution functions
P(x) for the chi-squared distribution with nu degrees of freedom.")
(defun-gsl chi-squared-Qinv (Q nu)
"gsl_cdf_chisq_Qinv" ((Q :double) (nu :double))
:c-return :double
:documentation "The inverse cumulative distribution functions
@math{Q(x)} for the chi-squared distribution with @var{nu} degrees of freedom.")
:documentation ; FDL
"The inverse cumulative distribution functions
Q(x) for the chi-squared distribution with nu degrees of freedom.")
;;; Examples and unit test
(lisp-unit:define-test chi-squared
......@@ -59,11 +59,10 @@
"0.137566397216d+02" "0.113594580454d+02" "0.160682825906d+02"
"0.129995142525d+02" "0.111473474244d+02")
(lisp-unit:fp-sequence
(progn
(rng-set *rng-mt19937* 0)
(letm ((rng (random-number-generator *mt19937* 0)))
(loop for i from 0 to 10
collect
(chi-squared *rng-mt19937* 10.0d0)))))
(chi-squared rng 10.0d0)))))
(lisp-unit:assert-first-fp-equal
"0.439391289468d+00"
(chi-squared-pdf 0.5d0 1.0d0))
......
;; Dirichlet distribution
;; Liam Healy, Sun Oct 29 2006
;; Time-stamp: <2008-02-02 23:00:40EST dirichlet.lisp>
;; Time-stamp: <2008-02-03 09:49:17EST dirichlet.lisp>
;; $Id: $
(in-package :gsl)
......@@ -13,20 +13,20 @@
;; theta had better be at least as long as alpha, or they'll be trouble
((gsl-array theta) :pointer))
:c-return :void
:documentation
:documentation ; FDL
"An array of K=(length alpha) random variates from a Dirichlet
distribution of order K-1. The distribution function is
p(\theta_1,\ldots,\theta_K) \, d\theta_1 \cdots d\theta_K =
{1 \over Z} \prod_{i=1}^{K} \theta_i^{\alpha_i - 1}
\; \delta(1 -\sum_{i=1}^K \theta_i) d\theta_1 \cdots d\theta_K
@math{theta_i >= 0} and @math{alpha_i >= 0}.
The delta function ensures that @math{\sum \theta_i = 1}.
The normalization factor @math{Z} is
theta_i >= 0 and alpha_i >= 0.
The delta function ensures that \sum \theta_i = 1.
The normalization factor Z is
Z = {\prod_{i=1}^K \Gamma(\alpha_i) \over \Gamma( \sum_{i=1}^K \alpha_i)}
The random variates are generated by sampling @var{K} values
from gamma distributions with parameters @math{a=alpha_i, b=1},
The random variates are generated by sampling K values
from gamma distributions with parameters a=alpha_i, b=1,
and renormalizing.
See A.M. Law, W.D. Kelton, @cite{Simulation Modeling and Analysis}
See A.M. Law, W.D. Kelton, \"Simulation Modeling and Analysis\"
(1991).")
(defun-gsl dirichlet-pdf (alpha theta)
......@@ -36,10 +36,10 @@
;; theta had better be at least as long as alpha, or they'll be trouble
((gsl-array theta) :pointer))
:c-return :double
:documentation
"The probability density @math{p(\theta_1, ... , \theta_K)}
at @var{theta}[@var{K}] for a Dirichlet distribution with parameters
@var{alpha}[@var{K}], using the formula given for #'dirichlet.")
: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.")
(defun-gsl dirichlet-log-pdf (alpha theta)
"gsl_ran_dirichlet_lnpdf"
......@@ -48,11 +48,11 @@
;; theta had better be at least as long as alpha, or they'll be trouble
((gsl-array theta) :pointer))
:c-return :double
:documentation
:documentation ; FDL
"The logarithm of the probability density
@math{p(\theta_1, ... , \theta_K)}
p(\theta_1, ... , \theta_K)
for a Dirichlet distribution with parameters
@var{alpha}[@var{K}].")
alpha[K].")
;;; Examples and unit test
(lisp-unit:define-test dirichlet
......
;; Discrete random variables
;; Liam Healy, Sat Nov 11 2006 - 21:51
;; Time-stamp: <2008-02-02 20:59:58EST discrete.lisp>
;; Time-stamp: <2008-02-03 10:58:16EST discrete.lisp>
;; $Id: $
(in-package :gsl)
......@@ -18,8 +18,8 @@
(((dim0 probabilities) :size) ((gsl-array probabilities) :pointer))
:c-return :pointer
:export nil
:index (letm discrete)
:documentation
:index (letm discrete-random)
:documentation ; FDL
"A pointer to a structure that contains the lookup
table for the discrete random number generator. The array probabilities contains
the probabilities of the discrete events; these array elements must all be
......@@ -31,22 +31,15 @@
"gsl_ran_discrete_free" ((table :pointer))
:c-return :void
:export nil
:index (letm discrete)
:documentation
:index (letm discrete-random)
:documentation ; FDL
"De-allocates the lookup table created by #'discrete-preprocess.")
(export 'with-discrete-table)
(defmacro with-discrete-table ((probabilities table) &body body)
`(let ((,table (discrete-preprocess ,probabilities)))
(unwind-protect
(progn ,@body)
(discrete-free ,table))))
(defun-gsl discrete (generator table)
"gsl_ran_discrete"
(((generator generator) :pointer) (table :pointer))
:c-return :size
:documentation
:documentation ; FDL
"Generate discrete random numbers after running #'discrete-preprocess;
the argument 'table is the value returned by #'discrete-preprocess.")
......@@ -54,29 +47,28 @@
"gsl_ran_discrete_pdf"
((k :size) (table :pointer))
:c-return :double
:documentation
"The probability @math{P[k]} of observing the variable @var{k}.
Since @math{P[k]} is not stored as part of the lookup table, it must be
recomputed; this computation takes @math{O(K)}, so if @var{K} is large
and you care about the original array @math{P[k]} used to create the
lookup table, then you should just keep this original array @math{P[k]}
:documentation ; FDL
"The probability P[k] of observing the variable k.
Since P[k] is not stored as part of the lookup table, it must be
recomputed; this computation takes O(K), so if K is large
and you care about the original array P[k] used to create the
lookup table, then you should just keep this original array P[k]
around.")
;;; Examples and unit test
(lisp-unit:define-test discrete
(lisp-unit:assert-equal
'(1 0 1 1 0 1 1 2 1 2 2)
(with-data (probabilities vector-double 3)
(setf (data probabilities) #(0.25d0 0.5d0 0.25d0))
;; Must have two letms because the vector value is not set until
;; the body, but the discrete-random needs that set value.
(letm ((probabilities (vector-double #(0.25d0 0.5d0 0.25d0))))
(letm ((table (discrete-random probabilities))
(rng (random-number-generator *mt19937* 0)))
(loop for i from 0 to 10
collect
(discrete *rng-mt19937* table))))
(discrete rng table))))
(lisp-unit:assert-first-fp-equal
"0.500000000000d+00"
(with-data (probabilities vector-double 3)
(setf (data probabilities)
#(0.25d0 0.5d0 0.25d0))
(letm ((probabilities (vector-double #(0.25d0 0.5d0 0.25d0))))
(letm ((table (discrete-random probabilities)))
(discrete-pdf 1 table))))))
;********************************************************
; file: exponential-power.lisp
; description: Exponential power distribution
; date: Sat Sep 30 2006
; author: Liam M. Healy
; modified: Sat Sep 30 2006 - 19:03
;********************************************************
;;; $Id: $
;; Exponential power distribution
;; Liam Healy, Sat Sep 30 2006
;; Time-stamp: <2008-02-03 11:12:27EST exponential-power.lisp>
;; $Id: $