PH.ansatzes
ansatzes
This module contains all functions needed for creating QLM implementation for the ansatz of the Parent Hamiltonian paper:
Fumiyoshi Kobayashi and Kosuke Mitarai and Keisuke Fujii Parent Hamiltonian as a benchmark problem for variational quantum eigensolvers Physical Review A, 105, 5, 2002 https://doi.org/10.1103%2Fphysreva.105.052415
Authors: Gonzalo Ferro
- class tnbs.BTC_04_PH.PH.ansatzes.ansatzes.SolveCircuit(qlm_circuit, **kwargs)
Bases:
object
- get_job_results(jobid)
Given a Jobid retrieve the result and procces output
- run()
Solve Circuit
- save_parameters()
Saving Parameters
- save_state()
Saving State
- save_time()
- submit()
Submit circuit
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.angles_ansatz01(circuit, pdf_parameters=None)
Create the angles for ansatz01
- Parameters:
circuit (QLM circuit) – QLM circuit with the parametrized ansatzes
parameters (pandas DataFrame) – For providing the parameters to the circuit. If None is provide the parameters are set using som formula
- Returns:
circuit (QLM circuit) – QLM circuit with the parameters fixed
pdf_parameters (pandas DataFrame) – DataFrame with the values of the parameters
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.ansatz_qlm_01(nqubits=7, depth=3)
Implements QLM version of the Parent Hamiltonian Ansatz using parametric Circuit
- Parameters:
nqubits (int) – number of qubits for the ansatz
depth (int) – number of layers for the parametric circuit
- Returns:
qprog (QLM Program) – QLM program with the ansatz implementation in parametric format
theta (list) – list with the name of the variables of the QLM Program
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.ansatz_qlm_02(nqubits, depth=3)
Implements QLM version of the Parent Hamiltonian Ansatz using parametric Circuit
- Parameters:
nqubits (int) – number of qubits for the ansatz
depth (int) – number of layers for the parametric circuit
- Returns:
qprog (QLM Program) – QLM program with the ansatz implementation in parametric format
theta (list) – list with the name of the variables of the QLM Program
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.ansatz_selector(ansatz, **kwargs)
Function for selecting an ansatz
- Parameters:
ansatz (text) – The desired ansatz
kwargs (keyword arguments) – Different keyword arguments for configurin the ansazt, like nqubits or depth
- Returns:
circuit – The atos myqlm circuit implementation of the input ansatz
- Return type:
Atos myqlm circuit
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.getting_job(**configuration)
For getting a job from QLM. Configuration need to have following keys: nqubits, job_id, save, filename
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.proccess_qresults(result, qubits, complete=True)
Post Process a QLM results for creating a pandas DataFrame
- Parameters:
result (QLM results from a QLM qpu.) – returned object from a qpu submit
qubits (int) – number of qubits
complete (bool) – for return the complete basis state.
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.run_ansatz(**configuration)
For creating an ansatz and solving it
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.solving_circuit(qlm_state, nqubit, reverse=True)
Solving a complete qlm circuit
- Parameters:
qlm_circuit (QLM circuit) – qlm circuit to solve
nqubit (int) – number of qubits of the input circuit
qlm_qpu (QLM qpu) – QLM qpu for solving the circuit
reverse (True) – This is for ordering the state from left to right If False the order will be form right to left
- Returns:
state – DataFrame with the complete simulation of the circuit
- Return type:
pandas DataFrame
- tnbs.BTC_04_PH.PH.ansatzes.ansatzes.submit_circuit(qlm_circuit, qlm_qpu)
Solving a complete qlm circuit
- Parameters:
qlm_circuit (QLM circuit) – qlm circuit to solve
qlm_qpu (QLM qpu) – QLM qpu for solving the circuit
launch_ansatzes
For launching a VQE quantum step execution Author: Gonzalo Ferro
- tnbs.BTC_04_PH.PH.ansatzes.launch_ansatzes.run_id(**configuration)
launch_get_jobs
For launching a VQE quantum step execution Author: Gonzalo Ferro
- tnbs.BTC_04_PH.PH.ansatzes.launch_get_jobs.run_id(**configuration)