Skip to content

Commit

Permalink
Fix PVQD docs (Qiskit/qiskit#9273)
Browse files Browse the repository at this point in the history
* Fix PVQD docs and enable time evolvers import from module

* reduce to only fixing PVQD docs

* Fix snippet

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Cryoris and mergify[bot] authored Jan 19, 2023
1 parent 25e84e1 commit 22e8e4d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions qiskit_algorithms/time_evolvers/pvqd/pvqd.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,16 @@ class PVQD(RealTimeEvolver):
import numpy as np
from qiskit.algorithms.state_fidelities import ComputeUncompute
from qiskit.algorithms.time_evolvers.pvqd import PVQD
from qiskit.primitives import Estimator
from qiskit import BasicAer
from qiskit.algorithms.time_evolvers import TimeEvolutionProblem, PVQD
from qiskit.primitives import Estimator, Sampler
from qiskit.circuit.library import EfficientSU2
from qiskit.quantum_info import Pauli, SparsePauliOp
from qiskit.quantum_info import SparsePauliOp, Pauli
from qiskit.algorithms.optimizers import L_BFGS_B
sampler = Sampler()
fidelity = ComputeUncompute(sampler)
estimator = Estimator()
hamiltonian = 0.1 * SparsePauliOp([Pauli("ZZ"), Pauli("IX"), Pauli("XI")])
hamiltonian = 0.1 * SparsePauliOp(["ZZ", "IX", "XI"])
observable = Pauli("ZZ")
ansatz = EfficientSU2(2, reps=1)
initial_parameters = np.zeros(ansatz.num_parameters)
Expand All @@ -96,14 +95,14 @@ class PVQD(RealTimeEvolver):
pvqd = PVQD(
fidelity,
ansatz,
estimator,
initial_parameters,
estimator,
num_timesteps=100,
optimizer=optimizer,
)
# specify the evolution problem
problem = EvolutionProblem(
problem = TimeEvolutionProblem(
hamiltonian, time, aux_operators=[hamiltonian, observable]
)
Expand Down

0 comments on commit 22e8e4d

Please sign in to comment.