From c7d259180b5c4c1774c259ac4c157ac8861b0665 Mon Sep 17 00:00:00 2001 From: jofrevalles Date: Tue, 19 Nov 2024 08:24:21 +0100 Subject: [PATCH 1/4] Fix Tenet.Quantum for Quac.Gate type --- ext/TenetQuacExt.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/TenetQuacExt.jl b/ext/TenetQuacExt.jl index 6dd36b00d..f923464b0 100644 --- a/ext/TenetQuacExt.jl +++ b/ext/TenetQuacExt.jl @@ -4,7 +4,7 @@ using Tenet using Quac: Gate, Circuit, lanes, arraytype, Swap function Tenet.Quantum(gate::Gate) - return Tenet.Quantum(arraytype(gate)(gate); sites=Site[Site.(lanes(gate))..., Site.(lanes(gate); dual=true)...]) + return Tenet.Quantum(arraytype(gate)(gate), [Site.(lanes(gate))..., Site.(lanes(gate); dual=true)...]) end Tenet.evolve!(qtn::Ansatz, gate::Gate; kwargs...) = evolve!(qtn, Quantum(gate); kwargs...) From 47765dac2bc31e467a8262ea61c731616d86f0a6 Mon Sep 17 00:00:00 2001 From: jofrevalles Date: Tue, 19 Nov 2024 08:24:58 +0100 Subject: [PATCH 2/4] Add a testset to cover for this specific case --- test/integration/Quac_test.jl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/integration/Quac_test.jl b/test/integration/Quac_test.jl index fd3302143..df0e9e237 100644 --- a/test/integration/Quac_test.jl +++ b/test/integration/Quac_test.jl @@ -1,6 +1,19 @@ @testset "Quac" begin using Quac + @testset "Gate" begin + n = 3 + id_gate = n - 1 + gate = Quac.Z(id_gate) + + qgate = Quantum(gate) + + @test nsites(qgate; set=:inputs) == 1 + @test nsites(qgate; set=:outputs) == 1 + @test issetequal(sites(qgate), [Site(id_gate), Site(id_gate; dual=true)]) + @test socket(qgate) == Operator() + end + @testset "QFT" begin n = 3 qftcirc = Quac.Algorithms.QFT(n) From 244157906e963351e3aabdfab1730299dc7b0226 Mon Sep 17 00:00:00 2001 From: jofrevalles Date: Tue, 19 Nov 2024 08:26:22 +0100 Subject: [PATCH 3/4] Fix typo --- ext/TenetQuacExt.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/TenetQuacExt.jl b/ext/TenetQuacExt.jl index f923464b0..7907646cf 100644 --- a/ext/TenetQuacExt.jl +++ b/ext/TenetQuacExt.jl @@ -4,7 +4,7 @@ using Tenet using Quac: Gate, Circuit, lanes, arraytype, Swap function Tenet.Quantum(gate::Gate) - return Tenet.Quantum(arraytype(gate)(gate), [Site.(lanes(gate))..., Site.(lanes(gate); dual=true)...]) + return Tenet.Quantum(arraytype(gate)(gate), Site[Site.(lanes(gate))..., Site.(lanes(gate); dual=true)...]) end Tenet.evolve!(qtn::Ansatz, gate::Gate; kwargs...) = evolve!(qtn, Quantum(gate); kwargs...) From a2539da436d89a0acb4b6835754b9a8a37164b65 Mon Sep 17 00:00:00 2001 From: jofrevalles Date: Tue, 19 Nov 2024 08:30:21 +0100 Subject: [PATCH 4/4] Fix typo --- test/integration/Quac_test.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/integration/Quac_test.jl b/test/integration/Quac_test.jl index df0e9e237..c6fe5d23f 100644 --- a/test/integration/Quac_test.jl +++ b/test/integration/Quac_test.jl @@ -2,8 +2,7 @@ using Quac @testset "Gate" begin - n = 3 - id_gate = n - 1 + id_gate = 2 gate = Quac.Z(id_gate) qgate = Quantum(gate)