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§
Sourcefn compute(&self, angles: &[f64]) -> DataTensor
fn compute(&self, angles: &[f64]) -> DataTensor
Computes the gate matrix with the given angles.
Provided Methods§
Sourcefn adjoint(&self, angles: &[f64]) -> DataTensor
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.
impl Borrow<str> for Box<dyn Gate>
This allows us to use a &str as a key in a HashSet of gates.