Code Monkey home page Code Monkey logo

vqe's People

Contributors

mafaldaramoa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vqe's Issues

Changes in how cirq handles results.data

Hi,
I don't know if you still care about this project, given that it seems you have finished your masters (congrats!). If you don't care about keeping it up to date, that is perfectly reasonable, but do still please let me know how I can cite this if I end up publishing anything based on this.

If you would like to keep things up to date, I've found the following bug in CIRQ_UCCSD_VQE.ipynb:

Using the newest versions of OF and cirq, a KeyError occurs in the measureString function, which I believe is caused because cirq no longer saves the columns from identity Paulis in the results.data after this section:

if (pauliString != "I"*len(qubits)):
    s = cirq.Simulator()
    results = s.run(circuit,repetitions = repetitions)

It can be fixed by changing the for loop over range(repetitions) to the following:

for j in range(repetitions):
        meas = 1
        non_identities = 0
        for i in range(len(qubits)):
            if (pauliString[i] != "I"):
              
              meas = meas*(1-2*np.array(results.data)[j][non_identities]) # was meas = meas*(1-2*results.data[i][j]), but that failed. I guess Cirq changed how they save results.data
              non_identities += 1 # This was not here, but is necessary because Cirq no longer adds identity matrices to the results.data
        total += meas

Again, you are obviously under no obligation to keep this up to date, and I would love to credit you properly because this has been a great starting point for me in OF and Cirq, so really the main reason I'm posting this is so I can cite this in the future.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.