Problem when using apply function to apply gates to ITensorNetwork in vidal gauge with bond tensors

Hi everyone,

my question regards the apply function and bond tensors in the ITensorNetworks package.

I am running Julia Version 1.9.4, ITensors v0.3.54, and the newer version ITensorNetworks v0.4.0.

I want to replicate the heavy_hex_ising_real_tebd.jl example that was included on Github in ITensorNetworks v0.3.10 (in the folder under examples => dynamics => heavy_hex_ising_real_tebd.jl). The example is about trotter time evolving the Ising model on a graph. The state tensor network is transformed to the Vidal gauge and the gates are then applied using the apply function.

The minimum viable example is


using ITensors
using ITensorNetworks
using NamedGraphs
using Graphs
using ITensorNetworks: initialize_bond_tensors, vidal_gauge

g = named_grid((1,2));
s = siteinds("S=1/2", g);
ψ = ITensorNetwork(s, v -> "↑");
HX_opsum = OpSum();
HX_opsum += 1.0,"Sx",vertices(g)[1];
RX = exp(-1.0im * HX_opsum; alg=Trotter{1}());
gate = Vector{ITensor}(RX,s)[1];

ψ_vidal, bond_tensors = vidal_gauge(ψ);
ψ_vidal, bond_tensors = apply(gate,ψ_vidal,bond_tensors; );

that results in the following error:

MethodError: no method matching product(::ITensor, ::ITensorNetwork{Tuple{Int64, Int64}}, ::DataGraph{Tuple{Int64, Int64}, Nothing, ITensor, NamedGraph{Tuple{Int64, Int64}}, NamedEdge{Tuple{Int64, Int64}}})

You may have intended to import Base.product

Closest candidates are:

product(::ITensor, !Matched::ITensors.AbstractMPS, ::Any; move_sites_back, apply_dag, kwargs…)

@ ITensors ~/.julia/packages/ITensors/Gf9aD/src/mps/abstractmps.jl:2093

product(::ITensor, ::AbstractITensorNetwork; envs, normalize, ortho, nfullupdatesweeps, print_fidelity_loss, envisposdef, observer!, variational_optimization_only, symmetrize, reduced, apply_kwargs…)

@ ITensorNetworks ~/.julia/packages/ITensorNetworks/OpHEf/src/apply.jl:171

product(!Matched::Prod, ::AbstractITensorNetwork; normalize, ortho, apply_kwargs…)

@ ITensorNetworks ~/.julia/packages/ITensorNetworks/OpHEf/src/apply.jl:262

The issue seems to be related to the bond tensors that are introduced by the Vidal gauge. If I do not define the bond tensors and only apply the gates without first introducing the Vidal gauge, i.e. ψ = apply(gate, ψ), there is no error.

The full code is given on GibHub Release v0.3.10 · mtfishman/ITensorNetworks.jl · GitHub in the Source code (zip) file under examples => dynamics => heavy_hex_ising_real_tebd.jl

Any help is greatly appreciated!

Best,
John

The short answer is that we are in the middle of rewriting a lot of that library, including the gate application code, so you may have to use an older version of the package to have that example work.

Thanks for the quick reply and also great to hear that you put so much work into ITensorNetworks. Then I will stick to the previous version of the package for now :+1: