Skip to content

Commit

Permalink
Update ode_utils.py (#79)
Browse files Browse the repository at this point in the history
refactor: delete @partial(jit, static_argnums=(2, )) lines

Co-authored-by: Will Gebhardt <will@gebhardts.net>
  • Loading branch information
Faezehabibi and willgebhardt authored Dec 2, 2024
1 parent 94f1697 commit de53d20
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit de53d20

Please sign in to comment.