fn build_b_matrix(errors: &[DVector<f64>]) -> DMatrix<f64>Expand description
Builds the B matrix for GDIIS optimization.
The B matrix is the core of the DIIS method, containing dot products of error vectors plus constraint equations. It has the structure:
B = [ e₁·e₁ e₁·e₂ ... e₁·eₙ 1 ]
[ e₂·e₁ e₂·e₂ ... e₂·eₙ 1 ]
[ ... ... ... ... 1 ]
[ eₙ·e₁ eₙ·e₂ ... eₙ·eₙ 1 ]
[ 1 1 ... 1 0 ]where eᵢ·eⱼ represents the dot product of error vectors i and j.
§Arguments
errors- Vector of error vectors fromcompute_error_vectors
§Returns
Returns the (n+1) × (n+1) B matrix where n is the number of error vectors. The extra row and column enforce the constraint that coefficients sum to 1.
§Mathematical Background
The B matrix is used in solving the DIIS equations:
B * c = [0, 0, ..., 0, 1]ᵀwhere c contains the interpolation coefficients and the Lagrange multiplier.