Skip to main content

ReversibleTrellis

Trait ReversibleTrellis 

Source
pub trait ReversibleTrellis<const DEGREE: usize>: Trellis<DEGREE> {
    // Provided method
    fn steps_out_of(
        &self,
        frame: Self::Frame<'_>,
        position: usize,
    ) -> [Step; DEGREE] { ... }
}
Expand description

A Trellis that can also be read backwards, as a forward-backward requires.

There is nothing to implement. The backward reading is derived from the forward one, so the two cannot disagree:

impl ReversibleTrellis<2> for Chain {}

Overriding it buys speed, since the derived reading asks steps_into once per advance where a written one answers in a single call. It is also the only way the two readings can come apart, and that matters more than it looks: posteriors over two different graphs does not fail, it returns numbers that look entirely reasonable and are wrong. An override is therefore a claim, and axioms::check is how that claim is checked.

Provided Methods§

Source

fn steps_out_of( &self, frame: Self::Frame<'_>, position: usize, ) -> [Step; DEGREE]

The DEGREE transitions leaving position, in the same order steps_into lists them.

A transition running past s_N is Step::ABSENT; unlike the forward direction the solver does bound the target, because it has to anyway.

The default is derive_steps_out_of. Override it only to make the backward pass faster, and put axioms::check in a test when you do.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A: Arc> ReversibleTrellis<4> for ChainTrellis<'_, A>
where A::Weight: FromScore,