ADCS.helpers.cholesky_update module

In-tree rank-1 Cholesky update and downdate.

Replaces the external choldate package, which has no PyPI release, must be installed from git with --no-build-isolation, and therefore made the whole package impossible to pip install cleanly.

Convention (identical to choldate): R is upper triangular with

\[A = R^\top R\]

cholupdate(R, x) overwrites R in place with the factor of \(A + x x^\top\); choldowndate(R, x) with the factor of \(A - x x^\top\). Both use x as scratch space, so a copy is taken internally and the caller’s array is left untouched (choldate clobbers it).

The algorithm is the standard LINPACK sequence of Givens rotations: one rotation per row, each annihilating a component of x into the factor. It is \(O(n^2)\) and allocation-free.

One deliberate difference from choldate. On a downdate whose result is not positive definite, choldate neither raises nor returns NaN – it silently computes \(\sqrt{|r^2|}\) and returns a plausible-looking but wrong factor. This implementation writes NaN instead, which is what the SRUAKF’s existing np.any(np.isnan(...)) guard was already written to catch.

ADCS.helpers.cholesky_update.choldowndate(R, x)[source]

Rank-1 downdate: overwrite R with the factor of \(A - x x^\top\).

If the downdated matrix is not positive definite, R is filled with NaN.

Parameters:
  • R (numpy.ndarray) – Upper-triangular Cholesky factor, modified in place.

  • x (numpy.ndarray) – Downdate vector. Not modified (a working copy is taken).

Returns:

None

Return type:

None

ADCS.helpers.cholesky_update.cholupdate(R, x)[source]

Rank-1 update: overwrite R with the factor of \(A + x x^\top\).

Parameters:
  • R (numpy.ndarray) – Upper-triangular Cholesky factor, modified in place.

  • x (numpy.ndarray) – Update vector. Not modified (a working copy is taken).

Returns:

None

Return type:

None