covmats.SparseCholeskyFactor.colorize_inv_adjoint#
- SparseCholeskyFactor.colorize_inv_adjoint(y: ndarray[tuple[Any, ...], dtype[floating]]) ndarray[tuple[Any, ...], dtype[floating]][source]#
Perform the adjoint (transpose) of
SparseCholeskyFactor.colorize_inv().- Parameters:
y (array_like) – An array of points in data space, with the last dimension equal to
n_pts.- Returns:
y_ – The transformed array, same shape as y.
- Return type:
array_like
Note
Writing
colorize_inv()as the linear map \(\mathrm{colorize\_inv}(x) = \mathbf{P}^{T} \mathbf{L}^{-T} \mathbf{D}^{-1/2} x\) (colorize_inv()solves \(\mathbf{L}^{T} z = \mathbf{D}^{-1/2} x\) then applies \(\mathbf{P}^{T}\)), its adjoint is \(\mathrm{colorize\_inv}^{T}(y) = \mathbf{D}^{-1/2} \mathbf{L}^{-1} \mathbf{P} y\), obtained here by forward-solving \(\mathbf{L} z = \mathbf{P} y\) (lower-triangular, unlike the backward solve used bycolorize_inv()itself) and then applyingsqrtinvD.Examples
>>> import numpy as np >>> import scipy as sp >>> import covmats >>> rng = np.random.default_rng(0) >>> n = 4 >>> B = rng.random(size=(n, n)) >>> cov_array = B @ B.T + n * np.eye(n) >>> L, D, P = sp.linalg.ldl(cov_array) >>> scf = covmats.SparseCholeskyFactor( ... sp.sparse.csc_array(L), sp.sparse.csc_array(D), P ... ) >>> x = rng.standard_normal(n) >>> y = rng.standard_normal(n) >>> np.allclose( ... scf.colorize_inv(x[None, :])[0] @ y, ... x @ scf.colorize_inv_adjoint(y[None, :])[0], ... ) True