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

VQE documentation is out of date with code #212

Open
jmbr opened this issue Jul 2, 2019 · 1 comment
Open

VQE documentation is out of date with code #212

jmbr opened this issue Jul 2, 2019 · 1 comment

Comments

@jmbr
Copy link

jmbr commented Jul 2, 2019

When running the code snippets in grove/docs/vqe.rst the line

result = vqe_inst.vqe_run(small_ansatz, hamiltonian, initial_angle, samples=10000, qvm=noisy_qvm)

Raises the following exception:
TypeError: vqe_run() got an unexpected keyword argument 'qvm'

Similarly, the line result = vqe_inst.vqe_run(small_ansatz, hamiltonian, initial_angle, samples=10000, qvm=qvm) yields the error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~/test_vqe.py in <module>
     17 vqe_inst = VQE(minimizer=minimize,
     18                minimizer_kwargs={'method': 'nelder-mead', 'options': {'disp': True}})
---> 19 result = vqe_inst.vqe_run(small_ansatz, hamiltonian, initial_angle)

~/rigetti/grove/grove/pyvqe/vqe.py in vqe_run(self, variational_state_evolve, hamiltonian, initial_params, gate_noise, measurement_noise, jacobian, qc, disp, samples, return_all)
    133             qc = QuantumComputer(name=f"{len(qubits)}q-noisy-qvm",
    134                                  qam=QVM(gate_noise=gate_noise,
--> 135                                          measurement_noise=measurement_noise))
    136         else:
    137             self.qc = qc

~/rigetti/pyquil/pyquil/api/_error_reporting.py in wrapper(*args, **kwargs)
    236             global_error_context.log[key] = pre_entry
    237
--> 238         val = func(*args, **kwargs)
    239
    240         # poke the return value of that call in

TypeError: __init__() missing 1 required positional argument: 'connection'```
ReadingSteiner122 added a commit to ReadingSteiner122/grove that referenced this issue Jun 2, 2020
…date)

qvm argname was changed to qc in a later iteration of the vqe_run() in class VQE
@ReadingSteiner122
Copy link

The correct implementation of the function call is
result = vqe_inst.vqe_run(small_ansatz, hamiltonian, initial_angle, samples = 1000, qc=noisy_qvm)

I believe the function definition for vqe_run in class VQE was changed at a later date and the documentation wasn't updated to match the changes.

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

2 participants