Skip to content

feat(math): Update piecewise_linear to take span rather than vector#667

Merged
finger563 merged 2 commits into
mainfrom
feat/fast-math-piecewise-linear-span
Jul 15, 2026
Merged

feat(math): Update piecewise_linear to take span rather than vector#667
finger563 merged 2 commits into
mainfrom
feat/fast-math-piecewise-linear-span

Conversation

@finger563

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 15, 2026 14:00
@github-actions

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

@finger563 finger563 merged commit 57382ef into main Jul 15, 2026
4 of 5 checks passed
@finger563 finger563 deleted the feat/fast-math-piecewise-linear-span branch July 15, 2026 14:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Updates piecewise_linear to accept a std::span of point pairs instead of owning a std::vector, improving API flexibility and enabling use with fixed-size containers.

Changes:

  • Changed piecewise_linear parameter type from std::vector<...>& to std::span<const ...>.
  • Simplified boundary checks using front()/back() and streamlined interpolation variables via structured bindings.
  • Updated the math example to use std::array for one of the point tables.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
components/math/include/fast_math.hpp Switches piecewise_linear to std::span and refactors interpolation/bounds logic accordingly.
components/math/example/main/math_example.cpp Updates one lookup table container to std::array to better align with the new std::span API.

[[maybe_unused]] static float piecewise_linear(const std::vector<std::pair<float, float>> &points,
[[maybe_unused]] static float piecewise_linear(std::span<const std::pair<float, float>> points,
float x) {
if (points.size() == 0) {
Comment thread components/math/example/main/math_example.cpp Outdated
Comment thread components/math/example/main/math_example.cpp
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.

2 participants