asa053
asa053,
a C code which
returns samples from the Wishart distribution.
As far as I can tell, there are two mistakes in the printed text
of the algorithm; one involves incorrectly determining the number
of degrees of freedom for the ChiSquared distribution; the
other omits an absolute value sign when inverting the WilsonHilferty
formula, so that square roots of negative values are occasionally
requested. These mistakes have been corrected here.
Licensing:
The computer code and data files made available on this
web page are distributed under
the MIT license
Languages:
asa053 is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
asa053_test
wishart,
a C code which
produces sample matrices from the Wishart or Bartlett distributions,
useful for sampling random covariance matrices.
Reference:

Stanley Sawyer,
Wishart Distributions and InverseWishart Sampling,
Washington University,
30 April 2007, 12 pages.

William Smith, Ronald Hocking,
Algorithm AS 53, Wishart Variate Generator,
Applied Statistics,
Volume 21, Number 3, pages 341345, 1972.
Source Code:

i4_max.c,
returns the maximum of two I4s.

i4_min.c,
returns the minimum of two I4's.

r8_uniform_01.c,
returns a unit pseudorandom R8.

r8mat_print.c,
prints an R8MAT.

r8mat_print_some.c,
prints some of an R8MAT.

r8pp_print.c,
prints an R8PP matrix.

r8pp_print_some.c,
prints some of an R8PP matrix.

r8utp_print.c,
prints an R8UTP matrix.

r8utp_print_some.c,
prints some of an R8UTP matrix.

rnorm.c,
returns two independent standard random normal deviates.

wshrt.c,
returns a random Wishart variate.
Last revised on 12 August 2022.