Skip to content

Commit 64cb264

Browse files
committed
symengine_wrapper: Add LambdaDouble and LLVMDouble as cimport-able types
1 parent 1366cf9 commit 64cb264

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

symengine/lib/symengine_wrapper.pxd

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
cimport symengine
22
from symengine cimport RCP, map_basic_basic, rcp_const_basic
3+
from libcpp.vector cimport vector
4+
from libcpp.string cimport string
5+
from libcpp cimport bool as cppbool
36

47
cdef class Basic(object):
58
cdef rcp_const_basic thisptr
@@ -22,3 +25,37 @@ cdef class DictBasicIter(object):
2225
cdef init(self, map_basic_basic.iterator begin, map_basic_basic.iterator end)
2326

2427
cdef object c2py(rcp_const_basic o)
28+
29+
cdef class _Lambdify(object):
30+
cdef size_t args_size, tot_out_size
31+
cdef list out_shapes
32+
cdef readonly bint real
33+
cdef readonly size_t n_exprs
34+
cdef public str order
35+
cdef vector[int] accum_out_sizes
36+
cdef object numpy_dtype
37+
38+
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
39+
cdef _load(self, const string &s)
40+
cpdef unsafe_real(self,
41+
double[::1] inp, double[::1] out,
42+
int inp_offset=*, int out_offset=*)
43+
cpdef unsafe_complex(self, double complex[::1] inp, double complex[::1] out,
44+
int inp_offset=*, int out_offset=*)
45+
cpdef eval_real(self, inp, out)
46+
cpdef eval_complex(self, inp, out)
47+
48+
cdef class LambdaDouble(_Lambdify):
49+
cdef vector[symengine.LambdaRealDoubleVisitor] lambda_double
50+
cdef vector[symengine.LambdaComplexDoubleVisitor] lambda_double_complex
51+
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
52+
cpdef unsafe_real(self, double[::1] inp, double[::1] out, int inp_offset=*, int out_offset=*)
53+
cpdef unsafe_complex(self, double complex[::1] inp, double complex[::1] out, int inp_offset=*, int out_offset=*)
54+
cpdef as_scipy_low_level_callable(self)
55+
56+
cdef class LLVMDouble(_Lambdify):
57+
cdef vector[symengine.LLVMDoubleVisitor] lambda_double
58+
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
59+
cdef _load(self, const string &s)
60+
cpdef unsafe_real(self, double[::1] inp, double[::1] out, int inp_offset=*, int out_offset=*)
61+
cpdef as_scipy_low_level_callable(self)

symengine/lib/symengine_wrapper.pyx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4452,14 +4452,6 @@ def has_symbol(obj, symbol=None):
44524452

44534453

44544454
cdef class _Lambdify(object):
4455-
cdef size_t args_size, tot_out_size
4456-
cdef list out_shapes
4457-
cdef readonly bint real
4458-
cdef readonly size_t n_exprs
4459-
cdef public str order
4460-
cdef vector[int] accum_out_sizes
4461-
cdef object numpy_dtype
4462-
44634455
def __init__(self, args, *exprs, cppbool real=True, order='C', cppbool cse=False, cppbool _load=False):
44644456
cdef:
44654457
Basic e_
@@ -4690,10 +4682,6 @@ def create_low_level_callable(lambdify, *args):
46904682

46914683

46924684
cdef class LambdaDouble(_Lambdify):
4693-
4694-
cdef vector[symengine.LambdaRealDoubleVisitor] lambda_double
4695-
cdef vector[symengine.LambdaComplexDoubleVisitor] lambda_double_complex
4696-
46974685
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
46984686
if self.real:
46994687
self.lambda_double.resize(1)
@@ -4722,9 +4710,6 @@ cdef class LambdaDouble(_Lambdify):
47224710

47234711
IF HAVE_SYMENGINE_LLVM:
47244712
cdef class LLVMDouble(_Lambdify):
4725-
4726-
cdef vector[symengine.LLVMDoubleVisitor] lambda_double
4727-
47284713
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
47294714
self.lambda_double.resize(1)
47304715
self.lambda_double[0].init(args_, outs_, cse)

0 commit comments

Comments
 (0)