Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TensorNetwork(circ::Quac.Circuit) fails for circ with some empty lanes #112

Closed
jofrevalles opened this issue Oct 17, 2023 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@jofrevalles
Copy link
Member

jofrevalles commented Oct 17, 2023

The function TensorNetwork fails when is called for a given Quac.Circuit and there are some lanes that do not contain any gate.

Example:

julia> circ = Circuit(4)

julia> push!(circ, X(1)); push!(circ, X(2)); push!(circ, X(3)) # Lane 4 is empty

julia> tn = TensorNetwork(circ)
ERROR: "Quantum" metadata is not valid
Stacktrace:
 [1] checkansatz(tn::TensorNetwork{Quantum, NamedTuple{(:plug, :interlayer), Tuple{Type{<:Plug}, Vector{Bijections.Bijection{Int64, Symbol}}}}})
   @ Tenet ~/.julia/packages/Tenet/LSZRg/src/TensorNetwork.jl:69
 [2] (TensorNetwork{Quantum})(tensors::Vector{Tensor}; metadata::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:plug, :interlayer), Tuple{DataType, Vector{Bijections.Bijection{Int64, Symbol}}}}})
   @ Tenet ~/.julia/packages/Tenet/LSZRg/src/TensorNetwork.jl:52
 [3] TensorNetwork
   @ ~/.julia/packages/Tenet/LSZRg/src/TensorNetwork.jl:36 [inlined]
 [4] TensorNetwork(circuit::Circuit)
   @ TenetQuacExt ~/.julia/packages/Tenet/LSZRg/ext/TenetQuacExt.jl:40
 [5] top-level scope
   @ REPL[36]:1

julia> push!(circ, X(4))

julia> tn = TensorNetwork(circ)
TensorNetwork{Quantum, NamedTuple{(:plug, :interlayer), Tuple{Type{<:Plug}, Vector{Bijections.Bijection{Int64, Symbol}}}}}(#tensors=4, #inds=8)
@jofrevalles jofrevalles added bug Something isn't working good first issue Good for newcomers labels Oct 17, 2023
@mofeing mofeing removed the good first issue Good for newcomers label Oct 17, 2023
@mofeing
Copy link
Member

mofeing commented Oct 17, 2023

This is expected, as no tensor is ever created for that lane and calling TensorNetwork(circuit) will create a operator (no tensor, no index for that lane).

@jofrevalles
Copy link
Member Author

But this could be solved by simply adding an identity in that lane, right?

@mofeing
Copy link
Member

mofeing commented Oct 19, 2023

yes, but does it make sense? wouldn't a circuit where a lane has no gate be a smaller circuit?

@mofeing
Copy link
Member

mofeing commented Nov 3, 2023

Related code moved to Qrochet.jl.

@mofeing mofeing closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants