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§
Sourcefn num_params(&self) -> NParamsEnum
fn num_params(&self) -> NParamsEnum
Number of parameters
Sourcefn get_matrix(&self, params: Option<&[f64]>) -> Array2<CType>
fn get_matrix(&self, params: Option<&[f64]>) -> Array2<CType>
Get the unitary matrix for given parameters
Sourcefn apply(&mut self, qdev: &mut TQDevice, wires: &[usize]) -> Result<()>
fn apply(&mut self, qdev: &mut TQDevice, wires: &[usize]) -> Result<()>
Apply the operator to a quantum device
Sourcefn apply_with_params(
&mut self,
qdev: &mut TQDevice,
wires: &[usize],
params: Option<&[f64]>,
) -> Result<()>
fn apply_with_params( &mut self, qdev: &mut TQDevice, wires: &[usize], params: Option<&[f64]>, ) -> Result<()>
Apply with specific parameters
Sourcefn has_params(&self) -> bool
fn has_params(&self) -> bool
Whether this operator has trainable parameters