quil-lang / qvm

The high-performance and featureful Quil simulator.
Other
411 stars 57 forks source link

Write example implementation of VQE. #182

Closed jmbr closed 4 years ago

jmbr commented 4 years ago

Hartree-Fock.

On Fri, Sep 20, 2019, 11:34 Mark Skilbeck notifications@github.com wrote:

@notmgsk commented on this pull request.

In examples/vqe.lisp https://github.com/rigetti/qvm/pull/182#discussion_r326753744:

+;;;; examples/vqe.lisp +;;;; +;;;; Author: Juan M. Bello-Rivas + +(in-package #:qvm-examples) + +;;; Example of the usage of the variational quantum eigensolver algorithm to +;;; compute the ground state energy of an H2 molecule. The hard-coded values +;;; below are for a conformation where the inter-atomic distance is 0.5 +;;; Angstroms. The reference value for the ground energy at this conformation +;;; is -1.05515979 Hartree. + +(defparameter number-of-qubits 4

  • "Number of qubits in the quantum virtual machine")
  • +(defparameter reference-state "X 0; X 1" "Reference state program (HF).")

What is HF?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rigetti/qvm/pull/182?email_source=notifications&email_token=AAADE3IHLN7LGB66KHJS3ULQKUJSPA5CNFSM4IYZVB3KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCFOVXZI#pullrequestreview-291331045, or mute the thread https://github.com/notifications/unsubscribe-auth/AAADE3NMZXPPH7V6G6GJJJTQKUJSPANCNFSM4IYZVB3A .

notmgsk commented 4 years ago

Uh oh:

Unhandled ASDF/ACTION:CIRCULAR-DEPENDENCY in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                                       {10005984F3}>:
  Circular dependency:
     ((#<ASDF/LISP-ACTION:LOAD-OP > . #<ASDF/SYSTEM:SYSTEM "qvm-app">)
      (#<ASDF/LISP-ACTION:LOAD-OP >
       . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "qvm-app" "package">)
      (#<ASDF/LISP-ACTION:PREPARE-OP >
       . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "qvm-app" "package">)
      (#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/SYSTEM:SYSTEM "qvm-app">)
      (#<ASDF/LISP-ACTION:LOAD-OP > . #<ASDF/SYSTEM:SYSTEM "qvm-examples">)
      (#<ASDF/LISP-ACTION:LOAD-OP >
       . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "qvm-examples" "package">)
      (#<ASDF/LISP-ACTION:PREPARE-OP >
       . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "qvm-examples" "package">)
      (#<ASDF/LISP-ACTION:PREPARE-OP > . #<ASDF/SYSTEM:SYSTEM "qvm-examples">))
jmbr commented 4 years ago

The qvm-examples:qft-circuit function is being used inside qvm-app, hence the cyclic dependency. I could:

(a) Move (copy?) qft-circuit to app/src/benchmark-programs.lisp where it is used. (b) Create a new ASDF package solely for the VQE example.

I think option (a) makes more sense but it might confuse users who expect that function to be in the examples folder.

notmgsk commented 4 years ago

The qvm-examples:qft-circuit function is being used inside qvm-app, hence the cyclic dependency. I could:

(a) Move (copy?) qft-circuit to app/src/benchmark-programs.lisp where it is used. (b) Create a new ASDF package solely for the VQE example.

I think option (a) makes more sense but it might confuse users who expect that function to be in the examples folder.

Maybe just duplicate qft-circuit in both locations. It's not perfect, but I don't think it's a terrible thing to do.