Skip to content

Commit

Permalink
MERGE MAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenharry committed May 25, 2024
2 parents c249a12 + 5831740 commit 06dd04d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 45 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

explore.py
blackjax/benchmarks/

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
84 changes: 42 additions & 42 deletions blackjax/mcmc/integrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,48 @@ def isokinetic_integrator(
isokinetic_omelyan = generate_isokinetic_integrator(omelyan_coefficients)


def calls_per_integrator_step(c):
if c == velocity_verlet_coefficients:
return 1
if c == mclachlan_coefficients:
return 2
if c == yoshida_coefficients:
return 3
if c == omelyan_coefficients:
return 5

Check warning on line 413 in blackjax/mcmc/integrators.py

View check run for this annotation

Codecov / codecov/patch

blackjax/mcmc/integrators.py#L406-L413

Added lines #L406 - L413 were not covered by tests

else:
raise Exception("No such integrator exists in blackjax")

Check warning on line 416 in blackjax/mcmc/integrators.py

View check run for this annotation

Codecov / codecov/patch

blackjax/mcmc/integrators.py#L416

Added line #L416 was not covered by tests


def name_integrator(c):
if c == velocity_verlet_coefficients:
return "velocity_verlet"
if c == mclachlan_coefficients:
return "mclachlan"
if c == yoshida_coefficients:
return "yoshida"
if c == omelyan_coefficients:
return "omelyan"

Check warning on line 427 in blackjax/mcmc/integrators.py

View check run for this annotation

Codecov / codecov/patch

blackjax/mcmc/integrators.py#L420-L427

Added lines #L420 - L427 were not covered by tests

else:
raise Exception("No such integrator exists in blackjax")

Check warning on line 430 in blackjax/mcmc/integrators.py

View check run for this annotation

Codecov / codecov/patch

blackjax/mcmc/integrators.py#L430

Added line #L430 was not covered by tests


def integrator_order(c):
if c == velocity_verlet_coefficients:
return 2
if c == mclachlan_coefficients:
return 2
if c == yoshida_coefficients:
return 4
if c == omelyan_coefficients:
return 4

Check warning on line 441 in blackjax/mcmc/integrators.py

View check run for this annotation

Codecov / codecov/patch

blackjax/mcmc/integrators.py#L434-L441

Added lines #L434 - L441 were not covered by tests

else:
raise Exception("No such integrator exists in blackjax")

Check warning on line 444 in blackjax/mcmc/integrators.py

View check run for this annotation

Codecov / codecov/patch

blackjax/mcmc/integrators.py#L444

Added line #L444 was not covered by tests


def partially_refresh_momentum(momentum, rng_key, step_size, L):
"""Adds a small noise to momentum and normalizes.
Expand Down Expand Up @@ -455,48 +497,6 @@ def stochastic_integrator(init_state, step_size, L_proposal, rng_key):
return stochastic_integrator


def calls_per_integrator_step(c):
if c == velocity_verlet_coefficients:
return 1
if c == mclachlan_coefficients:
return 2
if c == yoshida_coefficients:
return 3
if c == omelyan_coefficients:
return 5

else:
raise Exception("No such integrator exists in blackjax")


def name_integrator(c):
if c == velocity_verlet_coefficients:
return "velocity_verlet"
if c == mclachlan_coefficients:
return "mclachlan"
if c == yoshida_coefficients:
return "yoshida"
if c == omelyan_coefficients:
return "omelyan"

else:
raise Exception("No such integrator exists in blackjax")


def integrator_order(c):
if c == velocity_verlet_coefficients:
return 2
if c == mclachlan_coefficients:
return 2
if c == yoshida_coefficients:
return 4
if c == omelyan_coefficients:
return 4

else:
raise Exception("No such integrator exists in blackjax")


FixedPointSolver = Callable[
[Callable[[ArrayTree], Tuple[ArrayTree, ArrayTree]], ArrayTree],
Tuple[ArrayTree, ArrayTree, Any],
Expand Down

0 comments on commit 06dd04d

Please sign in to comment.