Skip to content

Refactor#26

Merged
sukeya merged 41 commits into
mainfrom
sukeya/feat/refactor
May 17, 2026
Merged

Refactor#26
sukeya merged 41 commits into
mainfrom
sukeya/feat/refactor

Conversation

@sukeya

@sukeya sukeya commented May 17, 2026

Copy link
Copy Markdown
Owner

Overview

This PR refactors the MVPolynomial implementation and public API to make its internal invariants easier to preserve. In particular, it makes zero-coefficient handling and the representation of the zero polynomial consistent, so operations such as arithmetic, evaluation, integration, and composition behave more predictably.

Previously, MVPolynomial exposed a relatively map-like interface, which left more room for callers to break canonical zero-polynomial form or bypass index validation. This PR moves more of that responsibility into the class itself, clarifies the intended usage, and also revisits evaluation logic and allocator propagation.

Main changes

  • The MVPolynomial API is streamlined around get, try_get, and set instead of exposing a broader set of direct map-style mutations.
  • Normalization is unified across construction, assignment, and arithmetic so zero-coefficient terms are removed automatically and the zero polynomial stays in a canonical single-term form.
  • Index-related validation is made more consistent, including rejection of negative degrees and tighter axis checks.
  • The implementations of point evaluation operator()(coord_type) and polynomial composition operator()(MVPolynomial, axis) are cleaned up, and allocator propagation is preserved for internal temporary storage.
  • Scalar binary operations and division-by-zero behavior are clarified and reinforced.
  • The README is rewritten around concrete examples so the public API is easier to understand.
  • The test suite is expanded significantly, including randomized tests, to cover normalization, evaluation, composition, integration, scalar operations, and allocator propagation regressions.
  • clang-format, pre-commit, and workflow settings are updated to keep formatting and validation aligned in development.

@sukeya
sukeya marked this pull request as ready for review May 17, 2026 22:54
@sukeya
sukeya merged commit 67e790a into main May 17, 2026
4 checks passed
@sukeya
sukeya deleted the sukeya/feat/refactor branch May 17, 2026 22:55
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