gpflow.models.cglb#

Classes#

gpflow.models.cglb.NystromPreconditioner#

class gpflow.models.cglb.NystromPreconditioner(A, LB, sigma_sq)[source]#

Bases: object

Preconditioner of the form Q=(Qff+σ²I)¹, where L is lower triangular with :math: LLᵀ = Kᵤᵤ A=σ²L¹K and B=AA+I=LL

Parameters
  • A (Tensor) –

  • LB (Tensor) –

  • sigma_sq (float) –

Functions#

gpflow.models.cglb.cglb_conjugate_gradient#

gpflow.models.cglb.cglb_conjugate_gradient(K, b, initial, preconditioner, cg_tolerance, max_steps, restart_cg_step)[source]#

Conjugate gradient algorithm used in CGLB model. The method of conjugate gradient (Hestenes and Stiefel, 1952) produces a sequence of vectors v0,v1,v2,...,vN such that v0 = initial, and (in exact arithmetic) Kvn=b. In practice, the v_i often converge quickly to approximate K1b, and the algorithm can be stopped without running N iterations.

We assume the preconditioner, Q, satisfies QK, and stop the algorithm when ri=bKvi satisfies ||r||Q¹r2=rQ¹r<=ϵ.

Parameters
  • K (Union[ndarray[Any, Any], Tensor, Variable, Parameter]) – Matrix we want to backsolve from. Must be PSD. Shape [N, N].

  • b (Union[ndarray[Any, Any], Tensor, Variable, Parameter]) – Vector we want to backsolve. Shape [B, N].

  • initial (Union[ndarray[Any, Any], Tensor, Variable, Parameter]) – Initial vector solution. Shape [N].

  • preconditioner (NystromPreconditioner) – Preconditioner function.

  • cg_tolerance (float) – Expected maximum error. This value is used as a decision boundary against stopping criteria.

  • max_steps (int) – Maximum number of CG iterations.

  • restart_cg_step (int) – Restart step at which the CG resets the internal state to the initial position using the currect solution vector v. Can help avoid build up of numerical errors.

Return type

Tensor

Returns

v where v approximately satisfies Kv=b.