Skip to content

Commit 3c44f93

Browse files
committed
Ensure that iteration is the same length for preconditioner
1 parent 7be380b commit 3c44f93

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

varipeps/optimization/optimizer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def apply_precond(x):
192192
x = [
193193
apply_contraction_jitted(contraction, (te.tensor,), (te,), (xe,))
194194
+ norm_grad_square * xe
195-
for te, xe in zip(t_objs, x, strict=True)
195+
for te, xe in zip(t_objs, x[: len(t_objs)], strict=True)
196196
]
197197

198198
return _make_1d(x)
@@ -863,7 +863,9 @@ def random_noise(a):
863863
)[0]
864864
for te, xe in zip(
865865
working_unitcell.get_unique_tensors(),
866-
descent_dir,
866+
descent_dir[
867+
: working_unitcell.get_len_unique_tensors()
868+
],
867869
strict=True,
868870
)
869871
]

0 commit comments

Comments
 (0)