<commit_before># Quirk

A toy for exploring and understanding the behavior of small quantum circuits.

| master | dev |
|--------|-----|
| [![Build Status](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector.svg?branch=master)](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector)      | [![Build Status](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector.svg?branch=dev)](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector) |

Defining features:

- Runs in web browsers.
- Drag-and-drop circuit editing.
- Simulates and animates the effects of operations on up to 16 qubits in real time.
- Inline displays for conditional and marginal states.
- Bookmarkable circuits.

# Screenshots

Quantum teleportation circuit, with Bloch-sphere state displays inserted:

![Quantum teleportation](/README_TeleportationLoop.gif)

Quantum pigeonhole circuit, showing the toolbox and default after-circuit state displays:

![The Inspector](/README_Pigeonhole.png)

Reacting and animating smoothly while working with ten qubits:

![Ten qubits animation](/README_TenQubitsLoop.gif)

# Building

Please open an issue if these instructions don't work for you.
The example terminal commands have been tested on a fresh Ubuntu install.

0. **[Have git and Node.js installed](https://nodejs.org/en/download/)**.

    `sudo add-apt-repository universe`
    
    `sudo apt-get update`
    
    `sudo apt-get install --yes git npm nodejs-legacy`

    *(The first two commands are only needed for REALLY fresh installs. Still-a-Live-CD fresh. nodejs-legacy is needed
    to workaround [an issue in grunt.js](https://github.com/nodejs/node-v0.x-archive/issues/3911).)*

0. **Clone the quantum circuit inspector repository's contents**.

    `git clone https://github.com/Strilanc/Quantum-Circuit-Inspector.git`

0. **Install the project's dev dependencies**.

    `cd Quantum-Circuit-Inspector`
    
    `npm install`

    *(If you're on Windows, you'll need to work around
      [this bug in grunt-traceur](https://github.com/aaronfrost/grunt-traceur/issues/66) by going to line 49 of
      `node_modules/grunt-traceur/tasks/traceur.js` and replacing the 'path.sep' with '"/"'. I wish I was joking.)*

0. **(*Optional*) Run the tests**.

    `npm run test-firefox`

0. **Build the output files**.

    `npm run build`

0. **Confirm the output works by opening `out/index.html` with a web browser**.

    `firefox out/index.html`

0. **Copy `out/index.html` and `out/src.min.js` to wherever you want**.<commit_msg>Added limitations and "try it" to readme<commit_after># Quirk

A toy for exploring and understanding the behavior of small quantum circuits.

| master | dev |
|--------|-----|
| [![Build Status](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector.svg?branch=master)](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector)      | [![Build Status](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector.svg?branch=dev)](https://travis-ci.org/Strilanc/Quantum-Circuit-Inspector) |

Defining features:

- Runs in web browsers.
- Drag-and-drop circuit editing.
- Simulates and animates the effects of operations on up to 16 qubits in real time.
- Inline displays for conditional and marginal states.
- Bookmarkable circuits.

Notable limitations (a.k.a. future features):

- User-defined custom gates.
- Multi-wire gates and displays.
- Putting measured wires back into superposition. Controlled measurement.

# Try It

[algorithmicassertions.com/quirk](http://algorithmicassertions.com/quirk)

# Screenshots

Quantum teleportation circuit, with Bloch-sphere state displays inserted:

![Quantum teleportation](/README_TeleportationLoop.gif)

Quantum pigeonhole circuit, showing the toolbox and default after-circuit state displays:

![The Inspector](/README_Pigeonhole.png)

Reacting and animating smoothly while working with ten qubits:

![Ten qubits animation](/README_TenQubitsLoop.gif)

# Building

Please open an issue if these instructions don't work for you.
The example terminal commands have been tested on a fresh Ubuntu install.

0. **[Have git and Node.js installed](https://nodejs.org/en/download/)**.

    `sudo add-apt-repository universe`
    
    `sudo apt-get update`
    
    `sudo apt-get install --yes git npm nodejs-legacy`

    *(The first two commands are only needed for REALLY fresh installs. Still-a-Live-CD fresh. nodejs-legacy is needed
    to workaround [an issue in grunt.js](https://github.com/nodejs/node-v0.x-archive/issues/3911).)*

0. **Clone the repository**.

    `git clone https://github.com/Strilanc/Quantum-Circuit-Inspector.git`

0. **Install the dev dependencies**.

    `cd Quantum-Circuit-Inspector`
    
    `npm install`

    *(If you're on Windows, you'll need to work around
      [this bug in grunt-traceur](https://github.com/aaronfrost/grunt-traceur/issues/66) by going to line 49 of
      `node_modules/grunt-traceur/tasks/traceur.js` and replacing the 'path.sep' with '"/"'. I wish I was joking.)*

0. **(*Optional*) Run the tests**.

    `npm run test-firefox`

0. **Build the output files**.

    `npm run build`

0. **Confirm the output works by opening `out/index.html` with a web browser**.

    `firefox out/index.html`

0. **Copy `out/index.html` and `out/src.min.js` to wherever you want**.
{'fraction_non_alphanumeric': 0.12284032656161002, 'fraction_numerical': 0.0068350104423770645, 'mean_word_length': 3.8285976168652613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2905457', 'n_tokens_mistral': 1729, 'n_tokens_neox': 1604, 'n_words': 511}