Skip to content

long-long-float/simple-qsim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-qsim

Rust

simple-qsim is a simple quantum circuit simulator written in Rust. It simulates quantum states with quantum gates with simple interface.

Features

  • Basic gates (X, H, CNOT, etc.)
  • Observable for Pauli operators (I, X, Y, Z)
  • Parametric gates for RX, RY, RZ
  • Transpiler to gate sets {H, T, T^-1} by Solovay-Kitaev algorithm (Thanks to sk)
    • Currently, only single-qubit gates are supported.

Installation

cargo add simple-qsim

Usage

use simple_qsim::{Circuit, QState};

let q00 = QState::from_str("00").unwrap();
let bell_state = Circuit::new(q00.num_of_qbits())
    .H(0)?
    .cnot(0, 1)?
    .apply(&q00)?;
println!("{}", bell_state);

/*
|00>: 0.7071067811865475+0i
|01>: 0+0i
|10>: 0+0i
|11>: 0.7071067811865475+0i
*/

You can see some examples in examples directory:

  • QCL Quantum Circuit learning
    • Train sin function with noise.
  • VQE Variational Quantum Eigensolver
    • Seek the ground state energy of H-He+ (helium hydride ion)

You can run examples by:

cargo run --example qcl

Test

cargo test

License

This project is licensed under the MIT License.

About

A simple quantum circuit simulator written in Rust

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published