@@ -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 , ** kwargs ):
44734473 cdef:
44744474 Basic e_
44754475 size_t ri, ci, nr, nc
@@ -4706,6 +4706,10 @@ def create_low_level_callable(lambdify, *args):
47064706
47074707
47084708cdef class LambdaDouble(_Lambdify):
4709+ def __cinit__ (self , args , *exprs , cppbool real = True , order = ' C' , cppbool cse = False , cppbool _load = False ):
4710+ # reject additional arguments
4711+ pass
4712+
47094713 cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
47104714 if self .real:
47114715 self .lambda_double.resize(1 )
@@ -4751,9 +4755,12 @@ cdef class LambdaDouble(_Lambdify):
47514755
47524756IF HAVE_SYMENGINE_LLVM:
47534757 cdef class LLVMDouble(_Lambdify):
4758+ def __cinit__ (self , args , *exprs , cppbool real = True , order = ' C' , cppbool cse = False , cppbool _load = False , opt_level = 3 ):
4759+ self .opt_level = opt_level
4760+
47544761 cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
47554762 self .lambda_double.resize(1 )
4756- self .lambda_double[0 ].init(args_, outs_, cse)
4763+ self .lambda_double[0 ].init(args_, outs_, cse, self .opt_level )
47574764
47584765 cdef _load(self , const string & s):
47594766 self .lambda_double.resize(1 )
@@ -4801,7 +4808,7 @@ IF HAVE_SYMENGINE_LLVM:
48014808 def llvm_loading_func (*args ):
48024809 return LLVMDouble(args, _load = True )
48034810
4804- def Lambdify (args , *exprs , cppbool real = True , backend = None , order = ' C' , as_scipy = False , cse = False ):
4811+ def Lambdify (args , *exprs , cppbool real = True , backend = None , order = ' C' , as_scipy = False , cse = False , ** kwargs ):
48054812 """
48064813 Lambdify instances are callbacks that numerically evaluate their symbolic
48074814 expressions from user provided input (real or complex) into (possibly user
@@ -4851,7 +4858,7 @@ def Lambdify(args, *exprs, cppbool real=True, backend=None, order='C', as_scipy=
48514858 backend = os.getenv(' SYMENGINE_LAMBDIFY_BACKEND' , " lambda" )
48524859 if backend == " llvm" :
48534860 IF HAVE_SYMENGINE_LLVM:
4854- ret = LLVMDouble(args, * exprs, real = real, order = order, cse = cse)
4861+ ret = LLVMDouble(args, * exprs, real = real, order = order, cse = cse, ** kwargs )
48554862 if as_scipy:
48564863 return ret.as_scipy_low_level_callable()
48574864 return ret
@@ -4862,7 +4869,7 @@ def Lambdify(args, *exprs, cppbool real=True, backend=None, order='C', as_scipy=
48624869 pass
48634870 else :
48644871 warnings.warn(" Unknown SymEngine backend: %s \n Using backend='lambda'" % backend)
4865- ret = LambdaDouble(args, * exprs, real = real, order = order, cse = cse)
4872+ ret = LambdaDouble(args, * exprs, real = real, order = order, cse = cse, ** kwargs )
48664873 if as_scipy:
48674874 return ret.as_scipy_low_level_callable()
48684875 return ret
0 commit comments