Skip to content

Commit edca937

Browse files
authored
Unify all 'conditional' types (#832)
* Reorganise some code to improve readability * Move cholesky_hilbert to cholesky_util and rename Conditional -> LatentCond to prepare refactor * Update large chunks of Dense and Isotropic conditionals * Update blockdiag transitions * Conditionals are LatentCond's now (consistently) * Delete strategy.extrapolate_mean because it's the same for all strategies now * Remove a useless 'name' argument * Improve some docstrings * Delete commented-out code and revert tutorial to previous state
1 parent e4c08f2 commit edca937

11 files changed

Lines changed: 445 additions & 346 deletions

File tree

docs/examples_basic/conditioning_on_zero_residual.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def vector_field(y, t): # noqa: ARG001
5656
tcoeffs_like = [u0] * (NUM_DERIVATIVES + 1)
5757
ts = jnp.linspace(t0, t1, num=500, endpoint=True)
5858
init_raw, transitions, ssm = ivpsolvers.prior_wiener_integrated_discrete(
59-
ts, tcoeffs_like=tcoeffs_like, output_scale=100.0, ssm_fact="dense"
59+
ts, tcoeffs_like, output_scale=100.0, ssm_fact="dense"
6060
)
6161

6262
markov_seq_prior = stats.MarkovSeq(init_raw, transitions)

probdiffeq/backend/linalg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,9 @@ def diagonal(arr, /):
6767
return jnp.diagonal(arr)
6868

6969

70+
def diagonal_matrix(arr, /):
71+
return jnp.diag(arr)
72+
73+
7074
def triu(arr, /):
7175
return jnp.triu(arr)

probdiffeq/backend/tree_util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ def ravel_pytree(tree, /):
2828
return jax.flatten_util.ravel_pytree(tree)
2929

3030

31+
def tree_flatten(tree, /):
32+
return jax.tree_util.tree_flatten(tree)
33+
34+
3135
def register_dataclass(datacls):
3236
return jax.tree_util.register_dataclass(datacls)

0 commit comments

Comments
 (0)