Module QuantumPathQSOAPySDK.circuit.gates.CircuitGates
Functions
def deprecation_warning_add(func)
def deprecation_warning_mcg(func)
def deprecation_warning_oldGateStructure(func)
Classes
class CircuitGates
-
Methods
def add(self, gate)
-
Add gate or list of gates to circuit.
Prerequisites
- Created circuit.
Parameters
gate
:gate obj | gate obj list
- Gate object or list of gates to add to the circuit.
Output
gate obj | gate obj list
def addCreatedGate(self, gate: list)
-
Add Created gate.
Prerequisites
- Created circuit.
- Created gate.
Parameters
gate
:list
- Created gate to add to the circuit.
def barrier(self, position=None) ‑> Barrier
-
Add Barrier.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the barrier. In the case that the position is not indicated, the barrier will be added in all qubits. It can also be a list of positions.
Output
Barrier obj | Barrier obj list
def beginRepeat(self, position, repetitions: int) ‑> BeginRepeat
-
Add Begin Repeat.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Qubit position to add the begin repetition. It can also be a list of positions.
repetitions
:int
- Number of repetitions.
Output
BeginRepeat obj | BeginRepeat obj list
def ccx(self, position1: int, position2: int, position3: int, add=True) ‑> CCXGate
-
Add Toffoli gate.
Prerequisites
- Created circuit.
Parameters
position1
:int
- Mandatory argument. First qubit position to add the control.
position2
:int
- Mandatory argument. Second qubit position to add the control.
position3
:int
- Mandatory argument. Third qubit position to add the X gate.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
CCXGate obj | tuple list [DEPRECATED]
def ch(self, position1: int, position2: int, add: bool = True) ‑> CHGate
-
Add Controlled Hadamard gate.
Prerequisites
- Created circuit.
Parameters
position1
:int
- Mandatory argument. First qubit position to add the control.
position2
:int
- Mandatory argument. Second qubit position to add the hadamard gate.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
CHGate obj | tuple list [DEPRECATED]
def control(self, position, gate) ‑> ControlledGate
-
Create and add custom controlled gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Mandatory argument. Qubit position to add the control. It can also be a list of positions.
gate
:Gate obj | list [DEPRECATED]
- Gate obj to be controlled.
Output
ControlledGate obj | tuple list [DEPRECATED]
def cx(self, position1: int, position2: int, add: bool = True) ‑> CXGate
-
Add Controlled X gate.
Prerequisites
- Created circuit.
Parameters
position1
:int
- Mandatory argument. First qubit position to add the control.
position2
:int
- Mandatory argument. Second qubit position to add the X gate.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
CXGate obj | tuple list [DEPRECATED]
def endRepeat(self, position) ‑> EndRepeat
-
Add End Repeat.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Qubit position to add the end repetition. It can also be a list of positions.
Output
EndRepeat obj | EndRepeat obj list
def getCircuitBody(self) ‑> list
-
Get Circuit Body.
Prerequisites
- Created circuit.
Output
list
def getDefaultQubitState(self) ‑> str
-
Get Default Qubit state.
Prerequisites
- Created circuit.
Output
str
def getNumberOfQubits(self) ‑> int
-
Get number of qubits used in circuit.
Prerequisites
- Created circuit.
Output
int
def getParsedBody(self) ‑> str
-
Get Circuit Body VL.
Prerequisites
- Created circuit.
Output
str
def getQubitStates(self) ‑> list
-
Get Circuit Qubit states.
Prerequisites
- Created circuit.
Output
list
def h(self, position=None, add: bool = True) ‑> HGate
-
Add Hadamard gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
HGate obj | HGate obj list | tuple list [DEPRECATED]
def i_s(self, position=None, add: bool = True) ‑> I_SGate
-
Add adjoint square root Z, I_S gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
I_SGate obj | I_SGate obj list | tuple list [DEPRECATED]
def i_sx(self, position=None, add: bool = True) ‑> I_SXGate
-
Add adjoint square root X, I_SX gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
I_SXGate obj | I_SXGate obj list | tuple list [DEPRECATED]
def i_sy(self, position=None, add: bool = True) ‑> I_SYGate
-
Add adjoint square root Y, I_SY gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
I_SYGate obj | I_SYGate obj list | tuple list [DEPRECATED]
def i_t(self, position=None, add: bool = True) ‑> I_TGate
-
Add adjoint four root Z, I_T gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
I_TGate obj | I_TGate obj list | tuple list [DEPRECATED]
def i_tx(self, position=None, add: bool = True) ‑> I_TXGate
-
Add adjoint four root X, I_TX gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
I_TXGate obj | I_TXGate obj list | tuple list [DEPRECATED]
def i_ty(self, position=None, add: bool = True) ‑> I_TYGate
-
Add adjoint four root Y, I_TY gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
I_TYGate obj | I_TYGate obj list | tuple list [DEPRECATED]
def initializeQubitStates(self, qubitStates: list)
-
Initialize Qubit states.
Prerequisites
- Created circuit.
Parameters
qbitStates
:list
- List of strings setting up the qubit states. It must be equal than number of qubits. There can be 0, 1, +, -, i or -i.
def mcg(self, position, circuit: list, add: bool = True) ‑> list
-
[DEPRECATED METHOD] Use "control" method instead. Add Multi Controlled gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Qubit position or list of positions to add the control. It can also be a list of positions.
circuit
:list
- Gate or set of elements to add a control.
add
:bool
- Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
list
def measure(self, position=None) ‑> MeasureGate
-
Add Measure gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the measure. In the case that the position is not indicated, the measure will be added in all qubits. It can also be a list of positions.
Output
MeasureGate obj | MeasureGate obj list
def p(self, position=None, argument='pi', add: bool = True) ‑> PGate
-
Add Phase gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
argument
:str | int | float
- Optional argument. Gate angle value. In the case that it is not indicated, it will be pi by default.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
PGate obj | PGate obj list | tuple list [DEPRECATED]
def rx(self, position=None, argument='pi', add: bool = True) ‑> RXGate
-
Add Rotation X gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
argument
:str | int | float
- Optional argument. Gate angle value. In the case that it is not indicated, it will be pi by default.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
RXGate obj | RXGate obj list | tuple list [DEPRECATED]
def ry(self, position=None, argument='pi', add: bool = True) ‑> RYGate
-
Add Rotation Y gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
argument
:str | int | float
- Optional argument. Gate angle value. In the case that it is not indicated, it will be pi by default.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
RYGate obj | RYGate obj list | tuple list [DEPRECATED]
def rz(self, position=None, argument='pi', add: bool = True) ‑> RZGate
-
Add Rotation Z gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
argument
:str | int | float
- Optional argument. Gate angle value. In the case that it is not indicated, it will be pi by default.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
RZGate obj | RZGate obj list | tuple list [DEPRECATED]
def s(self, position=None, add: bool = True) ‑> SGate
-
Add square root of Z, S gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
SGate obj | SGate obj list | tuple list [DEPRECATED]
def setDefaultQubitState(self, qubitState: str) ‑> str
-
Set Default Qubit state.
Prerequisites
- Created circuit.
Parameters
qubitState
:str
- Set default qubit state. It can be 0, 1, +, -, i or -i.
Output
str
def swap(self, position1: int, position2: int, add: bool = True) ‑> SwapGate
-
Add Swap gates.
Prerequisites
- Created circuit.
Parameters
position1
:int
- Mandatory argument. First qubit position to add the swap.
position2
:int
- Mandatory argument. Second qubit position to add the swap.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
SwapGate obj
def sx(self, position=None, add: bool = True) ‑> SXGate
-
Add square root of X, SX gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
SXGate obj | SXGate obj list | tuple list [DEPRECATED]
def sy(self, position=None, add: bool = True) ‑> SYGate
-
Add square root of Y, SY gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
SYGate obj | SYGate obj list | tuple list [DEPRECATED]
def t(self, position=None, add: bool = True) ‑> TGate
-
Add four root of Z, T gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
TGate obj | TGate obj list | tuple list [DEPRECATED]
def tx(self, position=None, add: bool = True) ‑> TXGate
-
Add four root of X, TX gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
TXGate obj | TXGate obj list | tuple list [DEPRECATED]
def ty(self, position=None, add: bool = True) ‑> TYGate
-
Add four root of Y, TY gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
TYGate obj | TYGate obj list | tuple list [DEPRECATED]
def x(self, position=None, add: bool = True) ‑> XGate
-
Add Pauli X gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
XGate obj | XGate obj list | tuple list [DEPRECATED]
def y(self, position=None, add: bool = True) ‑> YGate
-
Add Pauli Y gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
YGate obj | YGate obj list | tuple list [DEPRECATED]
def z(self, position=None, add: bool = True) ‑> ZGate
-
Add Pauli Z gate.
Prerequisites
- Created circuit.
Parameters
position
:int | list
- Optional argument. Qubit position to add the gate. If no position are indicated, gate will be added in all qubits. It can also be a list of positions.
add
:bool
- [DEPRECATED] "add" argument is deprecated and will be removed in future versions. For more information visit the user guide. Optional argument. True by default. Indicates whether the gate should be added to the circuit or not. In the case of wanting to add it, it is not necessary to introduce that argument. If you want to create a new gate, you must enter False.
Output
ZGate obj | ZGate obj list | tuple list [DEPRECATED]