pub trait SpecializedGate: GateOp {
// Required method
fn apply_specialized(
&self,
state: &mut [Complex64],
n_qubits: usize,
parallel: bool,
) -> QuantRS2Result<()>;
// Provided methods
fn can_fuse_with(&self, other: &dyn SpecializedGate) -> bool { ... }
fn fuse_with(
&self,
other: &dyn SpecializedGate,
) -> Option<Box<dyn SpecializedGate>> { ... }
}Expand description
Trait for specialized gate implementations
Required Methods§
Sourcefn apply_specialized(
&self,
state: &mut [Complex64],
n_qubits: usize,
parallel: bool,
) -> QuantRS2Result<()>
fn apply_specialized( &self, state: &mut [Complex64], n_qubits: usize, parallel: bool, ) -> QuantRS2Result<()>
Apply the gate directly to a state vector (optimized implementation)
Provided Methods§
Sourcefn can_fuse_with(&self, other: &dyn SpecializedGate) -> bool
fn can_fuse_with(&self, other: &dyn SpecializedGate) -> bool
Check if this gate can be fused with another gate
Sourcefn fuse_with(
&self,
other: &dyn SpecializedGate,
) -> Option<Box<dyn SpecializedGate>>
fn fuse_with( &self, other: &dyn SpecializedGate, ) -> Option<Box<dyn SpecializedGate>>
Fuse this gate with another gate if possible
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".