File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
13import numpy as np
2- from bqskit import Circuit
3- from bqskit .ir .gates import CNOTGate , U3Gate
44from bqskitrs import Circuit as CircuitRS
55
6+ from bqskit import Circuit
7+ from bqskit .ir .gates import CNOTGate
8+ from bqskit .ir .gates import U3Gate
9+
10+
611def test_basic () -> None :
712 circuit = Circuit (3 )
813 for _ in range (10 ):
914 for i in range (2 ):
10- circuit .append_gate (CNOTGate (), (i , i + 1 ))
15+ circuit .append_gate (CNOTGate (), (i , i + 1 ))
1116 circuit .append_gate (U3Gate (), i )
12- circuit .append_gate (U3Gate (), i + 1 )
17+ circuit .append_gate (U3Gate (), i + 1 )
1318 crs = CircuitRS (circuit )
14- d , dM = crs .get_unitary_and_grad ([0 ]* ( 2 * 10 * 6 ))
15- od , odM = circuit .get_unitary_and_grad ([0 ]* ( 2 * 10 * 6 ))
19+ d , dM = crs .get_unitary_and_grad ([0 ] * ( 2 * 10 * 6 ))
20+ od , odM = circuit .get_unitary_and_grad ([0 ] * ( 2 * 10 * 6 ))
1621 assert np .allclose (d , od )
1722 assert np .allclose (dM , odM )
You can’t perform that action at this time.
0 commit comments