Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import Yao.jl into IBM Qiskit Python code? #486

Open
OuCheng-Fu opened this issue Nov 9, 2023 · 0 comments
Open

How to import Yao.jl into IBM Qiskit Python code? #486

OuCheng-Fu opened this issue Nov 9, 2023 · 0 comments

Comments

@OuCheng-Fu
Copy link

OuCheng-Fu commented 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)

@OuCheng-Fu 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant