jexplore.tools.covariance

jexplore.tools.covariance#

This modules provides the Basic functions for covariance computation.

Functions#

compute_cov(samples[, covs, cholesky, default])

Compute the covariance from a set of samples

Module Contents#

compute_cov(samples, covs=None, cholesky=True, default=0.001)[source]#

Compute the covariance from a set of samples

Parameters:
  • samples (array) – array of the past samples (nchains, dim, npoints).

  • covs (array) – (nchain, dim, dim) array bearing one covariance matrices of all chains. Default: None, i.e. the covariance matrices are computed from samples.

  • cholesky (bool) – if true returns the array of lower triangular matrices resulting from cholesky decomposition of the convariance matrices of all chains. Otherwise it returns the array of the covariance matrices. Default: True.

  • default (float) – if covs is none and the samples only have 1 point the function will return a constant diagonal covariance for all chains. This parameters provides the value for the covariance diagonal terms in this case. Defaut: 1e-3.

Returns:

array of the covariance matricaes of the chains or of their cholesky lower triangular matrices.

Return type:

array