# Matrix-variate Distributions

*Matrix-variate distributions* are the distributions whose variate forms are `Matrixvariate`

(*i.e* each sample is a matrix). Abstract types for matrix-variate distributions:

## Common Interface

Both distributions implement the same set of methods:

`Base.size`

— Method.`size(d::MatrixDistribution)`

Return the size of each sample from distribution `d`

.

`Base.length`

— Method.`length(d::MatrixDistribution)`

The length (*i.e* number of elements) of each sample from the distribution `d`

.

`Statistics.mean`

— Method.`mean(d::MatrixDistribution)`

Return the mean matrix of `d`

.

`Distributions.pdf`

— Method.`pdf(d::MatrixDistribution, x::AbstractArray)`

Compute the probability density at the input matrix `x`

.

`Distributions.logpdf`

— Method.`logpdf(d::MatrixDistribution, AbstractMatrix)`

Compute the logarithm of the probability density at the input matrix `x`

.

`Base.rand`

— Method.`rand(d::MatrixDistribution, n)`

Draw a sample matrix from the distribution `d`

.

## Distributions

`Distributions.Wishart`

— Type.`Wishart(nu, S)`

The Wishart distribution is a multidimensional generalization of the Chi-square distribution, which is characterized by a degree of freedom ν, and a base matrix S.

`Distributions.InverseWishart`

— Type.`InverseWishart(nu, P)`

The Inverse Wishart distribution is usually used as the conjugate prior for the covariance matrix of a multivariate normal distribution, which is characterized by a degree of freedom ν, and a base matrix Φ.

## Internal Methods (for creating your own matrix-variate distributions)

`Distributions._logpdf`

— Method.`_logpdf(d::MatrixDistribution, x::AbstractArray)`

Evaluate logarithm of pdf value for a given sample `x`

. This function need not perform dimension checking.