@@ -45,17 +45,17 @@ def get_integrator_code(integrationType): ## integrator type decoding routine
4545@jit
4646def _sum_combine (* args , ** kwargs ): ## fast co-routine for simple addition/summation
4747 _sum = 0
48- for arg , val in zip (args , kwargs .values ()):
48+ for arg , val in zip (args , kwargs .values ()): ## Sigma^I_{i=1} a_i
4949 _sum = _sum + val * arg
5050 return _sum
5151
5252@jit
5353def _step_forward (t , x , dx_dt , dt , x_scale ): ## internal step co-routine
54- _t = t + dt
55- _x = x * x_scale + dx_dt * dt
54+ _t = t + dt ## advance time forward by dt (denominator)
55+ _x = x * x_scale + dx_dt * dt ## advance variable(s) forward by dt (numerator)
5656 return _t , _x
5757
58- @partial (jit , static_argnums = (2 , 3 , 5 )) #(2, 3, 4, 5 )
58+ @partial (jit , static_argnums = (2 ) )
5959def step_euler (t , x , dfx , dt , params , x_scale = 1. ):
6060 """
6161 Iteratively integrates one step forward via the Euler method, i.e., a
@@ -84,7 +84,7 @@ def step_euler(t, x, dfx, dt, params, x_scale=1.):
8484 _t , _x = next_state
8585 return _t , _x
8686
87- @partial (jit , static_argnums = (1 , 2 , 4 )) #(1, 2, 3, 4 ))
87+ @partial (jit , static_argnums = (1 ))
8888def _euler (carry , dfx , dt , params , x_scale = 1. ):
8989 """
9090 Iteratively integrates one step forward via the Euler method, i.e., a
@@ -112,7 +112,7 @@ def _euler(carry, dfx, dt, params, x_scale=1.):
112112 new_carry = (_t , _x )
113113 return new_carry , (new_carry , carry )
114114
115- @partial (jit , static_argnums = (2 , 3 , 5 )) #(2, 3, 4, 5 ))
115+ @partial (jit , static_argnums = (2 ))
116116def step_heun (t , x , dfx , dt , params , x_scale = 1. ):
117117 """
118118 Iteratively integrates one step forward via Heun's method, i.e., a
@@ -150,7 +150,7 @@ def step_heun(t, x, dfx, dt, params, x_scale=1.):
150150 _t , _x = next_state
151151 return _t , _x
152152
153- @partial (jit , static_argnums = (1 , 2 , 4 )) #(1, 2, 3, 4, ))
153+ @partial (jit , static_argnums = (1 ))
154154def _heun (carry , dfx , dt , params , x_scale = 1. ):
155155 """
156156 Iteratively integrates one step forward via Heun's method, i.e., a
@@ -189,7 +189,7 @@ def _heun(carry, dfx, dt, params, x_scale=1.):
189189 new_carry = (_t , _x )
190190 return new_carry , (new_carry , carry )
191191
192- @partial (jit , static_argnums = (2 , 3 , 5 )) #(2, 3, 4, 5 ))
192+ @partial (jit , static_argnums = (2 ))
193193def step_rk2 (t , x , dfx , dt , params , x_scale = 1. ):
194194 """
195195 Iteratively integrates one step forward via the midpoint method, i.e., a
@@ -224,7 +224,7 @@ def step_rk2(t, x, dfx, dt, params, x_scale=1.):
224224 _t , _x = next_state
225225 return _t , _x
226226
227- @partial (jit , static_argnums = (1 , 2 , 4 )) #(1, 2, 3, 4, ))
227+ @partial (jit , static_argnums = (1 ))
228228def _rk2 (carry , dfx , dt , params , x_scale = 1. ):
229229 """
230230 Iteratively integrates one step forward via the midpoint method, i.e., a
@@ -260,7 +260,7 @@ def _rk2(carry, dfx, dt, params, x_scale=1.):
260260 new_carry = (_t , _x )
261261 return new_carry , (new_carry , carry )
262262
263- @partial (jit , static_argnums = (2 , 3 , 5 )) #(2, 3, 4, 5 ))
263+ @partial (jit , static_argnums = (2 ))
264264def step_rk4 (t , x , dfx , dt , params , x_scale = 1. ):
265265 """
266266 Iteratively integrates one step forward via the midpoint method, i.e., a
@@ -295,7 +295,7 @@ def step_rk4(t, x, dfx, dt, params, x_scale=1.):
295295 _t , _x = next_state
296296 return _t , _x
297297
298- @partial (jit , static_argnums = (1 , 2 , 4 )) #(1, 2, 3, 4, ))
298+ @partial (jit , static_argnums = (1 ))
299299def _rk4 (carry , dfx , dt , params , x_scale = 1. ):
300300 """
301301 Iteratively integrates one step forward via the midpoint method, i.e., a
@@ -338,7 +338,7 @@ def _rk4(carry, dfx, dt, params, x_scale=1.):
338338 new_carry = (_t , _x )
339339 return new_carry , (new_carry , carry )
340340
341- @partial (jit , static_argnums = (2 , 3 , 5 )) #(2, 3, 4, 5 ))
341+ @partial (jit , static_argnums = (2 ))
342342def step_ralston (t , x , dfx , dt , params , x_scale = 1. ):
343343 """
344344 Iteratively integrates one step forward via Ralston's method, i.e., a
@@ -375,7 +375,7 @@ def step_ralston(t, x, dfx, dt, params, x_scale=1.):
375375 _t , _x = next_state
376376 return _t , _x
377377
378- @partial (jit , static_argnums = (1 , 2 , 4 )) #(1, 2, 3, 4, ))
378+ @partial (jit , static_argnums = (1 ))
379379def _ralston (carry , dfx , dt , params , x_scale = 1. ):
380380 """
381381 Iteratively integrates one step forward via Ralston's method, i.e., a
@@ -416,7 +416,6 @@ def _ralston(carry, dfx, dt, params, x_scale=1.):
416416 new_carry = (_t , _x )
417417 return new_carry , (new_carry , carry )
418418
419-
420419@partial (jit , static_argnums = (0 , 3 , 4 , 5 , 6 , 7 , 8 ))
421420def solve_ode (method_name , t0 , x0 , T , dfx , dt , params = None , x_scale = 1. , sols_only = True ):
422421 if method_name == 'euler' :
0 commit comments