Struct quantum::gate::Gate
[−]
[src]
pub struct Gate {
// some 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]
fn new(width: usize, matrix: Matrix) -> Gate
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.
fn width(&self) -> usize
Width of the gate.
fn matrix(&self) -> &Matrix
Representative matrix.
fn permute(&self, permutation: Vec<usize>) -> Gate
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
Derived Implementations
impl PartialEq for Gate[src]
fn eq(&self, __arg_0: &Gate) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Gate) -> bool
This method tests for !=.