Comments (6)
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.
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.
A relative comment: The qsim format is deprecated. Is it possible to import circuit from Cirq's JSON format?
from acqdp.
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.
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.
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)
- Examples are wrong or inaccurate
- cut_kKaHyPar_sea20.ini is not found when package is installed HOT 2
- Documentation about how to construct a circuit? HOT 1
- Could you add more detailed example of how to use getDeployPlugin() feature? HOT 2
- visualization of the tensor graph and the contraction tree HOT 2
- Possible bug HOT 2
- 实测结果问题 HOT 3
- How to perform a measurement in acqdp? HOT 2
- ContractionTree.branch_info() returns empty list when slicing is applied HOT 3
- KHP order finder halts with "Invalid object identifier" HOT 3
- TensorNetwork.find_order() returns None when cost/cw is high HOT 3
- Generation of CFI files / circuits. HOT 3
- ValueError: too many enisum subscripts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acqdp.