alibaba / acqdp

Alibaba Cloud - Quantum Development Platform
MIT License
155 stars 42 forks source link

Add intermediate measure for state vector simulation #21

Closed cupjinhuang closed 2 years ago

cupjinhuang commented 2 years ago

Add 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.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.