gpflow.models.cglb

gpflow.models.cglb.NystromPreconditioner

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

Bases: object

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

Methods

__call__(v)

Computes \(vᵀQ^{-1}\) and vᵀQ^{-1}v.

Parameters
  • A (Tensor) –

  • LB (Tensor) –

  • sigma_sq (float) –

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 \(v_0, v_1, v_2, ..., v_N\) such that \(v_0\) = initial, and (in exact arithmetic) \(Kv_n = b\). In practice, the v_i often converge quickly to approximate \(K^{-1}b\), and the algorithm can be stopped without running N iterations.

We assume the preconditioner, \(Q\), satisfies \(Q ≺ K\), and stop the algorithm when \(r_i = b - Kv_i\) satisfies \(||rᵢᵀ||_{Q⁻¹r}^2 = rᵢᵀQ⁻¹rᵢ <= ϵ\).

Parameters
  • K – Matrix we want to backsolve from. Must be PSD. Shape [N, N].

  • b – Vector we want to backsolve. Shape [B, N].

  • initial – Initial vector solution. Shape [N].

  • preconditioner – Preconditioner function.

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

  • max_steps – Maximum number of CG iterations.

  • restart_cg_step – 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.

Returns

v where v approximately satisfies \(Kv = b\).