Struct qdk_sim::QubitSized
source · [−]pub struct QubitSized<T> { /* private fields */ }
Expand description
Represents that a given type has a size that can be measured in terms
of a number of qubits (e.g.: State
).
Implementations
sourceimpl QubitSized<ProcessData>
impl QubitSized<ProcessData>
sourceimpl QubitSized<ProcessData>
impl QubitSized<ProcessData>
sourcepub fn new_pauli_channel<T: IntoPauliMixture>(data: T) -> Self
pub fn new_pauli_channel<T: IntoPauliMixture>(data: T) -> Self
Returns a new Pauli channel, given a mixture of Pauli operators.
sourcepub fn as_json(&self) -> String
pub fn as_json(&self) -> String
Returns a serialization of this quantum process as a JSON object.
sourcepub fn extend_one_to_n(&self, idx_qubit: usize, n_qubits: usize) -> Process
pub fn extend_one_to_n(&self, idx_qubit: usize, n_qubits: usize) -> Process
Returns a copy of this process that applies to registers of a given size.
sourceimpl QubitSized<StateData>
impl QubitSized<StateData>
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.
sourceimpl<T> QubitSized<T>
impl<T> QubitSized<T>
sourcepub fn get_n_qubits(&self) -> usize
pub fn get_n_qubits(&self) -> usize
Returns the number of qubits that this value relates to.
Trait Implementations
sourceimpl Add<&'_ QubitSized<ProcessData>> for &Process
impl Add<&'_ QubitSized<ProcessData>> for &Process
sourceimpl Add<&'_ QubitSized<ProcessData>> for Process
impl Add<&'_ QubitSized<ProcessData>> for Process
sourceimpl Add<QubitSized<ProcessData>> for &Process
impl Add<QubitSized<ProcessData>> for &Process
sourceimpl Add<QubitSized<ProcessData>> for Process
impl Add<QubitSized<ProcessData>> for Process
sourceimpl<T: Clone> Clone for QubitSized<T>
impl<T: Clone> Clone for QubitSized<T>
sourcefn clone(&self) -> QubitSized<T>
fn clone(&self) -> QubitSized<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug> Debug for QubitSized<T>
impl<T: Debug> Debug for QubitSized<T>
sourceimpl<'de, T> Deserialize<'de> for QubitSized<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for QubitSized<T> where
T: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Mul<&'_ QubitSized<ProcessData>> for C64
impl Mul<&'_ QubitSized<ProcessData>> for C64
sourceimpl Mul<&'_ QubitSized<ProcessData>> for f64
impl Mul<&'_ QubitSized<ProcessData>> for f64
sourceimpl Mul<&'_ QubitSized<ProcessData>> for &Process
impl Mul<&'_ QubitSized<ProcessData>> for &Process
sourceimpl Mul<&'_ QubitSized<ProcessData>> for Process
impl Mul<&'_ QubitSized<ProcessData>> for Process
sourceimpl Mul<QubitSized<ProcessData>> for C64
impl Mul<QubitSized<ProcessData>> for C64
sourceimpl Mul<QubitSized<ProcessData>> for f64
impl Mul<QubitSized<ProcessData>> for f64
sourceimpl Mul<QubitSized<ProcessData>> for &Process
impl Mul<QubitSized<ProcessData>> for &Process
sourceimpl Mul<QubitSized<ProcessData>> for Process
impl Mul<QubitSized<ProcessData>> for Process
Auto Trait Implementations
impl<T> RefUnwindSafe for QubitSized<T> where
T: RefUnwindSafe,
impl<T> Send for QubitSized<T> where
T: Send,
impl<T> Sync for QubitSized<T> where
T: Sync,
impl<T> Unpin for QubitSized<T> where
T: Unpin,
impl<T> UnwindSafe for QubitSized<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more