Skip to content

Commit 2f4ae7d

Browse files
committed
Show residual norm on failure of Taylor gradient
1 parent 6e9b88c commit 2f4ae7d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/optimize.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ function taylor_grad_step!(
619619
α = -1im * dt
620620
mul!(Ψ̃, α, ϕₙ₋₁)
621621

622+
r = 0.0
623+
622624
for n = 2:max_order
623625

624626
mul!(ϕₙ, Ĥ, ϕₙ₋₁) # matrix-vector product
@@ -641,7 +643,9 @@ function taylor_grad_step!(
641643

642644
if check_convergence && max_order > 1
643645
# should have returned inside the loop
644-
error("taylor_grad_step! did not converge within $max_order iterations")
646+
error(
647+
"taylor_grad_step! did not converge within $max_order iterations. Residual term r=$r."
648+
)
645649
else
646650
return Ψ̃
647651
end

0 commit comments

Comments
 (0)