Skip to content

fix: add missing x0/Pi0 goal fusion to PPHybridFilterLinear#75

Merged
iahncajigas merged 3 commits intomainfrom
fix/hybrid-filter-goal-fusion
Mar 23, 2026
Merged

fix: add missing x0/Pi0 goal fusion to PPHybridFilterLinear#75
iahncajigas merged 3 commits intomainfrom
fix/hybrid-filter-goal-fusion

Conversation

@iahncajigas
Copy link
Copy Markdown
Contributor

Summary

Adds the initial state fusion step (Srinivasan et al. Eq. 2.23) to PPHybridFilterLinear. This step fuses the initial state prior with the terminal constraint:

Pi0New = pinv(inv(Pi0) + inv(PitT[:,:,0]))
x0New  = Pi0New @ (inv(Pi0) @ x0 + inv(PitT) @ PhitT @ yT)

This was present in PPDecodeFilterLinear since the original 2013 implementation but was never added to the hybrid filter variants. Without it, the goal-directed hybrid filter starts from the raw prior without incorporating target information.

Mirrors MATLAB PR cajigaslab/nSTAT#27.

Test plan

  • All 254 tests pass locally
  • CI passes
  • Regenerated fig06 with improved tracking

🤖 Generated with Claude Code

Iahn Cajigas and others added 3 commits March 22, 2026 21:50
Adds the initial state fusion step (Srinivasan et al. Eq. 2.23)
that was present in PPDecodeFilterLinear but missing from the hybrid
filter since its original implementation:

    Pi0New = pinv(inv(Pi0) + inv(PitT[:,:,0]))
    x0New  = Pi0New @ (inv(Pi0) @ x0 + inv(PitT) @ PhitT @ yT)

This fuses the initial state prior with the terminal constraint,
giving the goal-directed filter a better starting point that
incorporates knowledge of where the trajectory must end.

Also regenerates fig06 with the corrected algorithm.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The goal-directed predict step in PPHybridFilterLinear should use
B[:,:,0] (initial modified dynamics) and QT[:,:,-1] (terminal modified
noise) at every time step, matching the original Srinivasan et al.
formulation and the MATLAB implementation.

The previous code used time-varying B[:,:,time_index] and
QT[:,:,time_index], which caused the goal-directed filter to
undershoot the target.

Mirrors MATLAB PR cajigaslab/nSTAT#29.

Also regenerates all example05 figures with corrected tracking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…l-fusion

# Conflicts:
#	docs/figures/example05/fig06_hybrid_decoding_summary.png
@iahncajigas iahncajigas merged commit 9fcde7f into main Mar 23, 2026
14 checks passed
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