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