| Crates.io | rqism |
| lib.rs | rqism |
| version | 0.4.1 |
| created_at | 2025-05-22 09:29:24.410689+00 |
| updated_at | 2025-07-30 14:19:54.518292+00 |
| description | A multi-backend quantum circuit simulator |
| homepage | |
| repository | https://codeberg.org/0x177/rqism |
| max_upload_size | |
| id | 1684945 |
| size | 196,975 |
The manifestation of a dream where you do not have to install multiple scientific libraries and deal with python dependency hell to implement a quantum algorithm.
| statevector | stabilizer | MPS | |
|---|---|---|---|
| single qubit gates | ✅ | ✅ | ✅ |
| multi qubti gates | ✅ | ✅ | ❌ |
| measurement | ✅ | ✅ | ✅ |
| conditional instructions | ✅ | ✅ | ✅ |
| optimization | ✅* | ✅* | ❌ |
| T1 amplitude damping | ✅ | ❓ | ✅ |
| noisey measurement | ✅ | ✅ | ✅ |
| depolarizing noise | ✅ | ✅ | ✅ |
| testing | ✅ | ✅ | ❌* |
✅: implemented
❌: not implemented
❓: as far as i know, this type of simulator is not supposed to do that
MPS limitations are due to a lack of resources
the only single-threaded stabilizer operation is random measurement (which is O(n^2)), single-threaded due to usage of unsafe raw pointers to work around the borrow checker. multi-threading is possible, but will require finding a more proper solution to mutation limitations
the statevector is sparse, parallelized, and implements some common gates as direct statevector modification, but it is still more suited for the gpu. however, i am not in the mood for compute shaders :) also, note that lazily evalutated kronecker products are a horrible idea (9 qubit QFT in 67 seconds instead of half a second)
bell state using both stabilizer and statevector:
use rqism::prelude::*;
fn main() {
let circuit = Circuit {
ins: vec![
Instruction::hadamard(0),
Instruction::cnot([0, 1]),
Instruction::MeasureState,
],
n: 2,
};
let machine = QuantumStateVector::new(2);
let counts = machine.get_counts(&circuit, 1000);
println!("State vecotr:");
counts.print_psi();
let machine = Stabilizer::new(2);
println!();
let counts = machine.get_counts(&circuit, 1000);
println!("Stabilizer:");
counts.print_psi();
}
output:

tested on my i7-7700HQ