qib.operator.gates.ControlledGate¶
- class qib.operator.gates.ControlledGate(tgate: Gate, ncontrols: int, ctrl_state: Sequence[int] | None = None)[source]¶
Bases:
GateA controlled quantum gate with an arbitrary number of control qubits. The control qubits have to be set explicitly. The target qubits (or particles) are specified via the target gate.
Methods
Generate the sparse matrix representation of the gate as element of a quantum circuit.
Generate the matrix representation of the controlled gate. Format: |control> x |target>.
Generate a Qobj OpenQASM representation of the gate.
Generate a tensor network representation of the gate.
Return the list of fields hosting the quantum particles which the gate acts on.
Return the inverse operator.
Whether the gate is Hermitian.
A quantum gate is unitary by definition.
Return the list of quantum particles the gate acts on.
Set the control qubits.
Get the target gate.
Attributes
The number of control qubits.
The number of "wires" (or quantum particles) this gate acts on.
- as_circuit_matrix(fields: Sequence[Field])[source]¶
Generate the sparse matrix representation of the gate as element of a quantum circuit.
- as_matrix()[source]¶
Generate the matrix representation of the controlled gate. Format: |control> x |target>
- property num_controls¶
The number of control qubits.
- property num_wires¶
The number of “wires” (or quantum particles) this gate acts on.