Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions poly/src/polynomial/multivariate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ impl Term for SparseTerm {

/// Returns whether `self` is a constant
fn is_constant(&self) -> bool {
self.is_empty() || self.degree() == 0
if self.is_empty() {
return true;
}
self.degree() == 0
}

/// Evaluates `self` at the given `point` in the field.
Expand Down Expand Up @@ -143,7 +146,9 @@ impl PartialOrd for SparseTerm {
/// ie. `x_1 > x_2`, `x_1^2 > x_1 * x_2`, etc.
#[allow(clippy::non_canonical_partial_ord_impl)]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
if self.degree() == other.degree() {
let sd = self.degree();
let od = other.degree();
if sd == od {
// Iterate through all variables and return the corresponding ordering
// if they differ in variable numbering or power
for ((cur_variable, cur_power), (other_variable, other_power)) in
Expand All @@ -159,7 +164,7 @@ impl PartialOrd for SparseTerm {
}
Some(Ordering::Equal)
} else {
Some(self.degree().cmp(&other.degree()))
Some(sd.cmp(&od))
}
}
}
Expand Down
Loading