Problem: trying to implement and test quantum subroutines on quantum simulators I run into multiple challenges:

  1. Quantum simulation is a very hard problem: a very low number of simulated qubits is supported
  2. The toolkit does not offer arithmetic operations, often not even a structure representing numbers, e.g., a "quantum" integer. The simulators work on basis of distinct qubits only.

Solution: Assuming I am interested in translating a classical subroutine into a quantum circuit. The translation can be done without the use of entanglement and thus it would be sufficient to simulate a reversible ciruit (hence remove the overhead of simulating superpositons). Merely testing for functionality of such a translation does not require quantum effects.

Looking for: I am looking a tool(kit) that allows to construct and simulate reversible circuits for a large (a few thousands) number of (qu)bits. The toolkit should, if possible, allow the following:

  • (Classical) simulation of the circuit
  • Definition of subroutines (functions)
  • Definition of structures (e.g. array of (qu)bits to represent an integer)
  • Support a gate set that allows to construct arbitrary operations, e.g., Toffoli (no need to create superpositions though)
  • Predefined (reversible) arithmetic operations (optional)
  • GUI representation of the circuits, drag and drop (optional)

I would also be happy about a quantum simulator that allows to restrict to "classical" simualtion. Perhaps a quantum simulator is overkill and there are "classical" circuit construction tools that allow me to do this very easily (maybe VHDL?).

Question: Can anyone point me to simulators for reversible circuits?

I am aware of the extensive list of quantum simulators in quantiki, and must admit, that I did not try all of them. However, I do have some experience with the following:

Microsoft Liquid

  • Plenty example code
  • can simulate $\approx 22$ qubits (on my laptop)
  • can restrict oneself to stabilizer circuits (Clifford group) for larger number of qubits, but that does not give me Toffoli gates :(

Microsoft QSharp Programming Language

  • can simulate $< 30$ qubits
  • allows construction of structs; has integer/ floating-point representations
  • predefined quantum arithmetic

Simulator University Linz

  • seems to allow to simulate larger number of qubits for certain problem
  • poorly documented
  • only (qu)bit level operations
  • not actively developed

revkit/ cirkit RevKit

  • apparently simulation for reversible circuits
  • has a GUI representation of circuits
  • did not actually get this to run (only the gui)

Drag an Drop Quirk

  • GUI cuircit representation
  • allows to defined functions
  • works very well for small examples (great tool!)

IBM Qiskit

  • GUI circuit representation
  • allows to define structures and functions
  • no predefined arithmetic operations, but sample code for addition/ multiplication etc available on githut
  • simulation limited to $< 30$ (qu)bits

1 Answer 1


One of the simulators in Microsoft Quantum Development Kit is Toffoli simulator which seems to do exactly what you want.

  • It supports a limited set of primitive gates (X, CNOT and Toffoli gates, as well as other gates when their effect is X or identity), measurements in the computational basis and DumpMachine to output the state of the simulator.
  • It is a simulator for Q#, so all language features and libraries (including arithmetic) are available to it. The restriction on 30 simulatable qubits you mentioned comes not from Q# language itself but from the full-state simulator that is typically used with the Q# programs. Since Toffoli simulator doesn't create entanglement, it can simulate thousands of qubits - the default is 65k, but you can allocate more if you need.
  • It is available with IQ# and from qsharp Python package using %toffoli magic command and toffoli_simulate method, respectively.

You can find examples of using it with Q# in the Samples repository.

Full disclosure: I am part of the team working on Quantum Development Kit.

  • $\begingroup$ Works like a charm! :) Not sure how I could miss that. (Will leave this open for a few more days, maybe someone else got a solution they want to share too) $\endgroup$
    – Fleeep
    Aug 8, 2019 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.