Skip to content

Commit 01c541b

Browse files
author
Gerrit Ansmann
committed
Moving dependent-helper detection to JiTC*DE Common
1 parent 55664cd commit 01c541b

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

jitcode/_jitcode.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import symengine
1212

1313
from jitcxde_common import jitcxde
14-
from jitcxde_common.helpers import sympify_helpers, sort_helpers
14+
from jitcxde_common.helpers import sympify_helpers, sort_helpers, find_dependent_helpers
1515
from jitcxde_common.numerical import random_direction, orthonormalise
1616
from jitcxde_common.symbolic import collect_arguments, ordered_subs, replace_function
1717
from jitcxde_common.transversal import GroupHandler
@@ -31,14 +31,10 @@ def _is_lambda(function):
3131
return isinstance(function, FunctionType)
3232

3333
def _jac_from_f_with_helpers(f, helpers, simplify, n):
34-
dependent_helpers = [[] for i in range(n)]
35-
for i in range(n):
36-
for helper in helpers:
37-
derivative = helper[1].diff(y(i))
38-
for other_helper in dependent_helpers[i]:
39-
derivative += helper[1].diff(other_helper[0]) * other_helper[1]
40-
if derivative:
41-
dependent_helpers[i].append( (helper[0], derivative) )
34+
dependent_helpers = [
35+
find_dependent_helpers(helpers,y(i))
36+
for i in range(n)
37+
]
4238

4339
def line(f_entry):
4440
for j in range(n):

0 commit comments

Comments
 (0)