You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ProbNum we use full-rank Cholesky updates (see the utility function probnum.statespace.cholesky_update) for square-root forward transitions.
Do you want the utility functions in here? For starters, we could merge the code (https://github.com/probabilistic-numerics/probnum/blob/master/src/probnum/filtsmooth/statespace/discrete_transition_utils.py)
defcholesky_update(
S1: np.ndarray, S2: typing.Optional[np.ndarray] =None
) ->np.ndarray:
r"""Compute Cholesky update/factorization :math:`C C^\top = S_1 S_1^\top + S_2 S_2^\top`. This can be used in various ways. For example, :math:`S_1` and :math:`S_2` do not need to be Cholesky factors; any matrix square-root is sufficient. As long as :math:`C C^\top = S_1 S_1^\top + S_2 S_2^\top` is well-defined (and admits a Cholesky-decomposition), :math:`S_1` and :math:`S_2` do not even have to be square. """# doc might need a bit more explanation in the future# perhaps some doctest or so?ifS2isnotNone:
stacked_up=np.vstack((S1.T, S2.T))
else:
stacked_up=np.vstack(S1.T)
upper_sqrtm=np.linalg.qr(stacked_up, mode="r")
returntriu_to_positive_tril(upper_sqrtm)
deftriu_to_positive_tril(triu_mat: np.ndarray) ->np.ndarray:
r"""Change an upper triangular matrix into a valid lower Cholesky factor. Transpose, and change the sign of the diagonals to '+' if necessary. The name of the function is leaned on `np.triu` and `np.tril`. """tril_mat=triu_mat.Td=np.sign(np.diag(tril_mat))
d[d==0] =1.0with_pos_diag=tril_mat @ np.diag(d)
returnwith_pos_diag
with its respective tests (subject to interface changes to remain compliant with your current implementation of rank-1 updates) as soon as ProbNum has an explicit dependency on cholupdates anyway.
This could then be used inside random_variables as well as inside statespace, and optimisation of this functionality can be outsourced to optimising cholupdates.
Note that the cholesky_update function above already handles your Issue #13 in a basic way (more optimized code seems possible, but can be a future project?!).
The text was updated successfully, but these errors were encountered:
In
ProbNum
we use full-rank Cholesky updates (see the utility functionprobnum.statespace.cholesky_update
) for square-root forward transitions.Do you want the utility functions in here? For starters, we could merge the code (
https://github.com/probabilistic-numerics/probnum/blob/master/src/probnum/filtsmooth/statespace/discrete_transition_utils.py
)with its respective tests (subject to interface changes to remain compliant with your current implementation of rank-1 updates) as soon as
ProbNum
has an explicit dependency oncholupdates
anyway.This could then be used inside
random_variables
as well as insidestatespace
, and optimisation of this functionality can be outsourced to optimisingcholupdates
.Note that the
cholesky_update
function above already handles your Issue #13 in a basic way (more optimized code seems possible, but can be a future project?!).The text was updated successfully, but these errors were encountered: