...
|
...
|
@@ -13,6 +13,17 @@ import qsim.gate
|
13
|
13
|
n_qubits = st.shared(st.integers(min_value=1, max_value=6))
|
14
|
14
|
|
15
|
15
|
|
|
16
|
+# Choose which qubits from 'n_qubits' to operate on with a gate that
|
|
17
|
+# operates on 'gate_size' qubits
|
|
18
|
+def select_n_qubits(gate_size):
|
|
19
|
+ def _strat(n_qubits):
|
|
20
|
+ assert n_qubits >= gate_size
|
|
21
|
+ possible_qubits = st.integers(0, n_qubits - 1)
|
|
22
|
+ return st.lists(possible_qubits, gate_size, gate_size, unique=True).map(tuple)
|
|
23
|
+
|
|
24
|
+ return _strat
|
|
25
|
+
|
|
26
|
+
|
16
|
27
|
valid_complex = st.complex_numbers(allow_infinity=False, allow_nan=False)
|
17
|
28
|
phases = st.floats(
|
18
|
29
|
min_value=0, max_value=2 * np.pi, allow_nan=False, allow_infinity=False
|