Matern

class probnum.diffeq.Matern(ordint: int, spatialdim: int, lengthscale: float, diffconst: float, precond_step: float = 1.0)[source]

Bases: probnum.diffeq.odefiltsmooth.prior.ODEPrior

Matern(q) prior –> Matern process with reg. q+0.5 and hence, with matrix size q+1

F = I_d otimes F L = I_d otimes L = I_d otimes diffconst*(0, …, 1) Q = I_d

Attributes Summary

diffusionmatrix Evaluates Q.
dimension Spatial dimension (utility attribute).
dispersionmatrix
driftmatrix
force
inverse_preconditioner Convenience property to return the readily-computed inverse preconditioner without having to remember abbreviations.
preconditioner Convenience property to return the readily-computed preconditioner without having to remember abbreviations.

Methods Summary

__call__(arr_or_rv, RandomVariable], start, …) Transition a random variable or a realization of one.
dispersion(time, state, **kwargs) Evaluates l(t, x(t)) = L(t).
drift(time, state, **kwargs) Evaluates f(t, x(t)) = F(t) x(t) + u(t).
jacobian(time, state, **kwargs) maps t -> F(t)
precond2nordsieck(step) Computes preconditioner inspired by Nordsieck.
proj2coord(coord) Projection matrix to \(i\)-th coordinates.
transition_realization(real, start, stop, …) Transition a realization of a random variable from time \(t\) to time \(t+\Delta t\).
transition_rv(rv, start, stop, **kwargs) Transition a random variable from time \(t\) to time \(t+\Delta t\).

Attributes Documentation

diffusionmatrix

Evaluates Q.

dimension

Spatial dimension (utility attribute).

dispersionmatrix
driftmatrix
force
inverse_preconditioner

Convenience property to return the readily-computed inverse preconditioner without having to remember abbreviations.

Returns:Inverse preconditioner matrix \(P^{-1}\)
Return type:np.ndarray, shape=(d(q+1), d(q+1))
preconditioner

Convenience property to return the readily-computed preconditioner without having to remember abbreviations.

Returns:Preconditioner matrix \(P\)
Return type:np.ndarray, shape=(d(q+1), d(q+1))

Methods Documentation

__call__(arr_or_rv: Union[numpy.ndarray, RandomVariable], start: float = None, stop: float = None, **kwargs) -> ('RandomVariable', typing.Dict)

Transition a random variable or a realization of one.

The input is either interpreted as a random variable or as a realization. Accordingly, the respective methods are called: transition_realization() or transition_rv().

dispersion(time, state, **kwargs)

Evaluates l(t, x(t)) = L(t).

drift(time, state, **kwargs)

Evaluates f(t, x(t)) = F(t) x(t) + u(t).

jacobian(time, state, **kwargs)

maps t -> F(t)

precond2nordsieck(step: float) -> (<class 'numpy.ndarray'>, <class 'numpy.ndarray'>)

Computes preconditioner inspired by Nordsieck.

Computes the matrix \(P\) given by

\[P = I_d \otimes diag (1, h, h^2, ..., h^q)\]

as well as its inverse \(P^{-1}\).

Parameters:step (float) – Step size \(h\) used for preconditioning. If \(h\) is so small that \(h^q! < 10^{-15}\), it is being set to \(h = (\cdot 10^{-15})^{1/q}\).
Returns:
  • precond (np.ndarray, shape=(d(q+1), d(q+1))) – Preconditioner matrix \(P\).
  • invprecond (np.ndarray, shape=(d(q+1), d(q+1))) – Inverse preconditioner matrix \(P^{-1}\).
proj2coord(coord: int) → numpy.ndarray

Projection matrix to \(i\)-th coordinates.

Computes the matrix

\[H_i = \left[ I_d \otimes e_i \right] P^{-1},\]

where \(e_i\) is the \(i\)-th unit vector, that projects to the \(i\)-th coordinate of a vector. If the ODE is multidimensional, it projects to each of the \(i\)-th coordinates of each ODE dimension.

Parameters:coord (int) – Coordinate index \(i\) which to project to. Expected to be in range \(0 \leq i \leq q + 1\).
Returns:Projection matrix \(H_i\).
Return type:np.ndarray, shape=(d, d*(q+1))
transition_realization(real, start, stop, **kwargs)

Transition a realization of a random variable from time \(t\) to time \(t+\Delta t\).

For random variable \(x_t\), it returns the random variable defined by

\[x_{t + \Delta t} \sim p(x_{t + \Delta t} | x_t = r) .\]

This is different to transition_rv() which computes the parametrization of \(x_{t + \Delta t}\) based on the parametrization of \(x_t\).

Nb: Think of transition as a verb, i.e. this method “transitions” a realization of a random variable.

Parameters:
  • real – Realization of the random variable.
  • start – Starting point \(t\).
  • stop – End point \(t + \Delta t\).
Returns:

  • RandomVariable – Random variable, describing the state at time \(t + \Delta t\) based on realization at time \(t\).
  • dict – Additional information in form of a dictionary, for instance the cross-covariance in the prediction step, access to which is useful in smoothing.

See also

transition_rv()
Apply transition to a random variable.
transition_rv(rv, start, stop, **kwargs)

Transition a random variable from time \(t\) to time \(t+\Delta t\).

For random variable \(x_t\), it returns the random variable defined by

\[x_{t + \Delta t} \sim p(x_{t + \Delta t} | x_t) .\]

This returns a random variable where the parametrization depends on the paramtrization of \(x_t\). This is different to transition_rv() which computes the parametrization of \(x_{t + \Delta t}\) based on a realization of \(x_t\).

Nb: Think of transition as a verb, i.e. this method “transitions” a random variable.

Parameters:
  • rv – Realization of the random variable.
  • start – Starting point \(t\).
  • stop – End point \(t + \Delta t\).
Returns:

  • RandomVariable – Random variable, describing the state at time \(t + \Delta t\) based on realization at time \(t\).
  • dict – Additional information in form of a dictionary, for instance the cross-covariance in the prediction step, access to which is useful in smoothing.

See also

transition_realization()
Apply transition to a realization of a random variable.