[][src]Struct aces::Polynomial

pub struct Polynomial<T: Atomic> { /* fields omitted */ }

A formal polynomial.

Internally a Polynomial is represented as a vector of N Atomic identifiers, a vector of M monomial::Weights, and a boolean matrix with N columns and M rows. Vector of Atomic identifiers is sorted in strictly increasing order. It represents the set of nodes occuring in the polynomial and N is the number of such nodes.

M is the number of monomials in the canonical representation of the polynomial. The order in which monomials are listed is arbitrary, but same for rows of the boolean matrix and elements of the weight vector. An element in row i and column j of the matrix determines if a node in j-th position in the vector of identifiers occurs in i-th monomial.

Polynomials may be compared and added using traits from std::cmp and std::ops standard modules, with the obvious exception of std::cmp::Ord. Note however that, in general, preventing Context or Port mismatch between polynomials is the responsibility of the caller of an operation. Implementation detects some, but not all, cases of mismatch and panics if it does so.

Methods

impl Polynomial<LinkID>[src]

pub fn from_spec(
    ctx: ContextHandle,
    port: &Port,
    spec_poly: &[Vec<NonZeroUsize>]
) -> Self
[src]

Creates a polynomial from a sequence of vectors of node [ID]s and in a Context given by a ContextHandle.

impl<T: Atomic> Polynomial<T>[src]

pub fn new() -> Self[src]

Creates an empty polynomial, θ.

pub fn clear(&mut self)[src]

Resets this polynomial into θ.

pub fn atomic_multiply(&mut self, atomic: T)[src]

Multiplies this polynomial (all its monomials) by a single-element monomial.

pub fn add_atomics_sorted<I>(
    &mut self,
    atomics: I
) -> Result<bool, Box<dyn Error>> where
    I: IntoIterator<Item = T>, 
[src]

Adds a sequence of Atomic identifiers to this polynomial as another monomial.

On success, returns true if this polynomial changed or false if it didn't, due to idempotency of addition.

Returns error if ids aren't given in strictly increasing order, or in case of port mismatch, or if context mismatch was detected.

pub fn is_empty(&self) -> bool[src]

pub fn is_atomic(&self) -> bool[src]

pub fn is_monomial(&self) -> bool[src]

pub fn num_monomials(&self) -> usize[src]

Important traits for Monomials<'a, T>
pub fn get_monomials(&self) -> Monomials<T>[src]

pub fn get_atomics(&self) -> Iter<T>[src]

pub fn as_sat_clauses(&self, port_lit: Literal) -> Vec<Vec<Literal>>[src]

Constructs the firing rule of this polynomial, the logical constraint imposed on firing components, if the polynomial is attached to the node and face represented by port_lit. The rule is transformed into a CNF formula, a conjunction of disjunctions of sat::Literals (a sequence of clauses).

Returns a sequence of clauses in the form of vector of vectors of sat::Literals.

Trait Implementations

impl Contextual for Polynomial<LinkID>[src]

impl<T: Atomic> PartialOrd<Polynomial<T>> for Polynomial<T>[src]

#[must_use] fn lt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use] fn le(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use] fn gt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use] fn ge(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Atomic> PartialEq<Polynomial<T>> for Polynomial<T>[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl<T: Atomic> Eq for Polynomial<T>[src]

impl<T: Clone + Atomic> Clone for Polynomial<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug + Atomic> Debug for Polynomial<T>[src]

Auto Trait Implementations

impl<T> Send for Polynomial<T> where
    T: Send

impl<T> Unpin for Polynomial<T> where
    T: Unpin

impl<T> Sync for Polynomial<T> where
    T: Sync

impl<T> UnwindSafe for Polynomial<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Polynomial<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference where
    Inner: Part,
    Outer: Part<PartType = Field<OuterFieldType>>,
    OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,
    Reference: HasPart<Outer> + ?Sized