Type Definition qdk_sim::State

source · []
pub type State = QubitSized<StateData>;
Expand description

The state of a quantum system.

Implementations

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}$.

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$.

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}$.

Returns a serialization of this quantum state as a JSON object.

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());

Returns a copy of this state, represented as a mixed state.

If the given state can be represented by a stabilizer tableau, returns that tableau.

Trait Implementations

Formats the value using the given formatter. Read more

The type returned by the trace.

The trace (typically, the sum of the eigenvalues, or the sum of the diagonal elements $\sum_i A_{ii}$). Read more