[−][src]Struct aces::Polynomial
A formal polynomial.
Internally a Polynomial
is represented as a vector of N
Atomic
identifiers, a vector of M monomial::Weight
s, 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.
Polynomial
s 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]
ctx: ContextHandle,
port: &Port,
spec_poly: &[Vec<NonZeroUsize>]
) -> Self
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]
&mut self,
atomics: I
) -> Result<bool, Box<dyn Error>> where
I: IntoIterator<Item = T>,
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::Literal
s (a sequence of clauses).
Returns a sequence of clauses in the form of vector of vectors
of sat::Literal
s.
Trait Implementations
impl Contextual for Polynomial<LinkID>
[src]
impl<T: Atomic> PartialOrd<Polynomial<T>> for Polynomial<T>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.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) -> bool
1.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) -> bool
1.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) -> bool
1.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]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.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(&self) -> 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,
T: Send,
impl<T> Unpin for Polynomial<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for Polynomial<T> where
T: Sync,
T: Sync,
impl<T> UnwindSafe for Polynomial<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Polynomial<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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,
Inner: Part,
Outer: Part<PartType = Field<OuterFieldType>>,
OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,
Reference: HasPart<Outer> + ?Sized,
unsafe fn part_ptr(
ptr: *const <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::Ptr
ptr: *const <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::Ptr
unsafe fn part_ptr_mut(
ptr: *mut <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::PtrMut
ptr: *mut <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::PtrMut