Skip to content

Commit 13cedfa

Browse files
authored
Merge pull request #288 from richardotis/master
LambdaDouble and LLVMDouble as cimport-able types
2 parents 1366cf9 + 7cea78a commit 13cedfa

File tree

2 files changed

+40
-15
lines changed

2 files changed

+40
-15
lines changed

symengine/lib/symengine_wrapper.pxd

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
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
6+
7+
include "config.pxi"
38

49
cdef class Basic(object):
510
cdef rcp_const_basic thisptr
@@ -22,3 +27,38 @@ cdef class DictBasicIter(object):
2227
cdef init(self, map_basic_basic.iterator begin, map_basic_basic.iterator end)
2328

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