Skip to main content

SpecializedGate

Trait SpecializedGate 

Source
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§

Source

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§

Source

fn can_fuse_with(&self, other: &dyn SpecializedGate) -> bool

Check if this gate can be fused with another gate

Source

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".

Implementors§