[][src]Trait qmc::sse::qmc_traits::op_container::Op

pub trait Op: Clone + Debug {
    type Vars: FromIterator<usize> + AsRef<[usize]> + AsMut<[usize]> + Debug;
    type SubState: FromIterator<bool> + AsRef<[bool]> + AsMut<[bool]> + Debug;
    fn diagonal<A, B>(vars: A, bond: usize, state: B, constant: bool) -> Self
    where
        A: Into<Self::Vars>,
        B: Into<Self::SubState>
;
fn offdiagonal<A, B, C>(
        vars: A,
        bond: usize,
        inputs: B,
        outputs: C,
        constant: bool
    ) -> Self
    where
        A: Into<Self::Vars>,
        B: Into<Self::SubState>,
        C: Into<Self::SubState>
;
fn index_of_var(&self, var: usize) -> Option<usize>;
fn get_vars(&self) -> &[usize];
fn get_bond(&self) -> usize;
fn get_inputs(&self) -> &[bool];
fn get_outputs(&self) -> &[bool];
fn get_inputs_mut(&mut self) -> &mut [bool];
fn get_outputs_mut(&mut self) -> &mut [bool];
fn get_mut_inputs_and_outputs(&mut self) -> (&mut [bool], &mut [bool]);
fn clone_inputs(&self) -> Self::SubState;
fn clone_outputs(&self) -> Self::SubState;
fn is_constant(&self) -> bool; fn make_vars<V: Iterator<Item = usize>>(vars: V) -> Self::Vars { ... }
fn make_substate<S: Iterator<Item = bool>>(state: S) -> Self::SubState { ... }
fn is_diagonal(&self) -> bool { ... } }

Ops for holding SSE graph state.

Associated Types

type Vars: FromIterator<usize> + AsRef<[usize]> + AsMut<[usize]> + Debug

The list of op variables.

type SubState: FromIterator<bool> + AsRef<[bool]> + AsMut<[bool]> + Debug

The list of op input and output states.

Loading content...

Required methods

fn diagonal<A, B>(vars: A, bond: usize, state: B, constant: bool) -> Self where
    A: Into<Self::Vars>,
    B: Into<Self::SubState>, 

Make a diagonal op.

fn offdiagonal<A, B, C>(
    vars: A,
    bond: usize,
    inputs: B,
    outputs: C,
    constant: bool
) -> Self where
    A: Into<Self::Vars>,
    B: Into<Self::SubState>,
    C: Into<Self::SubState>, 

Make an offdiagonal op.

fn index_of_var(&self, var: usize) -> Option<usize>

Get the relative index of a variable.

fn get_vars(&self) -> &[usize]

Get the set of variables used for this op.

fn get_bond(&self) -> usize

Get the associated bond number for the op.

fn get_inputs(&self) -> &[bool]

Get the input state for the op.

fn get_outputs(&self) -> &[bool]

Get the output state for the op.

fn get_inputs_mut(&mut self) -> &mut [bool]

Get the input state for the op.

fn get_outputs_mut(&mut self) -> &mut [bool]

Get the output state for the op.

fn get_mut_inputs_and_outputs(&mut self) -> (&mut [bool], &mut [bool])

Get both the inputs and outputs for op.

fn clone_inputs(&self) -> Self::SubState

Get the input state for the op.

fn clone_outputs(&self) -> Self::SubState

Get the output state for the op.

fn is_constant(&self) -> bool

If the op is always a constant under any bit flip in input or output, then it can be used to mark the edges of clusters.

Loading content...

Provided methods

fn make_vars<V: Iterator<Item = usize>>(vars: V) -> Self::Vars

Make vars (this is here mostly due to rust bug 38078)

fn make_substate<S: Iterator<Item = bool>>(state: S) -> Self::SubState

Make substate (this is here mostly due to rust bug 38078)

fn is_diagonal(&self) -> bool

Check if the op is diagonal (makes no state changes).

Loading content...

Implementors

impl<Vars, SubState> Op for BasicOp<Vars, SubState> where
    Vars: FromIterator<usize> + AsRef<[usize]> + AsMut<[usize]> + Clone + Debug,
    SubState: FromIterator<bool> + AsRef<[bool]> + AsMut<[bool]> + Clone + Debug
[src]

type Vars = Vars

type SubState = SubState

Loading content...