[][src]Struct ascesis::Polynomial

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

A formal polynomial.

Internally a Polynomial is represented as a vector of N Atomic identifiers 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. 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_nodes_in_context<'a, I>(
    ctx: &Arc<Mutex<Context>>,
    face: Face,
    node_id: NodeID,
    poly_ids: I
) -> Polynomial<LinkID> where
    I: IntoIterator + 'a,
    <I as IntoIterator>::Item: IntoIterator,
    <<I as IntoIterator>::Item as IntoIterator>::Item == &'a NodeID
[src]

Creates a polynomial from a sequence of sequences of NodeIDs and in a Context given by a ContextHandle.

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

pub fn new() -> Polynomial<T>[src]

Creates an empty polynomial, θ.

pub fn new_docked(dock: Face) -> Polynomial<T>[src]

Creates an empty polynomial, θ, docked at a given Face.

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, AcesError> 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 atomics 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]

Creates a Monomials iterator.

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

pub fn as_sat_clauses(&self, port_lit: Literal) -> Vec<Clause>[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<T> Clone for Polynomial<T> where
    T: Atomic + Clone + Debug
[src]

impl Contextual for Polynomial<LinkID>[src]

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

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

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

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

impl<T> Contextual for T where
    T: ExclusivelyContextual
[src]

impl<T> From<T> for T[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

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

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,