qvnt 0.3.2

Advanced quantum computation simulator.
Documentation

QVNT

build rustc crates.io docs.rs

Advanced quantum computation simulator, written in Rust

Features

  1. Ability to simulate up to 64 qubits. Common machine with 4-16 Gb of RAM is able to simulate 26-28 qubits, which is enough for several study cases;
  2. Set of 1- or 2-qubits operations to build your own quantum circuits;
  3. Quantum operations are tested and debugged to be safe in use;
  4. Circuit execution is accelerated using multithreading Rayon library;
  5. Complex quantum registers manipulations: tensor product of two registers and aliases for qubit to simplify interaction with register.

Usage

use qvnt::prelude::*;

//  create quantum register, called 'x', with 10 qubits
let mut q_reg = QReg::new(10);
//  or with initial state, where 3 qubits are already in state |1>
let mut q_reg = QReg::new(10).init_state(0b0011100000);

//  get virtual register 'x', to interact with specified qubits
let x = q_reg.get_vreg();

//  create qft operation, acting on first 5 qubits in q_reg
let op = op::qft(x[0] | x[1] | x[2] | x[3] | x[4]);

//  apply operation
q_reg.apply(&op);

//  measure and write first 3 qubit, which leads to collapse of q_reg wave function
println!("{}", q_reg.measure_mask(x[0] | x[1] | x[2]));

Implemented operations

  • Pauli's X, Y & Z operators;
  • S & T operators;
  • Phase shift operator;
  • 1-qubit rotation operators;
  • 2-qubits rotation operators, aka Ising coupling gates;
  • SWAP, iSWAP operators and square rooted ones;
  • Quantum Fourier and Hadamard Transform;
  • Universal U1, U2 and U3 operators;

ALL operators have inverse versions, accessing by .dgr() method:

use qvnt::prelude::*;

let usual_op = op::s(0b1);
//  Inverse S operator
let inverse_op = op::s(0b1).dgr();

Also, ALL these operators could be turned into controlled ones, using .c(...) method:

use qvnt::prelude::*;

let usual_op = op::x(0b001);
//  NOT gate, controlled by 2 qubits, aka CCNOT gate, aka Toffoli gate
let controlled_op = op::x(0b001).c(0b110).unwrap();

Controlled operation has to be unwrapped, since it could be None if its mask overlaps with the mask of operator. For example, this code will panic:

use qvnt::prelude::*;
let _ = op::x(0b001).c(0b001).unwrap();

In work

  1. Implementing vectorized operations;
  2. Writing documentation for all modules;