1919from qiskit .circuit .library import n_local
2020
2121from qiskit_scaleway import ScalewayProvider
22- from qiskit_scaleway .primitives import EstimatorV1
22+ from qiskit_scaleway .primitives import Estimator
2323
2424provider = ScalewayProvider (
2525 project_id = "<your-scaleway-project-id>" ,
3333session_id = backend .start_session (name = "test-session" , deduplication_id = "my-workshop" )
3434
3535# Create an estimator (v1) with the backend and the session
36- estimator = EstimatorV1 (backend = backend , session_id = session_id )
36+ estimator = Estimator (backend = backend , session_id = session_id )
3737
3838# Specify the problem Hamiltonian
3939hamiltonian = SparsePauliOp .from_list (
@@ -56,15 +56,15 @@ def cost_function(
5656 params ,
5757 ansatz : QuantumCircuit ,
5858 hamiltonian : BaseOperator ,
59- estimator : EstimatorV1 ,
59+ estimator : Estimator ,
6060) -> float :
6161 """Cost function for the VQE.
6262
6363 Return the estimated expectation value of the Hamiltonian
6464 on the state prepared by the Ansatz circuit.
6565 """
6666 return float (
67- estimator .run (ansatz , hamiltonian , parameter_values = params ).result ().values [0 ]
67+ estimator .run ([( ansatz , hamiltonian , params )] ).result ().values [0 ]
6868 )
6969
7070
0 commit comments