Gate

Trait Gate 

Source
pub trait Gate: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn compute(&self, angles: &[f64]) -> DataTensor;

    // Provided method
    fn adjoint(&self, angles: &[f64]) -> DataTensor { ... }
}
Expand description

A quantum gate.

Required Methods§

Source

fn name(&self) -> &str

Returns the name of the gate.

Source

fn compute(&self, angles: &[f64]) -> DataTensor

Computes the gate matrix with the given angles.

Provided Methods§

Source

fn adjoint(&self, angles: &[f64]) -> DataTensor

Computes the adjoint of the gate matrix with the given angles. If not overridden, this computes the conjugate transpose of the gate matrix.

Trait Implementations§

Source§

impl Borrow<str> for Box<dyn Gate>

This allows us to use a &str as a key in a HashSet of gates.

Source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
Source§

impl Hash for dyn Gate

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
Source§

impl PartialEq for dyn Gate

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for dyn Gate

Implementors§