[−][src]Struct quantum2::gate::Gate
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
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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,