Quantum gates¶
User-defined gates and gates from quimb
-
gates.
CPHASE
(phi, dtype=<class 'complex'>, sparse=False)[source]¶ Construct a controlled phase gate for two qubits.
- Parameters
phi (double) -- Angle of rotation.
sparse (bool, optional) -- Whether to construct a sparse operator.
- Returns
C -- The controlled two-qubit gate operator.
- Return type
immutable operator
-
class
gates.
GATES
[source]¶ Class to contain the various gates in quimb format
-
H
¶ Hadamard gate
- Type
matrix shape(2, 2)
-
NOT
¶ Not gate
- Type
matrix shape(2, 2)
-
CNOT
¶ controlled not gate
- Type
matrix shape(4, 4)
-
SWAP
¶ swap gate
- Type
matrix shape(4, 4)
-
CPHASE
(phi)¶ returns the controlled phase matrix with phase phi
- Type
function
-
gate_dict
¶ dictionary of the format qiskit_gate_name : quimb_gate
- Type
dictionary
-
-
gates.
cphase_and_swap_cirq
(ctrl, target, phase)[source]¶ Combine the CPHASE gate with the SWAP operation, used for QFT algorithm. Input
- crtl: cirq.devices.line_qubit.LineQubit
control qubit
- target: cirq.devices.line_qubit.LineQubit
target qubit
- phase: double
phase to apply in radiants
- Return
cirq gate
-
gates.
cphase_swap_qiskit
(circuit, control, target, phase)[source]¶ Apply to a quantum circuit circuit the cphase and swap gate. Acts in place.
- Parameters
circuit (Quantum Circuit) -- Qiskit quantum circuit
control (int) -- Index of the control qubit for the controlled phase
target (int) -- Index of the target qubit for the controlled phase
phase (double) -- Phase to apply in the controlled phase in radiants
- Returns
None -- Acts in place
- Return type
None