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

How to perform a measurement in acqdp? #20

Closed
gtaifu opened this issue Feb 9, 2022 · 2 comments
Closed

How to perform a measurement in acqdp? #20

gtaifu opened this issue Feb 9, 2022 · 2 comments

Comments

@gtaifu
Copy link

gtaifu commented Feb 9, 2022

There are two classes (Measurement and PureMeas) in circuit.py. Since this simulator is based on tensor-network and density matrix, the effect of a measurement can be represented as a density-matrix update. To my understanding, this is the method acqdp adopts.

In some cases, we are only interested in the state vector update, where a measurement collapses the state vector and returns a single bit representing the measurement result. How could we do this in acqdp?

Thanks!

cupjinhuang added a commit to cupjinhuang/acqdp that referenced this issue Feb 23, 2022
fix alibaba/acqdp alibaba#20

Add `Circuit.measure` that returns one-bit random outcome
and a conditional state. Add `Circuit.collapse` to collapse a circuit
into a single state. Add corresponding tests.
alibabaquantumlab pushed a commit that referenced this issue Feb 23, 2022
fix alibaba/acqdp #20

Add `Circuit.measure` that returns one-bit random outcome
and a conditional state. Add `Circuit.collapse` to collapse a circuit
into a single state. Add corresponding tests.
@cupjinhuang
Copy link
Contributor

Hello gtaifu,

We have added two methods measure and collapse in acqdp.circuit.Circuit.

The method measure of a circuit takes an argument specifying the index of the qubit to be measured, and returns a random measurement result and the corresponding conditional quantum state. Two optional arguments include remove_qubit, indicating whether the qubit being measured is to be removed from the system, and collapse, indicating whether the returned conditional state still preserves the tensor network structure.

The method collapse evaluates a quantum circuit as a tensor network, and replace the tensor network structure with the value of it. Doing this simplifies the quantum circuit and makes state vector update more efficient. collapse now only supports quantum circuits that are states, i.e. quantum operators with no input wires.

Please let us know if those functionalities meet your need.

@gtaifu
Copy link
Author

gtaifu commented Mar 3, 2022

@cupjinhuang thank you! I think it should work for us. I will integrate it into our open-source simulation platform (pyqcisim). If there is any question, I will return to you!

@gtaifu gtaifu closed this as completed Mar 3, 2022
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