covmats.CovViaEnsemble#

class covmats.CovViaEnsemble(*args, **kwargs)[source]#

Represents a covariance matrix as an ensemble of realizations.

For a given ensemble with shape (\(N_{s}\), \(N_{e}\)), the number of points and the number of members in the ensemble respectively, the covariance matrix \(\mathbf{\Sigma_{ss}}\) is approximated from the ensemble in the standard way of EnKF [Evensen, 2007, Aanonsen et al., 2009]:

\[\mathbf{\Sigma_{ss}} = \frac{1}{N_{e} - 1} \sum_{j=1}^{N_{e}}\left(s_{j} - \overline{s}\right)\left(s_{j} - \overline{s^{l}} \right)^{T}\]

Or by defining a matrix of anomalies \(\mathbf{A} = \mathbf{S} - \overline{\mathbf{S}}\) with shape (\(N_{s}\), \(N_{e}\)):

\[\mathbf{\Sigma_{ss}} = \frac{1}{N_{e} - 1} \mathbf{A}^{T}\mathbf{A}\]

Note

Practically, the dense covariance matrix is never built, only the anomalies matrix \(\mathbf{A}\) is used. The product between the inverse of the covariance matrix and a vector \(\mathbf{x} = \mathbf{\Sigma_{ss}}^{-1}\mathbf{b}\) is obtained solving the system \(\mathbf{A}^{T}\mathbf{Ax} = \mathbf{b}\), using gmres, where only anomalies matrix vector products are required.

References

  1. Geir Evensen. Data Assimilation - The Ensemble Kalman Filter. Springer Berlin Heidelberg, 2007. ISBN 978-3-642-03710-8. doi:10.1007/978-3-642-03711-5.

  2. Sigurd Aanonsen, Geir Nævdal, Dean Oliver, Albert Reynolds, and Brice Vallès. The Ensemble Kalman Filter in Reservoir Engineering–a Review. SPE Journal - SPE J, 14:393–412, September 2009. doi:10.2118/117274-PA.

__init__(ensemble: ndarray[tuple[Any, ...], dtype[float64]]) None[source]#

Initiate the instance.

Parameters:

ensemble (NDArrayFloat) – Ensemble of realization with shape (\(N_{e}\), \(N_{s}\)).

Properties

H

Hermitian adjoint.

T

Transpose this linear operator.

anomalies

Return the matrix of anomalies.

covariance

Explicit dense representation of the covariance matrix.

ensemble

log_pdet

Log of the pseudo-determinant of the covariance matrix.

n_ens

Return the number of members in the ensemble.

n_pts

Number of points in the domain (n).

ndim

precision

Explicit dense representation of the precision matrix with shape (n, n).

rank

Rank of the covariance matrix.

shape

Shape of the covariance matrix (n, n).

subspace_size

Subspace size of the covariance matrix.

Methods

adjoint

Hermitian adjoint.

colorize

Perform a colorizing transformation on data.

dot

Matrix-matrix or matrix-vector multiplication.

from_cholesky

Representation of a covariance provided via choleksy factorization.

from_diagonal

Representation of a covariance provided via diagonal.

from_eigendecomposition

Representation of a covariance provided via eigendecomposition.

from_precision

Return a representation of a covariance from its precision matrix.

get_diagonal

Return the diagonal entries of the matrix (variances).

get_trace

Return the trace of the covariance matrix (sum of diagonal elements).

matmat

Matrix-matrix multiplication.

matvec

Matrix-vector multiplication.

rmatmat

Adjoint matrix-matrix multiplication.

rmatvec

Adjoint matrix-vector multiplication.

sample_mvnormal

Draw samples from the multivariate normal N(0, A).

solve

Solve A^{T}Ax = b, with A, the anomalies matrix instance.

todense

Explicit dense representation of the covariance matrix with shape (n, n).

transpose

Transpose this linear operator.

whiten

Perform a whitening transformation on data.