covmats.DriftMatrix#

class covmats.DriftMatrix(mat: ndarray[tuple[Any, ...], dtype[floating]], beta: ndarray[tuple[Any, ...], dtype[floating]] | float | None = None)[source]#

Represent a drift (trend) matrix prior term.

A drift matrix represents the prior mean of a spatial field as a linear combination of known basis functions (drift terms), such as a constant or a linear trend in the point coordinates:

\[\mathbf{m} = \mathbf{X} \boldsymbol{\beta}\]

with \(\mathbf{X}\) (mat) the matrix of drift basis functions with shape \((N_s, N_{\beta})\), and \(\boldsymbol{\beta}\) (beta) the associated drift coefficients with shape \((N_{\beta},)\). This is commonly used in universal kriging / geostatistical regularization to represent non-stationary trends on top of a stationary covariance model.

See also

ConstantDriftMatrix

Constant (order 0) drift.

LinearDriftMatrix

Linear (order 1) drift.

__init__(mat: ndarray[tuple[Any, ...], dtype[floating]], beta: ndarray[tuple[Any, ...], dtype[floating]] | float | None = None) → None[source]#

Initialize the instance.

Parameters:
  • mat (NDArrayFloat) – Matrix of drift basis functions (coefficients) \(\mathbf{X}\) with shape (Ns, Nbeta), Ns being the number of points and Nbeta the number of drift terms (e.g., 1 for a constant drift, 1 + Ndim for a linear drift).

  • beta (Optional[Union[NDArrayFloat, float]], optional) – Drift coefficients \(\boldsymbol{\beta}\) with shape (Nbeta,), by default None. Must be provided before calling DriftMatrix.get_values().

Raises:

ValueError – If the shape of beta does not match the number of columns of mat.

Properties

Methods

dot

Return the dot product.

get_gradient_dot_product

Return the dot product of the gradient of the prior and the given input vector.

get_values

Return the values of the prior term.