[−][src]Struct ascesis::Polynomial
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.
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_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]
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,
Creates a polynomial from a sequence of sequences of
NodeID
s and in a Context
given by a ContextHandle
.
impl<T> Polynomial<T> where
T: Atomic + Debug,
[src]
T: Atomic + Debug,
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]
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 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]
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::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<T> Clone for Polynomial<T> where
T: Atomic + Clone + Debug,
[src]
T: Atomic + Clone + Debug,
fn clone(&self) -> Polynomial<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Contextual for Polynomial<LinkID>
[src]
fn format(&self, ctx: &Arc<Mutex<Context>>) -> Result<String, AcesError>
[src]
fn with(&self, ctx: &Arc<Mutex<Context>>) -> InContext<Self>
[src]
fn with_mut(&mut self, ctx: &Arc<Mutex<Context>>) -> InContextMut<Self>
[src]
impl<T> Debug for Polynomial<T> where
T: Atomic + Debug,
[src]
T: Atomic + Debug,
impl<T> Eq for Polynomial<T> where
T: Atomic + Debug,
[src]
T: Atomic + Debug,
impl<T> PartialEq<Polynomial<T>> for Polynomial<T> where
T: Atomic + Debug,
[src]
T: Atomic + Debug,
fn eq(&self, other: &Polynomial<T>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> PartialOrd<Polynomial<T>> for Polynomial<T> where
T: Atomic + Debug,
[src]
T: Atomic + Debug,
Auto Trait Implementations
impl<T> RefUnwindSafe for Polynomial<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Polynomial<T> where
T: Send,
T: Send,
impl<T> Sync for Polynomial<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Polynomial<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Polynomial<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Contextual for T where
T: ExclusivelyContextual,
[src]
T: ExclusivelyContextual,
fn format(&self, ctx: &Arc<Mutex<Context>>) -> Result<String, AcesError>
[src]
fn with(&self, ctx: &Arc<Mutex<Context>>) -> InContext<Self>
[src]
fn with_mut(&mut self, ctx: &Arc<Mutex<Context>>) -> InContextMut<Self>
[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,
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
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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, 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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,