pub type State = QubitSized<StateData>;Expand description
The state of a quantum system.
Aliased Type§
pub struct State { /* private fields */ }Implementations§
Source§impl State
impl State
Sourcepub fn new_mixed(n_qubits: usize) -> State
pub fn new_mixed(n_qubits: usize) -> State
Returns a new mixed state on a given number of qubits. By convention, new mixed states start off in the “all-zeros” state, $\rho = \ket{00\cdots 0}\bra{00\cdots 0}$.
Sourcepub fn new_stabilizer(n_qubits: usize) -> State
pub fn new_stabilizer(n_qubits: usize) -> State
Returns a new stabilizer state on a given number of qubits. By convention, new stabilizer states start off in the “all-zeros” state, $\left\langle Z_0, Z_1, \dots, Z_{n - 1} \right\rangle$.
Sourcepub fn new_pure(n_qubits: usize) -> State
pub fn new_pure(n_qubits: usize) -> State
Returns a new pure state on a given number of qubits. By convention, new pure states start off in the “all-zeros” state, $\ket{\psi} = \ket{00\cdots 0}$.
Sourcepub fn as_json(&self) -> String
pub fn as_json(&self) -> String
Returns a serialization of this quantum state as a JSON object.
Sourcepub fn extend(&self, n_qubits: usize) -> State
pub fn extend(&self, n_qubits: usize) -> State
Extends this state to be a state on n_qubits additional qubits.
New qubits are added “to the right,” e.g.: $\left|\psi\right\rangle$
is extended to $\left|\psi 0\right\rangle$.
§Example
let rho = State::new_mixed(2);
assert_eq!(5, rho.extend(3).get_n_qubits());Sourcepub fn get_tableau(&self) -> Option<&Tableau>
pub fn get_tableau(&self) -> Option<&Tableau>
If the given state can be represented by a stabilizer tableau, returns that tableau.