- A small, hackable, optimized simulation framework for learning quantum computing with examples.
- Trace gate operations to display state changes as gates are applied.
- Prints amplitude, probability, and phase.
- Reasonably performant for 10 - 20 qubits using the quantastica engine.
- The primary focus is to create a breadth of easy to follow quantum computing examples.
- Compare and contrast desired outcomes and non-desired outcomes.
- Wherever possible, display input state alone first and then output state.
- This project is a work in progress.
- None of this material has been peer reviewed. It could be you!
- One potential effort is to convert these examples into unit tests.
- encode two classical bits inside a single qubit
- amplify a probability amplitude
- teleport the state of one qubit to another qubit
- find the frequency of a period of phases
- increment integers in superposition
- add two integers in superposition
- add two integers but not in super position
- create a bell state
- create a GHZ state
- rotate phase
- illustrate phase kickback
- estimate phase
- implement a two condition not operator
- the Deutsch-Jozsa algorithm: a classical illustration
- the Deutsch-Jozsa algorithm: a quantum implementation
- the Bernstein-Vazirani algorithm: a classical illustration
- the Bernstein-Vazirani algorithm: a quantum implementation
- Simon's algorithm: a classical illustration
- Simon's algorithm: a quantum implementation
- Shor's algorithm: semiprime factoring: a naive illustration
- Shor's algorithm: semiprime factoring: a classical illustration
- Shor's algorithm: semiprime factoring: a quantum implementation: incomplete
- more examples
git clone https://github.com/simplygreatwork/obvious.git
npm install
cd examples
node amplify.js
- Currently based on a condensed implementation of Quantastica's Quantum Circuit.
- Previous engines have been or are based on:
- Thank you to O'Reilly and Eric R. Johnston, Mercedes Gimeno-Segovia, and Nic Harrigan for publishing the book "Programming Quantum Computers". Many of the examples here are reworked from the material in that book.
- Thank you to David B. Kemp. Occasionally, I ping David with emails about his project jsqubits. He is super helpful.
- Thank you to Quantastica for publishing the simulator Quantum Circuit using an MIT license. I am currently using a pared down version of Quantum Circuit for these quantum examples.
-
Create simple examples of basic quantum circuits.
- Even go as far as to illustrate concepts such as:
- how phase is calculated
- how magnitude is calculated
- matrix multiplication
- Math.log
- Math.Pi
- angles and radian conversion
- least common multiple
- greatest common denominator
- continued fractions
- power mod
- power factor
- binary bit math
- complex numbers
- Even go as far as to illustrate concepts such as:
-
Keep as much helper code inside each example. Try not to obfuscate with additional separate layers.
- If an example illustrates the quantum fourier transform primarily, implement the QFT as a separate function inside the example.
- If an example entangles two qubits, implement the entanglement as a separate function inside the example.
- If an example uses a qubit or qubit range helper object, implement as a separate function inside the example.
-
Keep helper modules as composable and as independent as possible:
- For example, converting bit arrays to and from integers and strings is implemented independently from circuits.
- For example, the core circuit implementations are separate from the circuit class used by examples.
- Allows for custom displays and custom debugging and tracing.
- Keeps the core circuit and gate implementations tight and focused.
- https://github.com/pnnl/QASMBench
- https://www.oreilly.com/library/view/programming-quantum-computers/978149203967/9
- https://oreilly-qc.github.io/
- https://quantum-circuit.com/
- https://github.com/quantastica/quantum-circuit
- http://davidbkemp.github.io/
- http://qcsimulator.github.io/
- https://github.com/adamisntdead/qics
- https://www.quantum-inspire.com/
- https://qiskit.org/