@@ -4469,7 +4469,7 @@ def has_symbol(obj, symbol=None):
4469
4469
4470
4470
4471
4471
cdef class _Lambdify(object ):
4472
- def __init__ (self , args , *exprs , cppbool real = True , order = ' C' , cppbool cse = False , cppbool _load = False ):
4472
+ def __init__ (self , args , *exprs , cppbool real = True , order = ' C' , cppbool cse = False , cppbool _load = False , int opt_level ):
4473
4473
cdef:
4474
4474
Basic e_
4475
4475
size_t ri, ci, nr, nc
@@ -4516,9 +4516,9 @@ cdef class _Lambdify(object):
4516
4516
for e in np.ravel(curr_expr, order = self .order):
4517
4517
e_ = _sympify(e)
4518
4518
outs_.push_back(e_.thisptr)
4519
- self ._init(args_, outs_, cse)
4519
+ self ._init(args_, outs_, cse, opt_level )
4520
4520
4521
- cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
4521
+ cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse, int opt_level ):
4522
4522
raise ValueError (" Not supported" )
4523
4523
4524
4524
cdef _load(self , const string & s):
@@ -4706,7 +4706,7 @@ def create_low_level_callable(lambdify, *args):
4706
4706
4707
4707
4708
4708
cdef class LambdaDouble(_Lambdify):
4709
- cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
4709
+ cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse, int opt_level ):
4710
4710
if self .real:
4711
4711
self .lambda_double.resize(1 )
4712
4712
self .lambda_double[0 ].init(args_, outs_, cse)
@@ -4751,9 +4751,9 @@ cdef class LambdaDouble(_Lambdify):
4751
4751
4752
4752
IF HAVE_SYMENGINE_LLVM:
4753
4753
cdef class LLVMDouble(_Lambdify):
4754
- cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
4754
+ cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse, int opt_level ):
4755
4755
self .lambda_double.resize(1 )
4756
- self .lambda_double[0 ].init(args_, outs_, cse)
4756
+ self .lambda_double[0 ].init(args_, outs_, cse, opt_level )
4757
4757
4758
4758
cdef _load(self , const string & s):
4759
4759
self .lambda_double.resize(1 )
@@ -4801,7 +4801,7 @@ IF HAVE_SYMENGINE_LLVM:
4801
4801
def llvm_loading_func (*args ):
4802
4802
return LLVMDouble(args, _load = True )
4803
4803
4804
- def Lambdify (args , *exprs , cppbool real = True , backend = None , order = ' C' , as_scipy = False , cse = False ):
4804
+ def Lambdify (args , *exprs , cppbool real = True , backend = None , order = ' C' , as_scipy = False , cse = False , opt_level = 3 ):
4805
4805
"""
4806
4806
Lambdify instances are callbacks that numerically evaluate their symbolic
4807
4807
expressions from user provided input (real or complex) into (possibly user
@@ -4851,7 +4851,7 @@ def Lambdify(args, *exprs, cppbool real=True, backend=None, order='C', as_scipy=
4851
4851
backend = os.getenv(' SYMENGINE_LAMBDIFY_BACKEND' , " lambda" )
4852
4852
if backend == " llvm" :
4853
4853
IF HAVE_SYMENGINE_LLVM:
4854
- ret = LLVMDouble(args, * exprs, real = real, order = order, cse = cse)
4854
+ ret = LLVMDouble(args, * exprs, real = real, order = order, cse = cse, opt_level = opt_level )
4855
4855
if as_scipy:
4856
4856
return ret.as_scipy_low_level_callable()
4857
4857
return ret
0 commit comments