Hey am having trouble in using the contract option between different MPOs. My MPOs are defined using tensor operators defined by functions like this form:
These are defined using functions like:
function build_mpo1_0_(index_map::Dict{String,Index}, sites)
A = reshape([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], (3, 2, 3))
T = ITensor(A, sites[1], index_map["mpo1_0"], sites[1]')
return T
end
function build_mpo1_1_(index_map::Dict{String,Index}, sites)
A = reshape([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], (3, 2, 2, 3))
T = ITensor(A, sites[2], index_map["mpo1_0"]', index_map["mpo1_1"], sites[2]')
return T
end
....
I manually change the prming of the site indexes too multiply the 2 MPOs to get the following:
MPO [1] ((dim=3|id=86|"Site,n=1"), (dim=2|id=682|"mpo2_0"), (dim=3|id=86|"Site,n=1")') [2] ((dim=3|id=397|"Site,n=2"), (dim=2|id=682|"mpo2_0")', (dim=2|id=970|"mpo2_1"), (dim=3|id=397|"Site,n=2")')
[3] ((dim=3|id=275|"Site,n=3"), (dim=2|id=970|"mpo2_1")', (dim=3|id=397|"Site,n=2")')
MPO
[1] ((dim=3|id=86|"Site,n=1")', (dim=2|id=407|"mpo1_0"), (dim=3|id=86|"Site,n=1")'')
[2] ((dim=3|id=397|"Site,n=2")', (dim=2|id=407|"mpo1_0")', (dim=2|id=991|"mpo1_1"), (dim=3|id=397|"Site,n=2")'')
[3] ((dim=3|id=275|"Site,n=3")', (dim=2|id=991|"mpo1_1")', (dim=3|id=275|"Site,n=3")'')
And then when I try to iteratively contract them with
composed = contract(mpo2p, mpo1; cutoff=1e-12)
I get the error:
ERROR: LoadError: TypeError: in keyword argument alg, expected LinearAlgebra.Algorithm, got a value of type Nothing
Stacktrace:
[1] svd(A::ITensor, Linds::Vector{Index{Int64}}; leftdir::Nothing, rightdir::Nothing, lefttags::ITensors.TagSets.GenericTagSet{BitIntegers.UInt256, 4}, righttags::ITensors.TagSets.GenericTagSet{BitIntegers.UInt256, 4}, mindim::Int64, maxdim::Int64, cutoff::Float64, alg::Nothing, use_absolute_cutoff::Nothing, use_relative_cutoff::Nothing, min_blockdim::Nothing, utags::ITensors.TagSets.GenericTagSet{BitIntegers.UInt256, 4}, vtags::ITensors.TagSets.GenericTagSet{BitIntegers.UInt256, 4})
@ ITensors ~/.julia/packages/ITensors/elsyT/src/tensor_operations/matrix_decomposition.jl:162
[2] svd
@ ~/.julia/packages/ITensors/elsyT/src/tensor_operations/matrix_decomposition.jl:110 [inlined]
[3] factorize_svd(A::ITensor, Linds::Vector{Index{Int64}}; singular_values!::Nothing, ortho::String, alg::Nothing, dir::Nothing, mindim::Int64, maxdim::Int64, cutoff::Float64, tags::ITensors.TagSets.GenericTagSet{BitIntegers.UInt256, 4}, use_absolute_cutoff::Nothing, use_relative_cutoff::Nothing, min_blockdim::Nothing)
@ ITensors ~/.julia/packages/ITensors/elsyT/src/tensor_operations/matrix_decomposition.jl:615
[4] factorize(A::ITensor, Linds::Vector{Index{Int64}}; mindim::Int64, maxdim::Int64, cutoff::Float64, ortho::String, tags::ITensors.TagSets.GenericTagSet{BitIntegers.UInt256, 4}, plev::Nothing, which_decomp::Nothing, eigen_perturbation::Nothing, svd_alg::Nothing, use_absolute_cutoff::Nothing, use_relative_cutoff::Nothing, min_blockdim::Nothing, singular_values!::Nothing, dir::Nothing)
@ ITensors ~/.julia/packages/ITensors/elsyT/src/tensor_operations/matrix_decomposition.jl:809
[5] contract(::NDTensors.BackendSelection.Algorithm{:zipup, @NamedTuple{}}, A::MPO, B::MPO; cutoff::Float64, maxdim::Int64, mindim::Int64, kwargs::@Kwargs{})
@ ITensorMPS ~/.julia/packages/ITensorMPS/50GxK/src/mpo.jl:853
[6] contract(A::MPO, B::MPO; alg::String, kwargs::@Kwargs{cutoff::Float64})
@ ITensorMPS ~/.julia/packages/ITensorMPS/50GxK/src/mpo.jl:816
[7] contract
@ ~/.julia/packages/ITensorMPS/50GxK/src/mpo.jl:815 [inlined]
[8] reduce_mpo_list(mpos::Vector{MPO}, sites::Vector{Index{Int64}})
@ Main /nobackup/rsharma3/QC_work/sara_work/TNS/generated_ops/top_level.jl:44
[9] compose_and_compress_mpos(mpo_list::Vector{MPO}, sites::Vector{Index{Int64}}; maxdim::Int64, cutoff::Float64)
@ Main /nobackup/rsharma3/QC_work/sara_work/TNS/generated_ops/top_level.jl:70
[10] top-level scope
@ /nobackup/rsharma3/QC_work/sara_work/TNS/generated_ops/top_level.jl:136
Is this some ITensorMPS version error? Let me know f I am defining these MPOs incorrectly. These are custom MPOs whose data is being specified manually.