Skip to content

Commit

Permalink
[ITensors] Fix non-QN eigen with auto-fermion enabled (#1380)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored Apr 4, 2024
1 parent f3a9dd0 commit ec6af32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tensor_operations/matrix_decomposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ function eigen(
end

# <fermions>
if using_auto_fermion()
if hasqns(A) && using_auto_fermion()
if !all(i -> dir(i) == Out, Lis)
error("With auto_fermion enabled, left inds in eigen must have Out arrows")
end
Expand Down
9 changes: 9 additions & 0 deletions test/base/test_fermions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -768,5 +768,14 @@ import ITensors: Out, In
end
end # Regression Tests

@testset "Non-QN eigen Regression Test" begin
# Test that non-QN eigen runs properly
# with auto-fermion enabled.
i = Index(2)
a = randomITensor(i', i)
d, u = eigen(a)
@test norm(a * u - u' * d) 0 atol = (eps(real(eltype(a))))
end

ITensors.disable_auto_fermion()
end

0 comments on commit ec6af32

Please sign in to comment.