pub struct Monomial { /* private fields */ }Expand description
A monomial is a finite multiset of variables (each variable
optionally raised to a positive exponent). Stored as a sorted
map so equality and ordering are deterministic and serde is
stable.
The empty monomial represents 1.
Implementations§
Source§impl Monomial
impl Monomial
Sourcepub fn from_factors(
factors: impl IntoIterator<Item = (impl Into<String>, u32)>,
) -> Self
pub fn from_factors( factors: impl IntoIterator<Item = (impl Into<String>, u32)>, ) -> Self
Build from (variable, exponent) pairs. Exponents must be
strictly positive; pairs with exponent 0 are dropped.
Sourcepub fn factors(&self) -> &BTreeMap<String, u32>
pub fn factors(&self) -> &BTreeMap<String, u32>
Variables appearing in this monomial (with exponents).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Monomial
impl<'de> Deserialize<'de> for Monomial
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Monomial
impl Ord for Monomial
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Monomial
impl PartialOrd for Monomial
impl Eq for Monomial
impl StructuralPartialEq for Monomial
Auto Trait Implementations§
impl Freeze for Monomial
impl RefUnwindSafe for Monomial
impl Send for Monomial
impl Sync for Monomial
impl Unpin for Monomial
impl UnsafeUnpin for Monomial
impl UnwindSafe for Monomial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.