@@ -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 , ** kwargs ):
4473
4473
cdef:
4474
4474
Basic e_
4475
4475
size_t ri, ci, nr, nc
@@ -4706,6 +4706,10 @@ def create_low_level_callable(lambdify, *args):
4706
4706
4707
4707
4708
4708
cdef 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
+
4709
4713
cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
4710
4714
if self .real:
4711
4715
self .lambda_double.resize(1 )
@@ -4751,9 +4755,12 @@ cdef class LambdaDouble(_Lambdify):
4751
4755
4752
4756
IF HAVE_SYMENGINE_LLVM:
4753
4757
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
+
4754
4761
cdef _init(self , symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
4755
4762
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 )
4757
4764
4758
4765
cdef _load(self , const string & s):
4759
4766
self .lambda_double.resize(1 )
@@ -4801,7 +4808,7 @@ IF HAVE_SYMENGINE_LLVM:
4801
4808
def llvm_loading_func (*args ):
4802
4809
return LLVMDouble(args, _load = True )
4803
4810
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 ):
4805
4812
"""
4806
4813
Lambdify instances are callbacks that numerically evaluate their symbolic
4807
4814
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=
4851
4858
backend = os.getenv(' SYMENGINE_LAMBDIFY_BACKEND' , " lambda" )
4852
4859
if backend == " llvm" :
4853
4860
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 )
4855
4862
if as_scipy:
4856
4863
return ret.as_scipy_low_level_callable()
4857
4864
return ret
@@ -4862,7 +4869,7 @@ def Lambdify(args, *exprs, cppbool real=True, backend=None, order='C', as_scipy=
4862
4869
pass
4863
4870
else :
4864
4871
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 )
4866
4873
if as_scipy:
4867
4874
return ret.as_scipy_low_level_callable()
4868
4875
return ret
0 commit comments