Skip to content

Commit e365467

Browse files
committed
Use order='none' for cse in lambdify also, further fixes #506.
1 parent 9144e02 commit e365467

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

opty/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import tempfile
77
import subprocess
88
import importlib
9-
from functools import wraps
9+
from functools import wraps, partial
1010
import warnings
1111
from distutils.ccompiler import new_compiler
1212
from distutils.errors import CompileError
@@ -372,7 +372,8 @@ def integration_function(x):
372372
return sm.lambdify(
373373
(states, inputs, params), expr,
374374
modules=[{int_placeholder.name: integration_function}, "numpy"],
375-
cse=True)
375+
cse=partial(sm.cse, order='none', list=False),
376+
docstring_limit=0)
376377

377378
def parse_expr(expr, in_integral=False):
378379
if not expr.args:
@@ -616,7 +617,10 @@ def lambdify_matrix(args, expr):
616617
- ``argn`` : ndarray shape(n,) or float
617618
618619
"""
619-
eval_single_mat = sm.lambdify(args, expr, modules='numpy', cse=True)
620+
eval_single_mat = sm.lambdify(args, expr, modules='numpy',
621+
cse=partial(sm.cse, order='none',
622+
list=False),
623+
docstring_limit=0)
620624

621625
# TODO : this is terribly computationally costly but there is not a clean
622626
# way to do this using appropriate broadcasting via lambdify. See:

0 commit comments

Comments
 (0)