Skip to content

Commit

Permalink
Added the Single-seed paper to docs and _autocitation and removed two…
Browse files Browse the repository at this point in the history
… pyright: ignore comments
  • Loading branch information
andyElking committed May 22, 2024
1 parent f08b2f5 commit 6368de8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
36 changes: 27 additions & 9 deletions diffrax/_autocitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from ._adjoint import BacksolveAdjoint, DirectAdjoint, RecursiveCheckpointAdjoint
from ._brownian import AbstractBrownianPath, VirtualBrownianTree
from ._custom_types import BrownianIncrement
from ._heuristics import is_cde, is_sde
from ._integrate import diffeqsolve
from ._misc import adjoint_rms_seminorm
Expand Down Expand Up @@ -347,7 +348,7 @@ def _virtual_brownian_tree(terms):
is_vbt = lambda x: isinstance(x, VirtualBrownianTree)
leaves = jtu.tree_leaves(terms, is_leaf=is_vbt)
if any(is_vbt(leaf) for leaf in leaves):
vbt_ref, _ = _parse_reference_multi(VirtualBrownianTree)
vbt_ref, _, _ = _parse_reference_multi(VirtualBrownianTree)
return (
r"""
% You are simulating Brownian motion using a virtual Brownian tree, which was introduced
Expand All @@ -359,17 +360,34 @@ def _virtual_brownian_tree(terms):

@citation_rules.append
def _space_time_levy_area(terms):
has_levy_area = lambda x: isinstance(x, AbstractBrownianPath) and x.levy_area != ""
has_levy_area = (
lambda x: isinstance(x, AbstractBrownianPath)
and x.levy_area != BrownianIncrement
)
leaves = jtu.tree_leaves(terms, is_leaf=has_levy_area)
if any(has_levy_area(leaf) for leaf in leaves):
_, levy_area_ref = _parse_reference_multi(VirtualBrownianTree)
return (
r"""
% You are simulating Brownian motion using space-time Levy area, the formulae for which
% were developed in:
return r"""
% You are simulating Brownian motion using Levy area, the formulae for which
% are due to:
@misc{jelinčič2024singleseed,
title={Single-seed generation of Brownian paths and integrals
for adaptive and high order SDE solvers},
author={Andraž Jelinčič and James Foster and Patrick Kidger},
year={2024},
eprint={2405.06464},
archivePrefix={arXiv},
primaryClass={math.NA}
}
% and Theorem 6.1.6 of
@phdthesis{foster2020a,
publisher = {University of Oxford},
school = {University of Oxford},
title = {Numerical approximations for stochastic differential equations},
author = {Foster, James M.},
year = {2020}
}
"""
+ levy_area_ref
)


@citation_rules.append
Expand Down
21 changes: 14 additions & 7 deletions diffrax/_brownian/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,21 @@ class VirtualBrownianTree(AbstractBrownianPath):
```
The implementation here is an improvement on the above, in that it additionally
simulates space-time and space-time-time Levy areas. This is due to the paper
simulates space-time and space-time-time Levy areas, and exactly matches the
distribution of the Brownian motion and its Levy areas at all query times.
This is due to the paper
"Single-seed generation of Brownian paths and integrals
for adaptive and high order SDE solvers"
TODO: add the paper bitex
```bibtex
@misc{jelinčič2024singleseed,
title={Single-seed generation of Brownian paths and integrals
for adaptive and high order SDE solvers},
author={Andraž Jelinčič and James Foster and Patrick Kidger},
year={2024},
eprint={2405.06464},
archivePrefix={arXiv},
primaryClass={math.NA}
}
```
and Theorem 6.1.6 of
Expand All @@ -230,9 +240,6 @@ class VirtualBrownianTree(AbstractBrownianPath):
year = {2020}
}
```
In addition, the implementation here is a further improvement on these by using
an interpolation method which ensures the conditional 2nd moments are correct.
"""

t0: RealScalarLike
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _batch_sde_solve(
shape=struct,
tol=bm_tol,
key=key,
levy_area=concrete_la, # pyright: ignore
levy_area=concrete_la,
)
terms = get_terms(bm)
if controller is None:
Expand Down

0 comments on commit 6368de8

Please sign in to comment.