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

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=None, accelerator_num=0, backend=None, density_noise=None)
 Constructor of the class. More...
 
def _normalize_density_noise_spec (density_noise)
 
def _normalize_vqe_backend_name (backend)
 
def apply_to (self, parameters_mtx, state_to_be_transformed)
 
def describe_density_bridge (self)
 Return reviewable metadata for the currently supported density bridge. More...
 
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_Density_Matrix_Noise (self, density_noise)
 Configure ordered fixed local-noise insertions for the density backend. 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

 _DENSITY_NOISE_CHANNEL_SPECS
 
 _VQE_BACKEND_CONFIG_KEY
 
 _VQE_BACKEND_NAME_TO_CODE
 
 _VQE_DEFAULT_BACKEND
 
 backend
 
 density_noise
 
 qbit_num
 

Function Documentation

◆ __init__()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.__init__ (   self,
  Hamiltonian,
  qbit_num,
  config = None,
  accelerator_num = 0,
  backend = None,
  density_noise = None 
)

Constructor of the class.

Parameters
UmtxThe unitary matrix to be decomposed.
configDictionary describing optimization hyperparameters.
accelerator_numOptional accelerator identifier.
backendOptional backend selector. Supported values are "state_vector" and "density_matrix". When omitted, the VQE keeps the legacy state-vector behavior. Explicit backend="density_matrix" activates the supported exact noisy mixed-state energy path for the Phase 2 anchor workflow.
density_noiseOptional ordered list of fixed local density-noise insertions. Each entry must define a channel, target qubit, after_gate_index, and fixed noise value. The canonical Phase 2 local-noise channels are local_depolarizing, amplitude_damping, and phase_damping; the aliases depolarizing and dephasing normalize to the local canonical names. Phase 2 only supports this surface together with backend="density_matrix" on the supported HEA anchor circuit.
Returns
An instance of the class

Definition at line 175 of file qgd_Variational_Quantum_Eigensolver_Base.py.

Here is the call graph for this function:

◆ _normalize_density_noise_spec()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base._normalize_density_noise_spec (   density_noise)
private

Definition at line 68 of file qgd_Variational_Quantum_Eigensolver_Base.py.

Here is the caller graph for this function:

◆ _normalize_vqe_backend_name()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base._normalize_vqe_backend_name (   backend)
private

Definition at line 48 of file qgd_Variational_Quantum_Eigensolver_Base.py.

Here is the caller graph for this function:

◆ apply_to()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.apply_to (   self,
  parameters_mtx,
  state_to_be_transformed 
)

Definition at line 345 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ describe_density_bridge()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.describe_density_bridge (   self)

Return reviewable metadata for the currently supported density bridge.

Returns
A dictionary describing the generated source, ordered bridge operations, and fixed local-noise insertions used by the density path.

Definition at line 404 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ Generate_Circuit()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.Generate_Circuit (   self,
  layers,
  inner_blocks = 1 
)

Call to generate the circuit ansatz.

Parameters
layersThe number of layers. The depth of the generated circuit is 2*layers+1 (U3-CNOT-U3-CNOT...CNOT)
inner_blocksThe number of U3-CNOT repetition within a single layer

Definition at line 264 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ get_Circuit()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.get_Circuit (   self)

Call to retrieve the incorporated quantum circuit (Squander format)

Returns
Return with a Qiskit compatible quantum circuit.

Definition at line 354 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ get_Optimized_Parameters()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.get_Optimized_Parameters (   self)

Call to get the optimized parameters set in numpy array.

Returns
Returns with the optimized parameters

Definition at line 218 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ get_Parameter_Num()

def squander.VQA.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 336 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ get_Qbit_Num()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.get_Qbit_Num (   self)

Call to get the number of qubits in the circuit.

Returns
Returns with the number of qubits

Definition at line 329 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ get_Qiskit_Circuit()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.get_Qiskit_Circuit (   self)

Export the unitary decomposition into Qiskit format.

Returns
Return with a Qiskit compatible quantum circuit.

Definition at line 364 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ get_Second_Renyi_Entropy()

def squander.VQA.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
parametersA float64 numpy array
input_stateA complex array storing the input state. If None |0> is created.
qubit_listA subset of qubits for which the Rényi entropy should be calculated. Returns with the calculated entropy

Definition at line 288 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ Optimization_Problem()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.Optimization_Problem (   self,
  parameters 
)

Call to evaluate the VQE energy.

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

Definition at line 271 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ Optimization_Problem_Grad()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.Optimization_Problem_Grad (   self,
  parameters 
)

Call to evaluate the VQE energy.

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

Definition at line 278 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Ansatz()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.set_Ansatz (   self,
  ansatz_new 
)

Call to set the ansatz type.

Currently imp

Parameters
ansatz_newString of the ansatz . Possible values: "HEA" (hardware efficient ansatz with U3 and CNOT gates).

Definition at line 256 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Density_Matrix_Noise()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.set_Density_Matrix_Noise (   self,
  density_noise 
)

Configure ordered fixed local-noise insertions for the density backend.

Parameters
density_noiseA list of dictionaries with channel, target, after_gate_index, and noise value metadata. The supported required Phase 2 local-noise vocabulary is local_depolarizing, amplitude_damping, and phase_damping; depolarizing and dephasing are accepted aliases that normalize to the canonical local names. Phase 2 treats this as a mixed-state-only surface and rejects it on state_vector workflows. The supported positive path is the exact noisy HEA anchor workflow on the density_matrix backend.

Definition at line 391 of file qgd_Variational_Quantum_Eigensolver_Base.py.

Here is the call graph for this function:

◆ set_Gate_Structure()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.set_Gate_Structure (   self,
  Gate_structure 
)

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

Parameters
Gate_structureAn instance of SQUANDER Circuit

Definition at line 416 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Gate_Structure_from_Binary()

def squander.VQA.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.

Parameters
filenameString containing the filename

Definition at line 248 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Initial_State()

def squander.VQA.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 376 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Optimization_Tolerance()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.set_Optimization_Tolerance (   self,
  tolerance 
)

Definition at line 233 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Optimized_Parameters()

def squander.VQA.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.

Parameters
Anumpy array containing the parameters. The number of parameters can be retrieved with method get_Parameter_Num

Definition at line 226 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Optimizer()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.set_Optimizer (   self,
  alg 
)

Call to set the optimizer used in the VQE process.

Parameters
optimizerString indicating the optimizer. Possible values: "BFGS" ,"ADAM", "BFGS2", "ADAM_BATCHED", "AGENTS", "COSINE", "AGENTS_COMBINED".

Definition at line 204 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ set_Project_Name()

def squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.set_Project_Name (   self,
  project_name 
)

Call to set the name of the SQUANDER project.

Parameters
project_name_newnew project name

Definition at line 241 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ Start_Optimization()

def squander.VQA.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 210 of file qgd_Variational_Quantum_Eigensolver_Base.py.

Variable Documentation

◆ _DENSITY_NOISE_CHANNEL_SPECS

squander.VQA.qgd_Variational_Quantum_Eigensolver_Base._DENSITY_NOISE_CHANNEL_SPECS
private

Definition at line 39 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ _VQE_BACKEND_CONFIG_KEY

squander.VQA.qgd_Variational_Quantum_Eigensolver_Base._VQE_BACKEND_CONFIG_KEY
private

Definition at line 38 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ _VQE_BACKEND_NAME_TO_CODE

squander.VQA.qgd_Variational_Quantum_Eigensolver_Base._VQE_BACKEND_NAME_TO_CODE
private

Definition at line 33 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ _VQE_DEFAULT_BACKEND

squander.VQA.qgd_Variational_Quantum_Eigensolver_Base._VQE_DEFAULT_BACKEND
private

Definition at line 37 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ backend

squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.backend

Definition at line 196 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ density_noise

squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.density_noise

Definition at line 197 of file qgd_Variational_Quantum_Eigensolver_Base.py.

◆ qbit_num

squander.VQA.qgd_Variational_Quantum_Eigensolver_Base.qbit_num

Definition at line 192 of file qgd_Variational_Quantum_Eigensolver_Base.py.