Skip to main content
← OpenMECP Documentation

compute_error_vectors

Function compute_error_vectors 

Source
fn compute_error_vectors(
    grads: &VecDeque<DVector<f64>>,
    f_vecs: &VecDeque<DVector<f64>>,
    hessians: &VecDeque<DMatrix<f64>>,
) -> Vec<DVector<f64>> 
Expand description

Computes error vectors for GDIIS optimization.

Error vectors in GDIIS are computed as the solution to H^(-1) * g, where H is the Hessian approximation and g is the gradient. These error vectors represent the “Newton step” that would be taken at each point in the history and are used to construct the DIIS interpolation matrix.

§Arguments

  • grads - History of gradient vectors from previous iterations
  • hessians - History of Hessian approximations from previous iterations

§Returns

Returns a vector of error vectors, one for each iteration in the history. Each error vector has the same dimension as the gradient vectors.

§Algorithm

For each iteration i:

error[i] = H[i]^(-1) * g[i]

If the Hessian is singular, falls back to using the gradient directly.