Random

Gaussian

An \(m \times n\) matrix is Gaussian if each entry is independently drawn from a normal distribution.

void Gaussian(Matrix<T> &A, int m, int n, T mean = 0, Base<T> stddev = 1)
void Gaussian(DistMatrix<T, U, V> &A, int m, int n, T mean = 0, Base<T> stddev = 1)

Sets the matrix A to an \(m \times n\) Gaussian matrix with the specified mean and standard deviation.

void MakeGaussian(Matrix<T> &A, T mean = 0, Base<T> stddev = 1)
void MakeGaussian(DistMatrix<T, U, V> &A, T mean = 0, Base<T> stddev = 1)

Changes each entry to an independent sample from the specified normal distribution.

Wigner

A Hermitian matrix whose entries in one triangle are all independent samples from a normal distribution. The spectra of these matrices are well-studied.

void Wigner(Matrix<T> &A, int n, T mean = 0, Base<T> stddev = 1)
void Wigner(DistMatrix<T, U, V> &A, int n, T mean = 0, Base<T> stddev = 1)

Sets the matrix A to an \(n \times n\) Wigner matrix with the specified mean and standard deviation.

Haar

The Haar distribution is the uniform distribution over the space of real or complex unitary matrices.

void Haar(Matrix<F> &A, int n)
void Haar(DistMatrix<F> &A, int n)

Draws A from the Haar distribution. The current scheme performs a QR factorization of a Gaussian matrix, but Stewart introduced a well-known scheme which only requires quadratic work for the implicit representation as a product of random Householder reflectors.

void ImplicitHaar(Matrix<F> &A, Matrix<F> &t, int n)
void ImplicitHaar(DistMatrix<F> &A, DistMatrix<F, MD, STAR> &t, int n)

Sets A to a set of Householder reflectors with the same structure as the result of a QR decomposition. The product of these reflectors is a sample from the Haar distribution.

Uniform

We call an \(m \times n\) matrix is uniformly random if each entry is drawn from a uniform distribution over some ball \(B_r(x)\), which is centered around some point \(x\) and of radius \(r\).

void Uniform(Matrix<T> &A, int m, int n, T center = 0, Base<T> radius = 1)
void Uniform(DistMatrix<T, U, V> &A, int m, int n, T center = 0, Base<T> radius = 1)

Set the matrix A to an \(m \times n\) matrix with each entry sampled from the uniform distribution centered at center with radius radius.

void MakeUniform(Matrix<T> &A, T center = 0, Base<T> radius = 1)
void MakeUniform(DistMatrix<T, U, V> &A, T center = 0, Base<T> radius = 1)

Sample each entry of A from \(U(B_r(x))\), where \(r\) is given by radius and \(x\) is given by center.

HermitianUniformSpectrum

These routines sample a diagonal matrix from the specified interval of the real line and then perform a similarity transformation using a random Householder transform.

void HermitianUniformSpectrum(Matrix<F> &A, int n, Base<F> lower = 0, Base<F> upper = 1)
void HermitianUniformSpectrum(DistMatrix<F, U, V> &A, int n, Base<F> lower = 0, Base<F> upper = 1)

Build the \(n \times n\) matrix A with a spectrum sampled uniformly from the interval \((lower,upper]\).

void MakeHermitianUniformSpectrum(Matrix<F> &A, Base<F> lower = 0, Base<F> upper = 1)
void MakeHermitianUniformSpectrum(DistMatrix<F, U, V> &A, Base<F> lower = 0, Base<F> upper = 1)

Sample the entries of the square matrix A from the interval \((lower,upper]\).

NormalUniformSpectrum

These routines sample a diagonal matrix from the specified ball in the complex plane and then perform a similarity transformation using a random Householder transform.

void NormalUniformSpectrum(Matrix<Complex<Real>> &A, int n, Complex<Real> center = 0, Real radius = 1)
void NormalUniformSpectrum(DistMatrix<Complex<Real>, U, V> &A, int n, Complex<Real> center = 0, Real radius = 1)

Build the \(n \times n\) matrix A with a spectrum sampled uniformly from the ball \(B_{\mathrm{radius}}(\mathrm{center})\).

void MakeNormalUniformSpectrum(Matrix<Complex<Real>> &A, Complex<Real> center = 0, Real radius = 1)
void MakeNormalUniformSpectrum(DistMatrix<Complex<Real>, U, V> &A, Complex<Real> center = 0, Real radius = 1)

Sample the entries of the square matrix A from the ball in the complex plane centered at center with radius radius.