xnn.common.models.eeq.lu_solve_refined#

xnn.common.models.eeq.lu_solve_refined(lu, pivots, full, rhs, rounds)[source]#

full^-1 @ rhs from the LU factor of full, with rounds rounds of iterative refinement.

A float32 factor alone leaves the charges and, through the adjoint, the forces well short of the float32 matrix’s own accuracy. Each round (residual of the current solution, in float64 when the factor is float32, solved with the same factor and added back) recovers about four digits; one round brings the solution to the accuracy of the float32 matrix itself. rounds=0 is the plain LAPACK solution. Scriptable; when full and rhs carry gradients, autograd runs through the factor as well, which costs O(N^3) in the backward (see lu_solve_implicit() for the O(N^2) form).

Parameters:
Return type:

Tensor