GithubHelp home page GithubHelp logo

Comments (6)

fangzh-umich avatar fangzh-umich commented on April 19, 2024

The circuit simulation example reads an input file in the "qsim format" described in https://github.com/quantumlib/qsim/blob/master/docs/input_format.md, although we haven't implemented all those gates, but only h, cz, t, x_1_2, y_1_2, hz_1_2, is, rz, and fs.

We call this format the "GRCS format" because it is the same circuit format used in https://github.com/sboixo/GRCS. It also appears in the public dataset of the Nature paper by Google that claims quantum supremacy.

Maybe we should add a docstring for the GRCS function that explains this file format.

from acqdp.

zhoupingjay avatar zhoupingjay commented on April 19, 2024

Hi, I tried writing a simplest circuit using the "qsim" format:

1
0 x 0
1 h 0

It only contains one qubit, using one X gate and one H gate. I then ran the circuit with circuit_simulation example:

python3 examples/circuit_simulation.py hello_acqdp.txt

But I got error from the example:

Traceback (most recent call last):
  File "/Users/zhouping/GitHub/acqdp/examples/circuit_simulation.py", line 122, in <module>
    c = GRCS(args.circuit_file, simplify=False)
  File "/Users/zhouping/GitHub/acqdp/examples/circuit_simulation.py", line 67, in GRCS
    int(x) for x in words[2:2 + size_table[words[1].lower()]])
KeyError: 'x'

from acqdp.

zhoupingjay avatar zhoupingjay commented on April 19, 2024

A relative comment: The qsim format is deprecated. Is it possible to import circuit from Cirq's JSON format?

from acqdp.

zhoupingjay avatar zhoupingjay commented on April 19, 2024

Another related question: How do I add measurements to the circuit, e.g. something like what I did this notebook:
https://github.com/zhoupingjay/quantum/blob/main/2-bit-Deutsch-Problem.ipynb

circuit.append([cirq.measure(q0), cirq.measure(q1)],
                  strategy=cirq.InsertStrategy.NEW_THEN_INLINE)

from acqdp.

fangzh-umich avatar fangzh-umich commented on April 19, 2024

As mentioned above, we did not implement all the gates supported by the "qsim" format, but only the ones used in Google's random circuits. The GRCS function is intended as a demonstration of how one could convert other circuit formats to our format, not a fully functional converter.

Maybe we could try to implement importing circuits from Cirq's JSON format if you could link to a complete format specification.

from acqdp.

fangzh-umich avatar fangzh-umich commented on April 19, 2024

Measurements are a bit complicated. If you want to calculate the amplitude (or the probability) of a specific measurement result, you can use ZeroMeas or OneMeas. If you want to calculate the amplitude for all (computational basis) measurement results, you should just omit the measurement at all: The way the conversion from circuits to tensor networks work, all "open" qubits are implicitly "measured" in the computational basis. Other scenarios may require more creative solutions; see our QEC demo for some examples.

from acqdp.

Related Issues (14)

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.