covmats.CovKernelAsLinopViaFFT#
- class covmats.CovKernelAsLinopViaFFT(*args, **kwargs)[source]#
Represents a fast fourier transform covariance matrix.
FFT based operations if kernel is stationary or translation invariant and points are on a regular grid.
Notes
This FFT-based code is a reimplementation of Arvind Saibaba’s work (arvindks/kle).
TODO: add references.
- __init__(kernel, mesh_dim: float | ndarray[tuple[Any, ...], dtype[floating]] | Sequence[float], domain_shape: int | ndarray[tuple[Any, ...], dtype[integer]] | Sequence[int], len_scale: ndarray[tuple[Any, ...], dtype[floating]], nugget: float = 0.0, k: int = 100, is_use_preconditioner: bool = False) None[source]#
Initialize the instance.
- Parameters:
kernel (Callable) – Covariance kernel. It must accept an array of (scaled) distances and return the associated covariance values, e.g. an exponential or Matérn kernel.
mesh_dim (Union[float, NDArrayFloat, Sequence[float]]) – Dimensions of one mesh (grid cell) of the regular grid, one value per spatial dimension.
domain_shape (Union[int, NDArrayInt, Sequence[int]]) – Shape of the regular grid (number of grid cells along each axis). Supports 1D, 2D and 3D grids.
len_scale (NDArrayFloat) – Correlation length(s) used to scale the points coordinates before evaluating the kernel. Either a scalar (isotropic) or a vector with one length per dimension (anisotropic).
nugget (float, optional) – Nugget effect (diagonal regularization) added to the covariance matrix to improve its conditioning, by default 0.0 (no nugget).
k (int, optional) – Number of local centers in the preconditioner. Controls the sparity of the preconditioner. It should be inferior to the number of points. By default 100.
is_use_preconditioner (bool) – Whether to build the preconditioner at instance creation and use it to solve Ax = b systems. The default is False.
Properties
Hermitian adjoint.
Transpose this linear operator.
Return the number of points covered.
Shape of the covariance matrix (n, n).
Methods
Hermitian adjoint.
Matrix-matrix or matrix-vector multiplication.
Return the diagonal entries of the matrix (variances).
Return the cumulated number of GMRES matrix-vector products performed.
Matrix-matrix multiplication.
Matrix-vector multiplication.
Reset the internal call counters (count and solvematvecs) to zero.
Adjoint matrix-matrix multiplication.
Adjoint matrix-vector multiplication.
Solve Ax = b, with A, the current covariance matrix instance.
Explicit dense representation of the covariance matrix.
Transpose this linear operator.