TQOperator

Trait TQOperator 

Source
pub trait TQOperator: TQModule {
    // Required methods
    fn num_wires(&self) -> WiresEnum;
    fn num_params(&self) -> NParamsEnum;
    fn get_matrix(&self, params: Option<&[f64]>) -> Array2<CType>;
    fn apply(&mut self, qdev: &mut TQDevice, wires: &[usize]) -> Result<()>;
    fn apply_with_params(
        &mut self,
        qdev: &mut TQDevice,
        wires: &[usize],
        params: Option<&[f64]>,
    ) -> Result<()>;
    fn has_params(&self) -> bool;
    fn trainable(&self) -> bool;
    fn inverse(&self) -> bool;
    fn set_inverse(&mut self, inverse: bool);

    // Provided method
    fn get_eigvals(&self, _params: Option<&[f64]>) -> Option<Array1<CType>> { ... }
}
Expand description

Base quantum operator trait

Required Methods§

Source

fn num_wires(&self) -> WiresEnum

Number of wires this operator acts on

Source

fn num_params(&self) -> NParamsEnum

Number of parameters

Source

fn get_matrix(&self, params: Option<&[f64]>) -> Array2<CType>

Get the unitary matrix for given parameters

Source

fn apply(&mut self, qdev: &mut TQDevice, wires: &[usize]) -> Result<()>

Apply the operator to a quantum device

Source

fn apply_with_params( &mut self, qdev: &mut TQDevice, wires: &[usize], params: Option<&[f64]>, ) -> Result<()>

Apply with specific parameters

Source

fn has_params(&self) -> bool

Whether this operator has trainable parameters

Source

fn trainable(&self) -> bool

Whether parameters are trainable

Source

fn inverse(&self) -> bool

Get/set inverse flag

Source

fn set_inverse(&mut self, inverse: bool)

Provided Methods§

Source

fn get_eigvals(&self, _params: Option<&[f64]>) -> Option<Array1<CType>>

Get eigenvalues (if applicable)

Implementors§