Documentation ¶
Overview ¶
Package distmat provides probability distributions over matrices.
Index ¶
- type Wishart
- func (w *Wishart) LogProbSym(x mat64.Symmetric) float64
- func (w *Wishart) LogProbSymChol(cholX *mat64.Cholesky) float64
- func (w *Wishart) MeanSym(x *mat64.SymDense) *mat64.SymDense
- func (w *Wishart) ProbSym(x mat64.Symmetric) float64
- func (w *Wishart) RandChol(c *mat64.Cholesky) *mat64.Cholesky
- func (w *Wishart) RandSym(x *mat64.SymDense) *mat64.SymDense
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wishart ¶
type Wishart struct {
// contains filtered or unexported fields
}
Wishart is a distribution over d×d positive symmetric definite matrices. It is parametrized by a scalar degrees of freedom parameter ν and a d×d positive definite matrix V.
The Wishart PDF is given by
p(X) = [|X|^((ν-d-1)/2) * exp(-tr(V^-1 * X)/2)] / [2^(ν*d/2) * |V|^(ν/2) * Γ_d(ν/2)]
where X is a d×d PSD matrix, ν > d-1, |·| denotes the determinant, tr is the trace and Γ_d is the multivariate gamma function.
See https://en.wikipedia.org/wiki/Wishart_distribution for more information.
func NewWishart ¶
NewWishart returns a new Wishart distribution with the given shape matrix and degrees of freedom parameter. NewWishart returns whether the creation was successful.
NewWishart panics if nu <= d - 1 where d is the order of v.
func (*Wishart) LogProbSym ¶
LogProbSym returns the log of the probability of the input symmetric matrix.
LogProbSym returns -∞ if the input matrix is not positive definite (the Cholesky decomposition fails).
func (*Wishart) LogProbSymChol ¶
LogProbSymChol returns the log of the probability of the input symmetric matrix given its Cholesky decomposition.
func (*Wishart) MeanSym ¶
MeanSym returns the mean matrix of the distribution as a symmetric matrix. If x is nil, a new matrix is allocated and returned. If x is not nil, the result is stored in-place into x and MeanSym will panic if the order of x is not equal to the order of the receiver.
func (*Wishart) ProbSym ¶
ProbSym returns the probability of the symmetric matrix x. If x is not positive definite (the Cholesky decomposition fails), it has 0 probability.