Skip to content

Commit

Permalink
poly: small refactor in SparseTerm partial_cmp (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Nov 14, 2024
1 parent 936f33a commit 3468974
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions poly/src/polynomial/multivariate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ impl PartialOrd for SparseTerm {
} else {
// Iterate through all variables and return the corresponding ordering
// if they differ in variable numbering or power
for (cur, other) in self.iter().zip(other.iter()) {
if other.0 == cur.0 {
if cur.1 != other.1 {
return Some((cur.1).cmp(&other.1));
for ((cur_variable, cur_power), (other_variable, other_power)) in
self.iter().zip(other.iter())
{
if other_variable == cur_variable {
if cur_power != other_power {
return Some(cur_power.cmp(other_power));
}
} else {
return Some((other.0).cmp(&cur.0));
return Some(other_variable.cmp(cur_variable));
}
}
Some(Ordering::Equal)
Expand Down

0 comments on commit 3468974

Please sign in to comment.