Skip to content

feat(math): add numerical conditioning check for covariance matrices (#29) - #32

Merged
rahadbhuiya merged 1 commit into
mainfrom
feat/numerical-conditioning-check
Nov 14, 2026
Merged

rahadbhuiya merged 1 commit into
mainfrom
feat/numerical-conditioning-check

Conversation

@rahadbhuiya

Copy link
Copy Markdown
Member

Overview

Implements numerical conditioning checks for covariance matrices across Kalman filter variants to detect and prevent filter divergence and numerical instability in embedded/safety-critical navigation and state estimation contexts (#29).

Changes

  • Matrix Norms & Inversion: Added public free functions matrix_norm_1, matrix_norm_inf, matrix_norm_frobenius, matrix_condition_number, and check_matrix_conditioning. Replaced internal inverse with generalized public Gauss-Jordan invert_matrix with singularity epsilon checks.
  • Filter API Extensions: Added condition_number(), check_conditioning(), and is_well_conditioned() convenience methods to:
    • LinearKalmanFilter
    • ErrorStateKalmanFilter
    • UnscentedKalmanFilter2D
  • Configurable Precision Constants: Defined DEFAULT_MAX_CONDITION_NUMBER (1e12 for 64, 1e6 for 32) and precision-tuned singularity thresholds.
  • Integration Tests: Added comprehensive integration tests in ests/conditioning.rs covering Hilbert ill-conditioned matrices (H3, H4, H5), singular matrices, non-finite (NaN/Inf) rejection, asymmetry checks, and all filter method interfaces.

Closes #29

@github-actions github-actions Bot added enhancement New feature or request tests Test suites, coverage, and verification benchmarks labels Nov 14, 2026
@rahadbhuiya
rahadbhuiya force-pushed the feat/numerical-conditioning-check branch 3 times, most recently from 46d48d3 to 473f418 Compare November 14, 2026 04:52
…29)

- Implement 1-norm, infinity-norm, and Frobenius matrix norm calculations
- Add condition number computation and check_matrix_conditioning validator
- Implement condition_number(), check_conditioning(), and is_well_conditioned()
  methods for LinearKalmanFilter, ErrorStateKalmanFilter, and UnscentedKalmanFilter2D
- Expose DEFAULT_MAX_CONDITION_NUMBER constant tuned for f32 and f64 precisions
- Add comprehensive integration test suite verifying well-conditioned, ill-conditioned,
  Hilbert, singular, and non-finite matrix behaviors

Closes #29
@rahadbhuiya
rahadbhuiya force-pushed the feat/numerical-conditioning-check branch from 473f418 to 3bdd2ac Compare November 14, 2026 04:53
@rahadbhuiya rahadbhuiya self-assigned this Nov 14, 2026
@rahadbhuiya
rahadbhuiya merged commit fcf7e9a into main Nov 14, 2026
2 checks passed
@rahadbhuiya
rahadbhuiya deleted the feat/numerical-conditioning-check branch November 14, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests Test suites, coverage, and verification benchmarks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(math): add numerical conditioning check for covariance matrices

1 participant