@@ -4469,7 +4469,7 @@ def has_symbol(obj, symbol=None):
44694469
44704470
44714471cdef 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 ):
44734473 cdef:
44744474 Basic e_
44754475 size_t ri, ci, nr, nc
@@ -4516,9 +4516,9 @@ cdef class _Lambdify(object):
45164516 for e in np.ravel(curr_expr, order = self .order):
45174517 e_ = _sympify(e)
45184518 outs_.push_back(e_.thisptr)
4519- self ._init(args_, outs_, cse)
4519+ self ._init(args_, outs_, cse, opt_level )
45204520
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 ):
45224522 raise ValueError (" Not supported" )
45234523
45244524 cdef _load(self , const string & s):
@@ -4706,7 +4706,7 @@ def create_low_level_callable(lambdify, *args):
47064706
47074707
47084708cdef 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 ):
47104710 if self .real:
47114711 self .lambda_double.resize(1 )
47124712 self .lambda_double[0 ].init(args_, outs_, cse)
@@ -4751,9 +4751,9 @@ cdef class LambdaDouble(_Lambdify):
47514751
47524752IF HAVE_SYMENGINE_LLVM:
47534753 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 ):
47554755 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 )
47574757
47584758 cdef _load(self , const string & s):
47594759 self .lambda_double.resize(1 )
@@ -4801,7 +4801,7 @@ IF HAVE_SYMENGINE_LLVM:
48014801 def llvm_loading_func (*args ):
48024802 return LLVMDouble(args, _load = True )
48034803
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 ):
48054805 """
48064806 Lambdify instances are callbacks that numerically evaluate their symbolic
48074807 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=
48514851 backend = os.getenv(' SYMENGINE_LAMBDIFY_BACKEND' , " lambda" )
48524852 if backend == " llvm" :
48534853 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 )
48554855 if as_scipy:
48564856 return ret.as_scipy_low_level_callable()
48574857 return ret
0 commit comments