Open
Description
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