[][src]Struct qip::qubit_chainer::SingleRegisterChain

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

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

Methods

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

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

Make a new SingleRegisterChain. Prefer to use chain.

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

Release the contained Register.

pub fn r(self) -> Register[src]

Release the contained Register.

pub fn split(
    self,
    indices: &[u64]
) -> Result<DoubleRegisterChain<'a, B>, CircuitError>
[src]

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

pub fn split_absolute(
    self,
    selected_indices: &[u64]
) -> Result<DoubleRegisterChain<'a, B>, CircuitError>
[src]

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

pub fn split_all(self) -> Result<VecRegisterChain<'a, B>, CircuitError>[src]

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

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

Apply a matrix operation to the contained Register.

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

Apply a sparse matrix operation to the contained Register.

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

Apply the X operation to the contained Register.

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

Apply the Y operation to the contained Register.

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

Apply the Z operation to the contained Register.

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

Apply a H to the contained Register.

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

Map the Register by the given function.

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

Map the Register by the given function, resulting in two Registers.

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

Map the Register by the given function, resulting in a vec of Registers.

Trait Implementations

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

impl<'a, B: UnitaryBuilder> Not for SingleRegisterChain<'a, B>[src]

type Output = SingleRegisterChain<'a, B>

The resulting type after applying the ! operator.

Auto Trait Implementations

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

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

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

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

impl<'a, B> !RefUnwindSafe for SingleRegisterChain<'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]