dubfi.linalg.dense¶
Dense numpy array implementation of generic linear algebra types.
Added in version 0.1.0: (initial release)
Classes¶
Operator represented by a dense matrix. |
|
Linear parametrized simple dense vector. |
|
Dense operator constructed based on a flux ensemble without localization. |
|
Dense operator constructed based on a flux ensemble with localization. |
|
Diagonal operator constructed based on a flux ensemble. |
Module Contents¶
- class dubfi.linalg.dense.DenseMatrix(array)¶
Bases:
dubfi.linalg.types.AbstractOperatorOperator represented by a dense matrix.
- Parameters:
array (numpy.ndarray)
- property shape: tuple[int, Ellipsis]¶
Shape of array (matrix) representation of self.
- Return type:
tuple[int, Ellipsis]
- property data: numpy.ndarray¶
Numpy array (matrix) representation of self.
- Return type:
numpy.ndarray
- tonumpy()¶
Numpy array (matrix) representation of self.
- Return type:
numpy.ndarray
- diagonal()¶
Return copy of the diagonal of self.
- __mul__(other)¶
Multiply element-wise.
- __imul__(other)¶
Multiply element-wise in-place.
- Return type:
Self
- __add__(other)¶
Add two linear operators.
- __iadd__(other)¶
Add two linear operators in-place.
- __sub__(other)¶
Subtract other operator.
- __isub__(other)¶
Subtract other operator in-place.
- apply(vec)¶
Apply operator on vector: self @ vec.
- rapply(vec)¶
Apply transpose operator on vector: self.T @ vec.
- inv()¶
Compute (multiplicative) inverse operator.
- solve(vec)¶
Solve linear equation self @ x = vec for x.
- chain(other)¶
Combine operators: self @ other.
- trace()¶
Compute trace of self.
- trace_product(other)¶
Compute trace of (self @ other).
- logdet()¶
Compute log(det(self)) assuming that self is a positive definite, real-symmetric matrix.
- dot(other)¶
Inner product along non-vector dimensions.
- class dubfi.linalg.dense.LinParamVector(array)¶
Bases:
dubfi.linalg.generic.ParametrizedVectorLinear parametrized simple dense vector.
- __call__(s)¶
Vector at given parameter array.
- grad(s)¶
Gradient w.r.t. parameters s.
- hess(s)¶
Hesse matrix w.r.t. parameters s.
- class dubfi.linalg.dense.DenseEnsLinPostRNoloc(h_ensemble)¶
Bases:
dubfi.linalg.generic.ParametrizedOperatorDense operator constructed based on a flux ensemble without localization.
- __call__(s)¶
Operator at given parameter array.
- grad(s)¶
Gradient w.r.t. parameters s.
- grad_vec(s, vec)¶
Equivalent to self.grad(s) @ vec.
- hess(s)¶
Hesse matrix w.r.t. parameters s.
- hess_vec(s, vec)¶
Equivalent to self.hess(s) @ vec.
- vec_hess_vec(s, left, right)¶
Equivalent to left @ (self.hess(s) @ right).
- class dubfi.linalg.dense.DenseEnsLinPostR(h_ensemble, loc, regularization=0.0, bg_ens=None, bc_ens=None)¶
Bases:
dubfi.linalg.generic.ParametrizedOperatorDense operator constructed based on a flux ensemble with localization.
Ensemble-based parametrized linear operator with localization.
- Parameters:
h_ensemble (np.ndarray) – shape (ensemble, state, observations) array representing the observation operator in the different ensemble members.
loc (np.ndarray) – shape (observations, observations) array for suppressing correlations in the ensemble estimate
regularization (float | np.ndarray, optional) – regularization term added to the diagonal of self.
bg_ens (np.ndarray, optional) – ensemble of background concentrations, must be the same ensemble as used for h_ensemble.
bc_ens (np.ndarray, optional) – ensemble to estimate the boundary condition uncertainty, must be an independent ensemble from bg_ens and h_ensemble.
- set_bg_ens(bg_ens)¶
Set the background (or total concentration) meteorological ensemble.
- Parameters:
bg_ens (numpy.ndarray)
- Return type:
None
- set_bc_ens(bc_ens)¶
Set boundary condition ensemble.
- Parameters:
bc_ens (numpy.ndarray)
- Return type:
None
- __call__(s)¶
Compute operator at given parameter vector s.
- grad(s)¶
Gradient at given parameter vector s.
- hess(s)¶
Hesse matrix at given parameter vector s.
- class dubfi.linalg.dense.DiagonalEnsLinPostR(h_ensemble, regularization=0.0, bg_ens=None)¶
Bases:
dubfi.linalg.generic.ParametrizedOperatorDiagonal operator constructed based on a flux ensemble.
- Parameters:
h_ensemble (numpy.ndarray)
regularization (float | numpy.ndarray)
bg_ens (None | numpy.ndarray)
- set_bg_ens(bg_ens)¶
Set the background (or total concentration) meteorological ensemble.
- Parameters:
bg_ens (numpy.ndarray)
- Return type:
None
- __call__(s)¶
Compute operator at given parameter vector s.
- grad(s)¶
Gradient at given parameter vector s.
- hess(s)¶
Hesse matrix at given parameter vector s.