Skip to content

Commit 5c9334c

Browse files
committed
Initial fix of arrows for dual, HPSD fermionic matrix
1 parent 0c95078 commit 5c9334c

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/tensor_operations/matrix_decomposition.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,17 +353,23 @@ function eigen(
353353
end
354354

355355
# <fermions>
356+
L_arrow_dir = Out
356357
if hasqns(A) && using_auto_fermion()
357-
if !all(i -> dir(i) == Out, Lis)
358-
error("With auto_fermion enabled, left inds in eigen must have Out arrows")
359-
end
360-
if !all(i -> dir(i) == In, Ris)
361-
error("With auto_fermion enabled, right inds in eigen must have Out arrows")
358+
# Make arrows of combined ITensor
359+
# match those of index sets
360+
# TODO: also support Out,Out and In,In cases?
361+
# I.e. through a R_arrow_dir variable?
362+
if all(i -> dir(i) == Out, Lis) && all(i -> dir(i) == In, Ris)
363+
L_arrow_dir = Out
364+
elseif all(i -> dir(i) == In, Lis) && all(i -> dir(i) == Out, Ris)
365+
L_arrow_dir = In
366+
else
367+
error("With auto_fermion enabled, index sets in eigen must have all arrows the same, and opposite between the sets")
362368
end
363369
end
364370

365-
CL = combiner(Lis...; dir=Out, tags="CMB,left")
366-
CR = combiner(dag(Ris)...; dir=Out, tags="CMB,right")
371+
CL = combiner(Lis...; dir=L_arrow_dir, tags="CMB,left")
372+
CR = combiner(dag(Ris)...; dir=L_arrow_dir, tags="CMB,right")
367373

368374
AC = A * dag(CR) * CL
369375

0 commit comments

Comments
 (0)