Skip to content

Chenning-Tao/QRAM_simulator

Repository files navigation

How to run the project?

  1. Clone the repository
  2. Install the dependencies
  3. run the following command in the terminal
mkdir build
cd build
cmake ..
make
./QRAM_simulator

How to run it in python?

  1. run
pip install ./
  1. you can find the example usage in example.py

How to conduct you own test?

We have wrapped QRAM into a class, you can use it by including the header file and create an instance of the class. The following is an example of how to use it.

// we have two class: QRAM_base and QRAM_binary (QRAM_binary is the accelerated version)
// here is an example of how to use QRAM_base
QRAM_base qram_base(n, k, memory, address);

// first we need to create the circuit, call create_acc_matrix()
qram_base.create_acc_matrix();
// if we want to simulate noise, we need to call add_error()
qram_base.add_error(noise_list);
// then we can run the circuit, call run_baseline()
qram_base.run_baseline();
// if you want to print the result, call print_result()
qram_base.print_result(true);

// for QRAM_binary, the usage is the same, but we need to call run() instead of run_baseline()
QRAM_binary qram(n, k, memory, address);
qram.create_acc_matrix();
qram.add_error(noise_list);
qram.run();
qram.print_result(true);

n is the layer number, k is the data length.

memory is the classical memory(for QRAM to read).

address is the address of the data we want to read (you can see it as a superposition state)

noise_list is needed if you want to test noise on QRAM.

The definition is as follows:

Each noise is defined by a NoiseInfo struct.

NoiseInfo has 5 fields:

  1. process: the process that the noise is added to, we have 4 processes: ADDRESS_INPUT, DATA_INPUT, DATA_OUTPUT, ADDRESS_OUTPUT
  2. bit: it's defined by the process, for ADDRESS_INPUT and ADDRESS_OUTPUT, it's the address bit for DATA_INPUT and DATA_OUTPUT, it's the data bit (you can see in the figure as A1 or D1)
  3. operation: the operation that the noise is added to, we have 5 operations: ADDRESS_BUS, DATA_BUS_INPUT, DATA_BUS_OUTPUT, ROUTING_START, ROUTING_END, INTERNAL_SWAP, DATA_COPY
  4. layer: defined the layer of the operation. all the fields above are used to locate when will the noise happen (it will happen before the operation)
  5. bit_pos: defined the position of the noise in the circuit it has 3 fields: layer, shift, data_qubit layer: the layer of the qubit shift: the shift of the qubit in the layer (start from 0) data_qubit: 0 for address qubit, 1 for data qubit
  6. error_rate: define the probability of X, Y, Z error

The corresponding circuit is as follows: QRAM(4,3).png

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors