https://github.com/blakegerard/quantumcircuitsimulator

A personal exercise in modeling quantum computing circuits. Implemented with Eigen 3.3.7

https://github.com/blakegerard/quantumcircuitsimulator

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.4%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

A personal exercise in modeling quantum computing circuits. Implemented with Eigen 3.3.7

Basic Info
  • Host: GitHub
  • Owner: BlakeGerard
  • Language: C++
  • Default Branch: master
  • Homepage:
  • Size: 7.81 MB
Statistics
  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 6 years ago · Last pushed over 5 years ago

https://github.com/BlakeGerard/QuantumCircuitSimulator/blob/master/

# QuantumCircuitSimulator

A personal exercise in modeling quantum computing circuits. Implemented with Eigen 3.3.7

# Dependencies
This project relies on [Eigen3](https://eigen.tuxfamily.org/index.php?title=Main_Page) for matrix computations.

This project utilizes [Catch2](https://github.com/catchorg/Catch2.git) for testing.

# Installation
After installing Eigen3 and Catch2, follow these steps to download and build the QCS library and testing executable.

1. Clone the repository
``` 
    git clone https://github.com/BlakeGerard/QuantumCircuitSimulator.git

    cd QuantumCircuitSimulator/
```

2. Build with cmake
```
    mkdir build
    cd build
    cmake ..
    make
```

3. Run alltests executable from build directory to confirm installation
```
    ./alltests
```

I have provided a ```sample playground.cpp``` file for demo purposes. Run the following command to compile this file:
```
g++ -std=c++11 playground.cpp -o playground.exe -Lpath/to/build -lqcs
```

# Available Gates
1. Hadamard (H)
2. Pauli-X (X)
3. Pauli-Y (Y)
4. Pauli-Z (Z)
5. Phase (R)
6. S Gate (S)
7. T Gate (T)
8. U3 Gate (U3), https://arxiv.org/pdf/1707.03429.pdf, p. 5
9. CNOT (CNOT)
10. Controlled-Y (CY)
11. Controlled-Z (CZ)
12. Controlled-Phase (CR)
13. SWAP (SWAP)
14. Toffoli (CCNOT)

# Examples
## Quantum Teleportation with Predefined Qubits
    Q_Circuit circuit = Q_Circuit();

    // For this circuit, we pre-define qubit_m
    // Qubits default to state |0>
    Qubit qubit_m = Qubit(1.0/sqrt(3.0), sqrt(2.0/3.0));
    Qubit qubit_1 = Qubit();
    Qubit qubit_2 = Qubit();    
    std::vector qubits = {qubit_m, qubit_1, qubit_2};

    // Add qubits and apply gates to specified indices
    circuit.add_qubits(qubits);
    circuit.H(1);
    circuit.CNOT(1, 2);
    circuit.CNOT(0, 1);
    circuit.H(0);

    // Measure the results
    std::vector results = circuit.measure({0, 1});
    if (results.at(1) == 1) {circuit.X(2);}
    if (results.at(0) == 1) {circuit.Z(2);}

    // Print the final state of the circuit
    std::cout << circuit.get_state() << std::endl;

Owner

  • Name: Blake Gerard
  • Login: BlakeGerard
  • Kind: user
  • Location: Norman, OK

Master's Student of Computer Science at the University of Oklahoma.

GitHub Events

Total
Last Year