Closed junnaka51 closed 2 years ago
Checkers in add_gate must be modified as well since the following for instance fails:
In [3]: tc = TestCircuit(2)
...: tc.add_gate(
...: {"name": "h", "target_qubit": [0], "control_qubit": [],
...: "control_value": [], "parameter": []}
...: )
...: tc.add_gate(
...: {"name": "x", "target_qubit": [1], "control_qubit": [0],
...: "control_value": [1], "parameter": []}
...: )
---------------------------------------------------------------------------
QuantestPyTestCircuitError Traceback (most recent call last)
Input In [3], in <cell line: 6>()
1 tc = TestCircuit(2)
2 tc.add_gate(
3 {"name": "h", "target_qubit": [0], "control_qubit": [],
4 "control_value": [], "parameter": []}
5 )
----> 6 tc.add_gate(
7 {"name": "x", "target_qubit": [1], "control_qubit": [0],
8 "control_value": [1], "parameter": []}
9 )
File /mnt/workspace/quantestpy/quantestpy/test_circuit.py:174, in TestCircuit.add_gate(self, gate)
168 raise QuantestPyTestCircuitError(
169 "'target_qubit' must not an empty list."
170 )
172 if gate["name"] in _IMPLEMENTED_SINGLE_QUBIT_GATES and \
173 len(gate["control_qubit"]) != 0:
--> 174 raise QuantestPyTestCircuitError(
175 "single qubit gate must have an empty list for "
176 "'control_qubit'."
177 )
179 if gate["name"] in _IMPLEMENTED_SINGLE_QUBIT_GATES and \
180 len(gate["control_value"]) != 0:
181 raise QuantestPyTestCircuitError(
182 "single qubit gate must have an empty list for "
183 "'control_value'."
184 )
QuantestPyTestCircuitError: single qubit gate must have an empty list for 'control_qubit'.
converting "cx" to "x" for example should be done in the converter.