Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LambdaDouble and LLVMDouble as cimport-able types #288

Merged
merged 2 commits into from
Jun 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions symengine/lib/symengine_wrapper.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cimport symengine
from symengine cimport RCP, map_basic_basic, rcp_const_basic
from libcpp.vector cimport vector
from libcpp.string cimport string
from libcpp cimport bool as cppbool

include "config.pxi"
isuruf marked this conversation as resolved.
Show resolved Hide resolved

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

cdef object c2py(rcp_const_basic o)

cdef class _Lambdify(object):
cdef size_t args_size, tot_out_size
cdef list out_shapes
cdef readonly bint real
cdef readonly size_t n_exprs
cdef public str order
cdef vector[int] accum_out_sizes
cdef object numpy_dtype

cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cdef _load(self, const string &s)
cpdef unsafe_real(self,
double[::1] inp, double[::1] out,
int inp_offset=*, int out_offset=*)
cpdef unsafe_complex(self, double complex[::1] inp, double complex[::1] out,
int inp_offset=*, int out_offset=*)
cpdef eval_real(self, inp, out)
cpdef eval_complex(self, inp, out)

cdef class LambdaDouble(_Lambdify):
cdef vector[symengine.LambdaRealDoubleVisitor] lambda_double
cdef vector[symengine.LambdaComplexDoubleVisitor] lambda_double_complex
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cpdef unsafe_real(self, double[::1] inp, double[::1] out, int inp_offset=*, int out_offset=*)
cpdef unsafe_complex(self, double complex[::1] inp, double complex[::1] out, int inp_offset=*, int out_offset=*)
cpdef as_scipy_low_level_callable(self)

IF HAVE_SYMENGINE_LLVM:
cdef class LLVMDouble(_Lambdify):
cdef vector[symengine.LLVMDoubleVisitor] lambda_double
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cdef _load(self, const string &s)
cpdef unsafe_real(self, double[::1] inp, double[::1] out, int inp_offset=*, int out_offset=*)
cpdef as_scipy_low_level_callable(self)
15 changes: 0 additions & 15 deletions symengine/lib/symengine_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4452,14 +4452,6 @@ def has_symbol(obj, symbol=None):


cdef class _Lambdify(object):
cdef size_t args_size, tot_out_size
cdef list out_shapes
cdef readonly bint real
cdef readonly size_t n_exprs
cdef public str order
cdef vector[int] accum_out_sizes
cdef object numpy_dtype

def __init__(self, args, *exprs, cppbool real=True, order='C', cppbool cse=False, cppbool _load=False):
cdef:
Basic e_
Expand Down Expand Up @@ -4690,10 +4682,6 @@ def create_low_level_callable(lambdify, *args):


cdef class LambdaDouble(_Lambdify):

cdef vector[symengine.LambdaRealDoubleVisitor] lambda_double
cdef vector[symengine.LambdaComplexDoubleVisitor] lambda_double_complex

cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
if self.real:
self.lambda_double.resize(1)
Expand Down Expand Up @@ -4722,9 +4710,6 @@ cdef class LambdaDouble(_Lambdify):

IF HAVE_SYMENGINE_LLVM:
cdef class LLVMDouble(_Lambdify):

cdef vector[symengine.LLVMDoubleVisitor] lambda_double

cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse):
self.lambda_double.resize(1)
self.lambda_double[0].init(args_, outs_, cse)
Expand Down