Skip to content

Commit

Permalink
Merge branch '1.0.3' of github.com:BQSKit/bqskit into 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
edyounis committed Oct 28, 2022
2 parents 8df61fd + 1c379f7 commit 76db2ca
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/bqskitrs/test_grad.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
from __future__ import annotations

import numpy as np
from bqskit import Circuit
from bqskit.ir.gates import CNOTGate, U3Gate
from bqskitrs import Circuit as CircuitRS

from bqskit import Circuit
from bqskit.ir.gates import CNOTGate
from bqskit.ir.gates import U3Gate


def test_basic() -> None:
circuit = Circuit(3)
for _ in range(10):
for i in range(2):
circuit.append_gate(CNOTGate(), (i, i+1))
circuit.append_gate(CNOTGate(), (i, i + 1))
circuit.append_gate(U3Gate(), i)
circuit.append_gate(U3Gate(), i+1)
circuit.append_gate(U3Gate(), i + 1)
crs = CircuitRS(circuit)
d, dM = crs.get_unitary_and_grad([0]*(2*10*6))
od, odM = circuit.get_unitary_and_grad([0]*(2*10*6))
d, dM = crs.get_unitary_and_grad([0] * (2 * 10 * 6))
od, odM = circuit.get_unitary_and_grad([0] * (2 * 10 * 6))
assert np.allclose(d, od)
assert np.allclose(dM, odM)

0 comments on commit 76db2ca

Please sign in to comment.