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

H

Hermitian adjoint.

T

Transpose this linear operator.

count

dtype

n_pts

Return the number of points covered.

ndim

shape

Shape of the covariance matrix (n, n).

solvematvecs

Methods

adjoint

Hermitian adjoint.

dot

Matrix-matrix or matrix-vector multiplication.

get_diagonal

Return the diagonal entries of the matrix (variances).

itercount

Return the cumulated number of GMRES matrix-vector products performed.

matmat

Matrix-matrix multiplication.

matvec

Matrix-vector multiplication.

reset_comptors

Reset the internal call counters (count and solvematvecs) to zero.

rmatmat

Adjoint matrix-matrix multiplication.

rmatvec

Adjoint matrix-vector multiplication.

solve

Solve Ax = b, with A, the current covariance matrix instance.

todense

Explicit dense representation of the covariance matrix.

transpose

Transpose this linear operator.