Expand description
Qubit struct used for simulation and complex number struct that composes it.
In this library, qubits are represented by vectors of complex numbers, and gates are defined as structs that change vectors of complex numbers. “gates” has basic 1-bit operators such as H, Z, Y, and Z, 2-bit operators such as CX, and a struct that uses them all as one operator.
§Example usage
use Qit::{circuits::wrapping_qadd_const, core::{Qubits, Applicable}};
let q_in = Qubits::from_num(3, 4);
// q_in = |0100⟩
let add = wrapping_qadd_const(&vec![0, 1, 2], 3);
// add * |b⟩ = |b + 3⟩
let q_out = add.apply(q_in);
q_out.print_cmps();
// |000⟩ : +0.000 +0.000i
// |001⟩ : +0.000 +0.000i
// |010⟩ : +0.000 +0.000i
// |011⟩ : +0.000 +0.000i
// |100⟩ : +0.000 +0.000i
// |101⟩ : +0.000 +0.000i
// |110⟩ : +0.000 +0.000i
// |111⟩ : +1.000 +0.000i
Modules§
- mod_
funcs - Utility functions used within circuits
Structs§
- BitSlide
Index - struct used internally when applying gates
- Comp
- Complex numbers implemented with functions required for quantum simulation It is implemented with the only purpose of expressing quantum bits.
- Qubits
- struct representing a collection of pseudo-qubits.
Traits§
- Applicable
- Minimum traits that gates that manipulate qubits must satisfy
- Inversible
- Trait that implements make gates inversed
- Operator
- A trait that combines the Applicable and Inversible traits.
Functions§
- pop_
from_ probs - Obtain the observed bit string from the probability distribution extracted from the measure function