/qSim

Quantum computer simulator library

Primary LanguageC++MIT LicenseMIT

qSim-cpp

Codacy Badge

Quantum computer simulator library

I'm building this to learn C++ and Quantum Information Theory simultaneously, so don't be surprised if they're both wrong. Instead, feel free to create a new issue or a new pull request so you can rub in exactly what I did wrong in a concise, well commented manner.

Thanks x

Installation

Requirements

  • C++14

Instructions

Download or clone qSim-cpp into some/directory/qSim

Usage example

// A confused qubit
// confused.cpp

#include "qSim.h"

using namespace qsim;

int main() {
    // initialize a |0> qubit
    math::Ket qubit = states::z0;

    std::cout << "qubit:\n";
    qubit.print();

    // apply a Hadamard gate to qubit
    qubit *= gates::H;

    std::cout << "confused qubit:\n";
    qubit.print();
}

From this directory, compile confused.cpp using your compiler of choice:

$ g++ -std=c++14 -I some/directory/qSim/include confused.cpp -o confused

Then run your compiled file:

$ ./confused

Should output something like:

qubit:

| 1 |
| 0 |

confused qubit:

| 0.707 |
| 0.707 |

For more examples and usage, please refer to the examples.

Release History

  • 0.0.1
    • Work in progress

Meta

Hayk Khachatryan – chat w/ mehi@hayk.io

Distributed under the MIT license. See LICENSE for more information.

https://github.com/haykkh/

Contributing

  1. Fork it (https://github.com/haykkh/qSim-cpp/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request