Skip to content

Commit f1c0378

Browse files
committed
Restore previous index testing in exp
1 parent 3363f26 commit f1c0378

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/tensor_operations/matrix_algebra.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,23 @@ function exp(A::ITensor, Linds, Rinds; ishermitian=false)
4343
end
4444
end
4545

46-
N = ndims(A)
4746
NL = length(Linds)
4847
NR = length(Rinds)
4948
NL != NR && error("Must have equal number of left and right indices")
50-
N != NL + NR &&
49+
ndims(A) != NL + NR &&
5150
error("Number of left and right indices must add up to total number of indices")
5251

5352
# Permute Lis, Ris to be in same order as on A
5453
Lis = permute(commoninds(A, Linds), Linds)
5554
Ris = permute(commoninds(A, Rinds), Rinds)
5655

57-
# Ensure the indices have the correct directions,
58-
# QNs, etc.
56+
# Ensure indices have correct directions, QNs, etc.
5957
for (l, r) in zip(Lis, Ris)
60-
dir_check = hasqns(A) ? dir(l) == dir(dag(r)) : true
61-
if !(dir_check && noprime(l) == noprime(r))
62-
dir_msg = hasqns(A) ? " and opposite directions" : ""
63-
error("In exp, indices must come in pairs with equal spaces$dir_msg.")
58+
if space(l) != space(r)
59+
error("In exp, indices must come in pairs with equal spaces.")
60+
end
61+
if hasqns(A) && dir(l) == dir(r)
62+
error("In exp, indices must come in pairs with opposite directions")
6463
end
6564
end
6665

0 commit comments

Comments
 (0)