quantumlib / qsim

Schrödinger and Schrödinger-Feynman simulators for quantum circuits.
Apache License 2.0
447 stars 149 forks source link

Classical control #149

Open 95-martin-orion opened 4 years ago

95-martin-orion commented 4 years ago

In order to represent quantum teleportation, error correction, and other algorithms, qsim must support classical control. There are three key parts to this feature:

  1. Classical registers: qsim must be able to track classical variables alongside the quantum state. These integer variables include measurement output (added in #141), user-specified input, and calculated values.
  2. Classical operators: qsim must have a framework for applying arithmetic functions to classical registers and storing the result in a target register. This framework should accept user-specified functions - the operators need not be defined in qsim itself.
  3. Classical control: qsim must allow classical registers to control quantum gates. A "switch" operation is sufficient for this (given an input value, and a (case, gate) mapping, apply the gate whose case matches the input, if one exists).
daxfohl commented 2 years ago

xref https://github.com/quantumlib/Cirq/pull/4631, the classical control PR for Cirq.