This is a quantum computer simulation research project. It's probably not accurate to a real quantum computer.
git clone https://github.com/noClaps/qcsim.git && cd qcsim
cargo runYou should start by initialising the quantum computer with a specified number of qubits:
use qcsim::Computer;
fn main() {
let qc = Computer::new(3);
}This will initialise them in the
After this, you can use array indexing to apply operations to the qubits in the computer, using the gates you have available:
pauli_xpauli_ypauli_zhadamardphasepi_by_8controlled_notcontrolled_zswaptoffoli
For example:
qc.hadamard(0);
qc.controlled_not(0, 1);
qc.toffoli(0, 1, 2);Once you're done, you can output the state of the system using measure:
println!("{}", qc.measure());This will return the measured state of the entire computer as a string, along with taking ownership of the computer instance so that no more operations can happen, since the state should only be measured at the very end.