add some comments

This commit is contained in:
jan 2022-11-22 22:21:31 -08:00
parent a64afcbe4d
commit dfbb845bee

View File

@ -559,7 +559,8 @@ def eigsolve(
E_signed = real(trace(ZtAZU)) E_signed = real(trace(ZtAZU))
sgn = numpy.sign(E_signed) sgn = numpy.sign(E_signed)
E = numpy.abs(E_signed) E = numpy.abs(E_signed)
G = (AZ @ U - Z @ U @ ZtAZU) * sgn G = (AZ @ U - Z @ U @ ZtAZU) * sgn # G = AZU projected onto the space orthonormal to Z
# via (1 - ZUZt)
if i > 0 and abs(E - prev_E) < tolerance * 0.5 * (E + prev_E + 1e-7): if i > 0 and abs(E - prev_E) < tolerance * 0.5 * (E + prev_E + 1e-7):
logger.info('Optimization succeded: ' logger.info('Optimization succeded: '
@ -568,8 +569,8 @@ def eigsolve(
) )
break break
KG = scipy_iop @ G KG = scipy_iop @ G # Preconditioned steepest descent direction
traceGtKG = _rtrace_AtB(G, KG) traceGtKG = _rtrace_AtB(G, KG) #
if prev_traceGtKG == 0 or i % reset_iters == 0: if prev_traceGtKG == 0 or i % reset_iters == 0:
logger.info('CG reset') logger.info('CG reset')