Repository navigation
refactor(unscented): use idiomatic iterators for sigma point propagation and weighted sum - #20
Merged
rahadbhuiya merged 1 commit intoOct 25, 2026
Conversation
Replace the manual 'for i in 0..5' index loops in UnscentedKalmanFilter2D::predict and ::update with .iter().zip()/.fold() over the fixed-size sigma point arrays, as requested in Exploidus#19. Behavior is unchanged: summation order is kept identical, so a new characterization test (test_ukf_predict_update_characterization) pins the exact numeric output of a predict+update pair and passes bit-for-bit. No heap allocation is introduced (slice iterators over stack arrays only), so no_std and the thumbv7em bare-metal build stay green. Verified: cargo fmt --check, cargo clippy --all-targets --all-features -D warnings, cargo test --all-features, and cargo check --no-default-features --target thumbv7em-none-eabihf all pass.
Contributor
Author
|
Picking this one up in #20. The |
Member
|
Reviewed the changes. The zero-allocation iterator pipelines (.zip() / .fold()) are very clean and idiomatic, and the 1e-12 characterization test gives great regression confidence. LGTM! Verified across bare-metal targets. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey Rahad, picking up #19. I converted the manual
for i in 0..5loops inUnscentedKalmanFilter2D::predictand::updateto.iter().zip()and.fold(), over the fixed-size sigma point arrays.What changed
Why it is safe
no_stdstill holds.test_ukf_predict_update_characterizationpins the exact output of a predict + update pair to 1e-12 and passes bit-for-bit on the refactor.generate_sigma_pointsis untouched. Issue refactor(unscented): use idiomatic iterator zip for sigma point propagation and weighted sum #19 scopes the work topredictandupdate.Verification
All four pass on my machine:
Let it run on CI and I'll take any follow-ups. Thanks.