Sequential Quantum Gate Decomposer
v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
|
Classes | |
class | qgd_Variational_Quantum_Eigensolver_Base |
A QGD Python interface class for the decomposition of N-qubit unitaries into U3 and CNOT gates. More... | |
Functions | |
def | __init__ (self, Hamiltonian, qbit_num, config={}, accelerator_num=0) |
Constructor of the class. More... | |
def | apply_to (self, parameters_mtx, state_to_be_transformed) |
def | Generate_Circuit (self, layers, inner_blocks=1) |
Call to generate the circuit ansatz. More... | |
def | get_Circuit (self) |
Call to retrieve the incorporated quantum circuit (Squander format) More... | |
def | get_Optimized_Parameters (self) |
Call to get the optimized parameters set in numpy array. More... | |
def | get_Parameter_Num (self) |
Call to get the number of free parameters in the gate structure used for the decomposition. More... | |
def | get_Qbit_Num (self) |
Call to get the number of qubits in the circuit. More... | |
def | get_Qiskit_Circuit (self) |
Export the unitary decomposition into Qiskit format. More... | |
def | get_Second_Renyi_Entropy (self, parameters=None, input_state=None, qubit_list=None) |
Call to get the second Rényi entropy. More... | |
def | Optimization_Problem (self, parameters) |
Call to evaluate the VQE energy. More... | |
def | Optimization_Problem_Grad (self, parameters) |
Call to evaluate the VQE energy. More... | |
def | set_Ansatz (self, ansatz_new) |
Call to set the ansatz type. More... | |
def | set_Gate_Structure (self, Gate_structure) |
Call to set custom gate structure to used in the decomposition. More... | |
def | set_Gate_Structure_from_Binary (self, filename) |
Call to set custom layers to the gate structure that are intended to be used in the decomposition from a binary file created from SQUANDER. More... | |
def | set_Initial_State (self, initial_state) |
Call to get the number of free parameters in the gate structure used for the decomposition. More... | |
def | set_Optimization_Tolerance (self, tolerance) |
def | set_Optimized_Parameters (self, new_params) |
Call to set the parameters which are used as a starting point in the optimization. More... | |
def | set_Optimizer (self, alg) |
Call to set the optimizer used in the VQE process. More... | |
def | set_Project_Name (self, project_name) |
Call to set the name of the SQUANDER project. More... | |
def | Start_Optimization (self) |
Call to start solving the VQE problem to get the approximation for the ground state. More... | |
Variables | |
qbit_num | |
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.__init__ | ( | self, | |
Hamiltonian, | |||
qbit_num, | |||
config = {} , |
|||
accelerator_num = 0 |
|||
) |
Constructor of the class.
Umtx | The unitary matrix to be decomposed. |
optimize_layer_num | Set 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_guess | String indicating the method to guess initial values for the optimalization. Possible values: "zeros" ,"random", "close_to_zero". |
Definition at line 46 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.apply_to | ( | self, | |
parameters_mtx, | |||
state_to_be_transformed | |||
) |
Definition at line 204 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.Generate_Circuit | ( | self, | |
layers, | |||
inner_blocks = 1 |
|||
) |
Call to generate the circuit ansatz.
layers | The number of layers. The depth of the generated circuit is 2*layers+1 (U3-CNOT-U3-CNOT...CNOT) |
inner_blocks | The number of U3-CNOT repetition within a single layer |
Definition at line 123 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.get_Circuit | ( | self | ) |
Call to retrieve the incorporated quantum circuit (Squander format)
Definition at line 213 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.get_Optimized_Parameters | ( | self | ) |
Call to get the optimized parameters set in numpy array.
Definition at line 77 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.get_Parameter_Num | ( | self | ) |
Call to get the number of free parameters in the gate structure used for the decomposition.
Definition at line 195 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.get_Qbit_Num | ( | self | ) |
Call to get the number of qubits in the circuit.
Definition at line 188 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.get_Qiskit_Circuit | ( | self | ) |
Export the unitary decomposition into Qiskit format.
Definition at line 223 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.get_Second_Renyi_Entropy | ( | self, | |
parameters = None , |
|||
input_state = None , |
|||
qubit_list = None |
|||
) |
Call to get the second Rényi entropy.
parameters | A float64 numpy array |
input_state | A complex array storing the input state. If None |0> is created. |
qubit_list | A subset of qubits for which the Rényi entropy should be calculated. Returns with the calculated entropy |
Definition at line 147 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.Optimization_Problem | ( | self, | |
parameters | |||
) |
Call to evaluate the VQE energy.
parameters | A float64 numpy array. The number of parameters can be retrieved with method get_Parameter_Num |
Definition at line 130 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.Optimization_Problem_Grad | ( | self, | |
parameters | |||
) |
Call to evaluate the VQE energy.
parameters | A float64 numpy array. The number of parameters can be retrieved with method get_Parameter_Num |
Definition at line 137 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Ansatz | ( | self, | |
ansatz_new | |||
) |
Call to set the ansatz type.
Currently imp
ansatz_new | String of the ansatz . Possible values: "HEA" (hardware efficient ansatz with U3 and CNOT gates). |
Definition at line 115 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Gate_Structure | ( | self, | |
Gate_structure | |||
) |
Call to set custom gate structure to used in the decomposition.
Gate_structure | An instance of SQUANDER Circuit |
Definition at line 243 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Gate_Structure_from_Binary | ( | self, | |
filename | |||
) |
Call to set custom layers to the gate structure that are intended to be used in the decomposition from a binary file created from SQUANDER.
filename | String containing the filename |
Definition at line 107 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Initial_State | ( | self, | |
initial_state | |||
) |
Call to get the number of free parameters in the gate structure used for the decomposition.
Definition at line 235 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Optimization_Tolerance | ( | self, | |
tolerance | |||
) |
Definition at line 92 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Optimized_Parameters | ( | self, | |
new_params | |||
) |
Call to set the parameters which are used as a starting point in the optimization.
A | numpy array containing the parameters. The number of parameters can be retrieved with method get_Parameter_Num |
Definition at line 85 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Optimizer | ( | self, | |
alg | |||
) |
Call to set the optimizer used in the VQE process.
optimizer | String indicating the optimizer. Possible values: "BFGS" ,"ADAM", "BFGS2", "ADAM_BATCHED", "AGENTS", "COSINE", "AGENTS_COMBINED". |
Definition at line 63 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.set_Project_Name | ( | self, | |
project_name | |||
) |
Call to set the name of the SQUANDER project.
project_name_new | new project name |
Definition at line 100 of file qgd_Variational_Quantum_Eigensolver_Base.py.
def squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.Start_Optimization | ( | self | ) |
Call to start solving the VQE problem to get the approximation for the ground state.
Definition at line 69 of file qgd_Variational_Quantum_Eigensolver_Base.py.
squander.variational_quantum_eigensolver.qgd_Variational_Quantum_Eigensolver_Base.qbit_num |
Definition at line 57 of file qgd_Variational_Quantum_Eigensolver_Base.py.