Hi,
I have been using ITensors (v0.3) on a very regular basis for the last ~4 months (in Jupyter with its IJulia kernel, and Julia v1.9.0) for my ongoing projects and everything had been working fine until yesterday. Today all of a sudden nothing is working and every code I have is throwing up the same sort of errors even though I had made no changes to their previously saved versions and was merely re-running them for more data collection and testing. I went back to the Heisenberg spin chain examples for both DMRG and TEBD given in the documentation to see if they were running as they should (and did, in my own early education), but here too I am seeing the same errors as I saw with my own projects’ codes. I am showing the errors I have for both DMRG and TEBD of 1d Heisenberg chain. It’s as if my whole ITensors has corrupted or source codes missing or something all of a sudden. The only thing I did between previous runs of my codes and today’s runs was installing PastaQ (if that’s relevant an info at all).
TEBD
using ITensors
using ITensors.Strided
using LinearAlgebra
using Printf
using Random
let
N = 100
cutoff = 1E-8
tau = 0.1
ttotal = 2.0
# Make an array of 'site' indices
s = siteinds("S=1/2", N; conserve_qns=true)
# Make gates (1,2),(2,3),(3,4),...
gates = ITensor[]
for j in 1:(N - 1)
s1 = s[j]
s2 = s[j + 1]
hj =
op("Sz", s1) * op("Sz", s2) +
1 / 2 * op("S+", s1) * op("S-", s2) +
1 / 2 * op("S-", s1) * op("S+", s2)
Gj = exp(-im * tau / 2 * hj)
push!(gates, Gj)
end
# Include gates in reverse order too
# (N,N-1),(N-1,N-2),...
append!(gates, reverse(gates))
# Initialize psi to be a product state (alternating up and down)
psi = productMPS(s, n -> isodd(n) ? "Up" : "Dn")
c = div(N, 2) # center site
# Compute and print <Sz> at each time step
# then apply the gates to go to the next time
for t in 0.0:tau:ttotal
Sz = expect(psi, "Sz"; sites=c)
println("$t $Sz")
t≈ttotal && break
psi = apply(gates, psi; cutoff)
normalize!(psi)
end
return
end
MethodError: no method matching sort(::Tuple{Int64, Int64})
Closest candidates are:
sort(::AbstractUnitRange)
@ Base range.jl:1384
sort(::AbstractRange)
@ Base range.jl:1387
sort(::Dictionaries.AbstractIndices{I}; kwargs…) where I
@ Dictionaries C:\Users\adity.julia\packages\Dictionaries\7aBxp\src\AbstractIndices.jl:376
…Stacktrace:
[1] permutedims_combine_output(T::NDTensors.BlockSparseTensor{ComplexF64, 4, NTuple{4, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{ComplexF64, Vector{ComplexF64}, 4}}, is::Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, perm::NTuple{4, Int64}, combdims::Tuple{Int64, Int64}, blockperm::Vector{Int64}, blockcomb::Vector{Int64})
@ NDTensors C:\Users\adity.julia\packages\NDTensors\kR4oQ\src\blocksparse\blocksparsetensor.jl:439
[2] permutedims_combine(T::NDTensors.BlockSparseTensor{ComplexF64, 4, NTuple{4, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{ComplexF64, Vector{ComplexF64}, 4}}, is::Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, perm::NTuple{4, Int64}, combdims::Tuple{Int64, Int64}, blockperm::Vector{Int64}, blockcomb::Vector{Int64})
@ NDTensors C:\Users\adity.julia\packages\NDTensors\kR4oQ\src\blocksparse\blocksparsetensor.jl:467
[3] contract(tensor::NDTensors.BlockSparseTensor{ComplexF64, 4, NTuple{4, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{ComplexF64, Vector{ComplexF64}, 4}}, tensor_labels::NTuple{4, Int64}, combiner_tensor::NDTensors.Tensor{Number, 3, NDTensors.Combiner, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}}, combiner_tensor_labels::Tuple{Int64, Int64, Int64})
@ NDTensors C:\Users\adity.julia\packages\NDTensors\kR4oQ\src\blocksparse\combiner.jl:72
[4] _contract(A::NDTensors.BlockSparseTensor{ComplexF64, 4, NTuple{4, Index{Vector{Pair{QN, Int64}}}}, NDTensors.BlockSparse{ComplexF64, Vector{ComplexF64}, 4}}, B::NDTensors.Tensor{Number, 3, NDTensors.Combiner, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}})
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\tensor_algebra.jl:3
[5] _contract(A::ITensor, B::ITensor)
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\tensor_algebra.jl:9
[6] contract(A::ITensor, B::ITensor)
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\tensor_algebra.jl:104
[7] *(A::ITensor, B::ITensor)
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\tensor_algebra.jl:91
[8] exp(A::ITensor, Linds::Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, Rinds::Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\matrix_algebra.jl:80
[9] exp(A::ITensor, Linds::Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, Rinds::Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}})
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\matrix_algebra.jl:39
[10] exp(A::ITensor; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\matrix_algebra.jl:88
[11] exp(A::ITensor)
@ ITensors C:\Users\adity.julia\packages\ITensors\hLDmL\src\tensor_operations\matrix_algebra.jl:85
[12] top-level scope
@ In[8]:20
The line “20” referred to in the last line above is the line of Gj in the gates construction loop.