Skip to content

refactor: remove JIT decoration from Euler stepping function #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions ngclearn/utils/diffeq/ode_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def _step_forward(t, x, dx_dt, dt, x_scale): ## internal step co-routine
_x = x * x_scale + dx_dt * dt
return _t, _x

@partial(jit, static_argnums=(2, ))


def step_euler(t, x, dfx, dt, params, x_scale=1.):
"""
Iteratively integrates one step forward via the Euler method, i.e., a
Expand Down Expand Up @@ -83,7 +84,7 @@ def step_euler(t, x, dfx, dt, params, x_scale=1.):
_t, _x = _step_forward(t, x, dx_dt, dt, x_scale)
return _t, _x

@partial(jit, static_argnums=(2, ))

def step_heun(t, x, dfx, dt, params, x_scale=1.):
"""
Iteratively integrates one step forward via Heun's method, i.e., a
Expand Down Expand Up @@ -124,7 +125,7 @@ def step_heun(t, x, dfx, dt, params, x_scale=1.):
_, _x = _step_forward(t, x, summed_dx_dt, dt * 0.5, x_scale)
return _t, _x

@partial(jit, static_argnums=(2, ))

def step_rk2(t, x, dfx, dt, params, x_scale=1.):
"""
Iteratively integrates one step forward via the midpoint method, i.e., a
Expand Down Expand Up @@ -165,7 +166,7 @@ def step_rk2(t, x, dfx, dt, params, x_scale=1.):



@partial(jit, static_argnums=(2, ))

def step_rk4(t, x, dfx, dt, params, x_scale=1.):
"""
Iteratively integrates one step forward via the midpoint method, i.e., a
Expand Down Expand Up @@ -211,7 +212,7 @@ def step_rk4(t, x, dfx, dt, params, x_scale=1.):
_t, _x = _step_forward(t, x, _dx_dt / 6, dt, x_scale)
return _t, _x

@partial(jit, static_argnums=(2, ))

def step_ralston(t, x, dfx, dt, params, x_scale=1.):
"""
Iteratively integrates one step forward via Ralston's method, i.e., a
Expand Down