Skip to content

[ITensors] [BUG] exp(A::ITensor) not working with auto_fermion  #1188

Open
@JoeyT1994

Description

@JoeyT1994

When you enable auto_fermion, i.e. ITensors.enable_auto_fermion() then exp(A::ITensor) doesn't return the correct result.

Here is a minimal working example just building the identity matrix with exp (but the incorrect result propagates to exponentiating more complicated ITensors) and comparing to the correct result.

Minimal runnable code

using ITensors

ITensors.enable_auto_fermion()

n = 4
s = siteinds("Fermion", n; conserve_qns=true)

id_tensor = op("I", s[2])*op("I", s[3])
@show id_tensor


id_tensor_from_exp = exp(0.0 * id_tensor)
@show permute(id_tensor_from_exp, inds(id_tensor))

@show id_tensor == id_tensor_from_exp

Both of these methods should return the same, identity matrix but the one returned from exp is not (which you can check by applying it to a wavefunction) and has signs which are wrong.

Output of minimal runnable code

id_tensor = ITensor ord=4
Dim 1: (dim=2|id=147|"Fermion,Site,n=2")' <Out>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
Dim 2: (dim=2|id=147|"Fermion,Site,n=2") <In>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
Dim 3: (dim=2|id=164|"Fermion,Site,n=3")' <Out>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
Dim 4: (dim=2|id=164|"Fermion,Site,n=3") <In>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
NDTensors.BlockSparse{Float64, Vector{Float64}, 4}
 2×2×2×2
Block(1, 1, 1, 1)
 [1:1, 1:1, 1:1, 1:1]
[:, :, 1, 1] =
 1.0

Block(1, 1, 2, 2)
 [1:1, 1:1, 2:2, 2:2]
[:, :, 1, 1] =
 1.0

Block(2, 2, 1, 1)
 [2:2, 2:2, 1:1, 1:1]
[:, :, 1, 1] =
 1.0

Block(2, 2, 2, 2)
 [2:2, 2:2, 2:2, 2:2]
[:, :, 1, 1] =
 1.0
permute(id_tensor_from_exp, inds(id_tensor)) = ITensor ord=4
Dim 1: (dim=2|id=147|"Fermion,Site,n=2")' <Out>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
Dim 2: (dim=2|id=147|"Fermion,Site,n=2") <In>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
Dim 3: (dim=2|id=164|"Fermion,Site,n=3")' <Out>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
Dim 4: (dim=2|id=164|"Fermion,Site,n=3") <In>
 1: QN("Nf",0,-1) => 1
 2: QN("Nf",1,-1) => 1
NDTensors.BlockSparse{Float64, Vector{Float64}, 4}
 2×2×2×2
Block(1, 1, 1, 1)
 [1:1, 1:1, 1:1, 1:1]
[:, :, 1, 1] =
 1.0

Block(2, 2, 1, 1)
 [2:2, 2:2, 1:1, 1:1]
[:, :, 1, 1] =
 -1.0

Block(1, 2, 2, 1)
 [1:1, 2:2, 2:2, 1:1]
[:, :, 1, 1] =
 0.0

Block(2, 1, 1, 2)
 [2:2, 1:1, 1:1, 2:2]
[:, :, 1, 1] =
 -0.0

Block(1, 1, 2, 2)
 [1:1, 1:1, 2:2, 2:2]
[:, :, 1, 1] =
 -1.0

Block(2, 2, 2, 2)
 [2:2, 2:2, 2:2, 2:2]
[:, :, 1, 1] =
 -1.0
id_tensor == id_tensor_from_exp = false

Metadata

Metadata

Assignees

No one assigned

    Labels

    ITensorsIssues or pull requests related to the `ITensors` package.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions