Skip to content

A small, hackable, optimized framework for learning quantum computing with examples.

License

Notifications You must be signed in to change notification settings

simplygreatwork/obvious

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A small, hackable, optimized simulation framework for learning quantum computing with examples.

Features

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

Caution

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

Examples

Install

git clone https://github.com/simplygreatwork/obvious.git
npm install
cd examples
node amplify.js

Simulation

Special thanks (acknowledgements and attribution)

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

Goals

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

References & links