You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from qiskit.algorithms import TimeEvolutionProblem, VarQITE
from qiskit.algorithms.time_evolvers.variational import ImaginaryMcLachlanPrinciple
from qiskit.quantum_info import SparsePauliOp
from qiskit.algorithms.gradients import ReverseEstimatorGradient, ReverseQGT
parameters = list(ansatz.parameters)
init_param_values = np.zeros(len(parameters))
for i in range(len(parameters)):
init_param_values[i] = np.pi / 4
If I want to use Yao.jl to speed up its calculation, what should I import? Since the computational runtime of RK45 and Reverse Estimator Gradient is still too long (1700 minutes for my smaller case, more than 60 days for my more complicated case, even without a result)
The text was updated successfully, but these errors were encountered:
OuCheng-Fu
changed the title
How to import Yao.jl into IBM Qiskit Python code
How to import Yao.jl into IBM Qiskit Python code?
Nov 9, 2023
I am doing a project involving Variational QITE using IBM Qiskit, the code is as the following:
`from qiskit.circuit.library import EfficientSU2
observable = qubitOp
ansatz = EfficientSU2(observable.num_qubits, reps=3)
ansatz.decompose().draw('mpl')
from qiskit.algorithms import TimeEvolutionProblem, VarQITE
from qiskit.algorithms.time_evolvers.variational import ImaginaryMcLachlanPrinciple
from qiskit.quantum_info import SparsePauliOp
from qiskit.algorithms.gradients import ReverseEstimatorGradient, ReverseQGT
parameters = list(ansatz.parameters)
init_param_values = np.zeros(len(parameters))
for i in range(len(parameters)):
init_param_values[i] = np.pi / 4
var_principle = ImaginaryMcLachlanPrinciple(qgt = ReverseQGT() , gradient = ReverseEstimatorGradient())
evo_gradient = var_principle.evolution_gradient(observable, ansatz, init_param_values, gradient_params = None)
print(evo_gradient)
time = 1
aux_ops = [observable]
evolution_problem = TimeEvolutionProblem(observable, time, aux_operators=aux_ops)
evolution_params = evolution_problem.validate_params()
print(evolution_problem)
print(evolution_params)
from qiskit_aer.estimator import Estimator
var_qite = VarQITE(ansatz, init_param_values, var_principle, Estimator(), ode_solver="RK45", num_timesteps=100, imag_part_tol=1e-07)
evolution_result = var_qite.evolve(evolution_problem)
print(evolution_result)`
If I want to use Yao.jl to speed up its calculation, what should I import? Since the computational runtime of RK45 and Reverse Estimator Gradient is still too long (1700 minutes for my smaller case, more than 60 days for my more complicated case, even without a result)
The text was updated successfully, but these errors were encountered: