Skip to content

Conversation

VolodymyrBg
Copy link

This commit optimizes the implementation of arithmetic operations for SparsePolynomial
by eliminating unnecessary cloning in the following methods:

  • AddAssign<&'a Self>
  • AddAssign<(F, &'a Self)>
  • SubAssign<&'a Self>

Instead of using the inefficient approach of cloning the entire polynomials and then
performing operations on the clones, this implementation now uses a more efficient
single-pass algorithm similar to the one used in the Add implementation. This approach
avoids unnecessary memory allocations and copies, which should improve performance
especially for large polynomials.

Fixes TODOs in poly/src/polynomial/univariate/sparse.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant