[][src]Struct quantum2::gate::Gate

pub struct Gate { /* fields omitted */ }

Represents a quantum gate: a quantum regster transformation.

This gate is tagged with a width, and contains a unitary matrix representing the numerical transformation in the computational basis.

This gate may be applied to a ket to update the ket's state.

Currently we do not check whether the matrix is unitary.

See Wikipedia for more information.

Methods

impl Gate[src]

pub fn new(width: usize, matrix: Matrix) -> Gate[src]

Construct a new quantum gate, given width and computational basis matrix.

Currently we do not check whether the matrix is unitary.

Panics

We panic if the supplied matrix is non-square or not of dimension width.

pub fn width(&self) -> usize[src]

Width of the gate.

pub fn matrix(&self) -> &Matrix[src]

Representative matrix.

pub fn permute(&self, permutation: Vec<usize>) -> Gate[src]

Permute the qubits on which we act.

Qubit i will be acted on as qubit permutation[i] was before.

TODO: The consumer has to work out the (complicated) matrix permutation. We ought to be able to compute this ourselves from a qubit permutation.

Panics

We panic if set(permutation) != {0, ..., self.size - 1}.

Trait Implementations

impl PartialEq<Gate> for Gate[src]

impl Debug for Gate[src]

Auto Trait Implementations

impl Send for Gate

impl Sync for Gate

impl Unpin for Gate

impl UnwindSafe for Gate

impl RefUnwindSafe for Gate

Blanket Implementations

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

impl<T> From<T> for 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> Borrow<T> for T where
    T: ?Sized
[src]

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

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