mindquantum.core.gates.BasicGate
- class mindquantum.core.gates.BasicGate(name, n_qubits, obj_qubits=None, ctrl_qubits=None)[source]
BasicGate is the base class of all gates.
- Parameters
- property acted
Check whether this gate is acted on qubits.
- on(obj_qubits, ctrl_qubits=None)[source]
Define which qubit the gate act on and the control qubit.
Note
In this framework, the qubit that the gate act on is specified first, even for control gate, e.g. CNOT, the second arg is control qubits.
- Parameters
- Returns
Gate, Return a new gate.
Examples
>>> from mindquantum.core.gates import X >>> x = X.on(1) >>> x.obj_qubits [1] >>> x.ctrl_qubits [] >>> x = X.on(2, [0, 1]) >>> x.ctrl_qubits [0, 1]
- property parameterized
Check whether this gate is a parameterized gate.