[][src]Struct qip::qubit_chainer::SingleQubitChain

pub struct SingleQubitChain<'a, B: UnitaryBuilder> { /* fields omitted */ }

Chaining struct for a single qubit (which may have multiple indices)

Methods

impl<'a, B: UnitaryBuilder> SingleQubitChain<'a, B>[src]

pub fn new(builder: &'a mut B, q: Qubit) -> Self[src]

Make a new SingleQubitChain. Prefer to use chain.

pub fn release(self) -> Qubit[src]

Release the contained qubit.

pub fn q(self) -> Qubit[src]

Release the contained qubit.

pub fn split(
    self,
    indices: Vec<u64>
) -> Result<DoubleQubitChain<'a, B>, &'static str>
[src]

Split the qubit, select the given indices and transfer them to a new qubit, leave the remaining indices in another qubit. This uses the relative indices (0 refers to whatever the first index of the contained qubit is).

pub fn split_absolute(
    self,
    selected_indices: Vec<u64>
) -> Result<DoubleQubitChain<'a, B>, &'static str>
[src]

Split the qubit, select the given indices and transfer them to a new qubit, leave the remaining indices in another qubit. This uses the absolute indices (0 refers to the 0th absolute index, even if it isn't in the contained qubit, throwing an error).

pub fn split_all(self) -> Result<VecQubitChain<'a, B>, &'static str>[src]

Split each contained index into its own qubit object, returns a chaining struct for the vec of resulting qubits.

pub fn apply_mat(
    self,
    name: &str,
    mat: Vec<Complex<f64>>
) -> Result<Self, &'static str>
[src]

Apply a matrix operation to the contained qubit.

pub fn apply_sparse_mat(
    self,
    name: &str,
    mat: Vec<Vec<(u64, Complex<f64>)>>,
    natural_order: bool
) -> Result<Self, &'static str>
[src]

Apply a sparse matrix operation to the contained qubit.

pub fn not(self) -> Self[src]

Apply the NOT operation to the contained qubit.

pub fn x(self) -> Self[src]

Apply the X operation to the contained qubit.

pub fn y(self) -> Self[src]

Apply the Y operation to the contained qubit.

pub fn z(self) -> Self[src]

Apply the Z operation to the contained qubit.

pub fn hadamard(self) -> Self[src]

Apply a H to the contained qubit.

pub fn apply(self, f: impl FnOnce(&mut B, Qubit) -> Qubit) -> Self[src]

Map the qubit by the given function.

pub fn apply_cut(
    self,
    f: impl FnOnce(&mut B, Qubit) -> (Qubit, Qubit)
) -> DoubleQubitChain<'a, B>
[src]

Map the qubit by the given function, resulting in two qubits.

pub fn apply_split(
    self,
    f: impl FnOnce(&mut B, Qubit) -> Vec<Qubit>
) -> VecQubitChain<'a, B>
[src]

Map the qubit by the given function, resulting in a vec of qubits.

Trait Implementations

impl<'a, B: Debug + UnitaryBuilder> Debug for SingleQubitChain<'a, B>[src]

Auto Trait Implementations

impl<'a, B> !Sync for SingleQubitChain<'a, B>

impl<'a, B> !Send for SingleQubitChain<'a, B>

impl<'a, B> Unpin for SingleQubitChain<'a, B>

impl<'a, B> !RefUnwindSafe for SingleQubitChain<'a, B>

impl<'a, B> !UnwindSafe for SingleQubitChain<'a, B>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]