Skip to content

Latest commit

 

History

History
74 lines (56 loc) · 4.46 KB

README.md

File metadata and controls

74 lines (56 loc) · 4.46 KB

QRAFT

Reverse Your Quantum Circuit and Know the Correct Program Output

Authored By: Tirthak Patel and Devesh Tiwari
Implemented By: Bhargav C N

Requires: pip 24.0 Python 3.12.2

Installation

Create virtual environment

python3 -m virtualenv venv

Activate virtual environment

source venv/bin/activate

Install requirements

pip install -r requirements.txt

Usage

  • Clone the repository and Make sure you to finish the installation process mentioned above
  • Generate random circuits data for testing and training
    python qraft-gen/generate_data.py
  • You can change the params before run in qraft-gen/generate_data.py file like total number of circuits and simulations per circuit ( These params are in all-caps) you can also change the file name
  • After the data is generated use it as the input to the training and testing model
python qraft-predict/train.py

This requires the data generated from the previous step

  • After successful execution of the above command. The model would be present as qraft-1.pkl
  • Test the model using the following command:
python qraft-predict/predict.py
  • You can also use the data generator to generate datasets for predicting by altering the TOTAL_CIRCUITS_REQUIRED
  • Examine the accuracy of your circuit using
python qraft-gen/examine_circuit.py

This provides three graphs which provides insights on the model prediction which is corrected true state probability

Modules Description

  • qraft-gen: Module that generates random quantum circuits for training and testing data
  • qraft-predict: Module that generates the QRAFT core model using the generated data

Outputs

One of the FC & FRC circuit generated by circuit generator

     ┌────────────┐    ┌───────────┐    ┌───────────┐
q_0: ┤ U1(5.2566) ├────┤ U1(2.455) ├────┤ U1(2.636) ├
     └───┬───┬────┘┌───┴───────────┴───┐└───────────┘
q_1: ────┤ X ├─────┤ U2(0.776,0.66403) ├──────■──────
         └─┬─┘     └──┬─────────────┬──┘    ┌─┴─┐    
q_2: ──────■──────────┤ U1(0.26441) ├───────┤ X ├────
                      └─────────────┘       └───┘    
     ┌────────────┐    ┌───────────┐    ┌───────────┐┌───────────┐    ┌───────────┐    ┌────────────┐
q_0: ┤ U1(5.2566) ├────┤ U1(2.455) ├────┤ U1(2.636) ├┤ U1(2.636) ├────┤ U1(2.455) ├────┤ U1(5.2566) ├
     └───┬───┬────┘┌───┴───────────┴───┐└───────────┘└───────────┘┌───┴───────────┴───┐└───┬───┬────┘
q_1: ────┤ X ├─────┤ U2(0.776,0.66403) ├──────■────────────■──────┤ U2(0.776,0.66403) ├────┤ X ├─────
         └─┬─┘     └──┬─────────────┬──┘    ┌─┴─┐        ┌─┴─┐    └──┬─────────────┬──┘    └─┬─┘     
q_2: ──────■──────────┤ U1(0.26441) ├───────┤ X ├────────┤ X ├───────┤ U1(0.26441) ├─────────■───────
                      └─────────────┘       └───┘        └───┘       └─────────────┘                 

State_error Dominant_state_error Program_error