Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Classes | Functions | Variables
squander.decomposition.qgd_N_Qubit_Decomposition_custom Namespace Reference

Classes

class  qgd_N_Qubit_Decomposition_custom
 A QGD Python interface class for the decomposition of N-qubit unitaries into U3 and CNOT gates. More...
 

Functions

def __init__ (self, Umtx, initial_guess="RANDOM", config={}, accelerator_num=0)
 Constructor of the class. More...
 
def get_Circuit (self)
 Call to retrieve the incorporated quantum circuit (Squander format) More...
 
def get_Cirq_Circuit (self)
 Export the unitary decomposition into Qiskit format. More...
 
def get_Optimized_Parameters (self)
 Call to get the optimized parameters set in numpy array. More...
 
def get_Qiskit_Circuit (self)
 Export the unitary decomposition into Qiskit format. More...
 
def import_Qiskit_Circuit (self, qc_in)
 Call to import initial quantum circuit in QISKIT format to be further comporessed. More...
 
def List_Gates (self)
 Call to print the gates decomposing the initial unitary. More...
 
def Optimization_Problem (self, parameters=None)
 Call to evaluate the cost function. More...
 
def Prepare_Gates_To_Export (self)
 Call to prepare the circuit to be exported into Qiskit format. More...
 
def Reorder_Qubits (self, qbit_list)
 Call to reorder the qubits in the matrix of the gate. More...
 
def set_Cost_Function_Variant (self, costfnc=0)
 Call to set the optimizer used in the gate synthesis process. More...
 
def set_Gate_Structure (self, Gate_structure)
 Call to set custom gate structure to used in the decomposition. More...
 
def set_Optimizer (self, optimizer="BFGS")
 Call to set the optimizer used in the gate synthesis process. More...
 
def Start_Decomposition (self)
 Wrapper function to call the start_decomposition method of C++ class N_Qubit_Decomposition. More...
 

Variables

 qbit_num
 the number of qubits More...
 

Function Documentation

◆ __init__()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.__init__ (   self,
  Umtx,
  initial_guess = "RANDOM",
  config = {},
  accelerator_num = 0 
)

Constructor of the class.

Parameters
UmtxThe unitary matrix to be decomposed.
optimize_layer_numSet true to optimize the minimum number of operation layers required in the decomposition, or false when the predefined maximal number of layer gates is used (ideal for general unitaries).
initial_guessString indicating the method to guess initial values for the optimalization. Possible values: "zeros" ,"random", "close_to_zero".
Returns
An instance of the class

Definition at line 46 of file qgd_N_Qubit_Decomposition_custom.py.

◆ get_Circuit()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.get_Circuit (   self)

Call to retrieve the incorporated quantum circuit (Squander format)

Returns
Return with a Qiskit compatible quantum circuit.

Definition at line 89 of file qgd_N_Qubit_Decomposition_custom.py.

◆ get_Cirq_Circuit()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.get_Cirq_Circuit (   self)

Export the unitary decomposition into Qiskit format.

Returns
Return with a Qiskit compatible quantum circuit.

Definition at line 133 of file qgd_N_Qubit_Decomposition_custom.py.

◆ get_Optimized_Parameters()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.get_Optimized_Parameters (   self)

Call to get the optimized parameters set in numpy array.

Returns
Returns with the optimized parameters

Definition at line 109 of file qgd_N_Qubit_Decomposition_custom.py.

◆ get_Qiskit_Circuit()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.get_Qiskit_Circuit (   self)

Export the unitary decomposition into Qiskit format.

Returns
Return with a Qiskit compatible quantum circuit.

Definition at line 97 of file qgd_N_Qubit_Decomposition_custom.py.

◆ import_Qiskit_Circuit()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.import_Qiskit_Circuit (   self,
  qc_in 
)

Call to import initial quantum circuit in QISKIT format to be further comporessed.

Parameters
qc_inThe quantum circuit to be imported

Definition at line 216 of file qgd_N_Qubit_Decomposition_custom.py.

◆ List_Gates()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.List_Gates (   self)

Call to print the gates decomposing the initial unitary.

These gates brings the intial matrix into unity.

Definition at line 80 of file qgd_N_Qubit_Decomposition_custom.py.

◆ Optimization_Problem()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.Optimization_Problem (   self,
  parameters = None 
)

Call to evaluate the cost function.

Parameters
parametersA float64 numpy array. The number of parameters can be retrieved with method get_Parameter_Num

Definition at line 116 of file qgd_N_Qubit_Decomposition_custom.py.

◆ Prepare_Gates_To_Export()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.Prepare_Gates_To_Export (   self)

Call to prepare the circuit to be exported into Qiskit format.

(parameters and gates gets bound together, gate block structure is converted to plain structure).

Definition at line 242 of file qgd_N_Qubit_Decomposition_custom.py.

◆ Reorder_Qubits()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.Reorder_Qubits (   self,
  qbit_list 
)

Call to reorder the qubits in the matrix of the gate.

Parameters
qbit_listThe reordered list of qubits spanning the matrix

Definition at line 72 of file qgd_N_Qubit_Decomposition_custom.py.

◆ set_Cost_Function_Variant()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.set_Cost_Function_Variant (   self,
  costfnc = 0 
)

Call to set the optimizer used in the gate synthesis process.

Parameters
costfncVariant of the cost function. Input argument 0 stands for FROBENIUS_NORM, 1 for FROBENIUS_NORM_CORRECTION1, 2 for FROBENIUS_NORM_CORRECTION2

Definition at line 266 of file qgd_N_Qubit_Decomposition_custom.py.

◆ set_Gate_Structure()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.set_Gate_Structure (   self,
  Gate_structure 
)

Call to set custom gate structure to used in the decomposition.

Parameters
Gate_structureAn instance of Gates_Block

Definition at line 251 of file qgd_N_Qubit_Decomposition_custom.py.

◆ set_Optimizer()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.set_Optimizer (   self,
  optimizer = "BFGS" 
)

Call to set the optimizer used in the gate synthesis process.

Parameters
optimizerString indicating the optimizer. Possible values: "BFGS" ,"ADAM", "BFGS2", "AGENTS", "COSINE", "AGENTS_COMBINED".
Returns
An instance of the class

Definition at line 233 of file qgd_N_Qubit_Decomposition_custom.py.

◆ Start_Decomposition()

def squander.decomposition.qgd_N_Qubit_Decomposition_custom.Start_Decomposition (   self)

Wrapper function to call the start_decomposition method of C++ class N_Qubit_Decomposition.

Definition at line 63 of file qgd_N_Qubit_Decomposition_custom.py.

Variable Documentation

◆ qbit_num

squander.decomposition.qgd_N_Qubit_Decomposition_custom.qbit_num

the number of qubits

Definition at line 49 of file qgd_N_Qubit_Decomposition_custom.py.