[][src]Trait dqcsim::common::converter::MatrixConverter

pub trait MatrixConverter {
    type Parameters;
    fn detect_matrix(
        &self,
        matrix: &Matrix,
        epsilon: f64,
        ignore_global_phase: bool
    ) -> Result<Option<Self::Parameters>>;
fn construct_matrix(&self, parameters: &Self::Parameters) -> Result<Matrix>; }

A type that represents a possibly parameterized matrix form, allowing conversion between the parameters and the complete matrix.

Converter<(Matrix, f64, bool), Self::Parameters> is automatically implemented for types with this trait.

Associated Types

type Parameters

For parameterized matrices, this is the type of the parameters needed for construction/returned by detection. FromArb and ToArb must typically be defined for it

Loading content...

Required methods

fn detect_matrix(
    &self,
    matrix: &Matrix,
    epsilon: f64,
    ignore_global_phase: bool
) -> Result<Option<Self::Parameters>>

Detects whether the given matrix has a recognized form and returns the parameters that can be used to reconstruct it, within the given error margin, and optionally ignoring differences in global phase.

fn construct_matrix(&self, parameters: &Self::Parameters) -> Result<Matrix>

Constructs a matrix from the given parameter set.

Loading content...

Implementors

impl MatrixConverter for FixedMatrixConverter[src]

type Parameters = ()

impl MatrixConverter for PhaseKMatrixConverter[src]

type Parameters = u64

impl MatrixConverter for PhaseMatrixConverter[src]

type Parameters = f64

impl MatrixConverter for RMatrixConverter[src]

type Parameters = (f64, f64, f64)

impl MatrixConverter for RxMatrixConverter[src]

type Parameters = f64

impl MatrixConverter for RyMatrixConverter[src]

type Parameters = f64

impl MatrixConverter for RzMatrixConverter[src]

type Parameters = f64

impl MatrixConverter for UMatrixConverter[src]

type Parameters = Matrix

Loading content...