Trait GateOp

Source
pub trait GateOp:
    Debug
    + Send
    + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn qubits(&self) -> Vec<QubitId>;
    fn matrix(&self) -> QuantRS2Result<Vec<Complex64>>;
    fn as_any(&self) -> &dyn Any;
    fn clone_gate(&self) -> Box<dyn GateOp>;

    // Provided methods
    fn num_qubits(&self) -> usize { ... }
    fn is_parameterized(&self) -> bool { ... }
}
Expand description

Trait for quantum gate operations

Required Methods§

Source

fn name(&self) -> &'static str

Returns the name of the gate

Source

fn qubits(&self) -> Vec<QubitId>

Returns the qubits that this gate acts on

Source

fn matrix(&self) -> QuantRS2Result<Vec<Complex64>>

Returns the matrix representation of this gate

Source

fn as_any(&self) -> &dyn Any

Downcast to concrete gate type

Source

fn clone_gate(&self) -> Box<dyn GateOp>

Clone the gate into a new boxed instance

Provided Methods§

Source

fn num_qubits(&self) -> usize

Returns the number of qubits this gate acts on

Source

fn is_parameterized(&self) -> bool

Returns true if this gate is parameterized

Trait Implementations§

Source§

impl Clone for Box<dyn GateOp>

Implement Clone for Box

Source§

fn clone(&self) -> Box<dyn GateOp>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§