Skip to content

Commit 21f950d

Browse files
committed
Get rid of __cinit__ in lambdify
1 parent 248ac70 commit 21f950d

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

Diff for: symengine/lib/symengine_wrapper.pyx

+17-20
Original file line numberDiff line numberDiff line change
@@ -4338,16 +4338,21 @@ cdef class _Lambdify(object):
43384338
cdef public str order
43394339
cdef vector[int] accum_out_sizes
43404340
cdef object numpy_dtype
4341-
cdef args
4342-
cdef tuple exprs
4343-
4344-
def __cinit__(self, args, *exprs, cppbool real=True, order='C'):
4345-
cdef vector[int] out_sizes
4346-
self.args = np.asanyarray(args)
4347-
self.args_size = self.args.size
4348-
self.exprs = tuple(np.asanyarray(expr) for expr in exprs)
4349-
self.out_shapes = [expr.shape for expr in self.exprs]
4350-
self.n_exprs = len(self.exprs)
4341+
4342+
def __init__(self, args, *exprs, cppbool real=True, order='C'):
4343+
cdef:
4344+
Basic e_
4345+
size_t ri, ci, nr, nc
4346+
symengine.MatrixBase *mtx
4347+
RCP[const symengine.Basic] b_
4348+
symengine.vec_basic args_, outs_
4349+
vector[int] out_sizes
4350+
4351+
args = np.asanyarray(args)
4352+
self.args_size = args.size
4353+
exprs = tuple(np.asanyarray(expr) for expr in exprs)
4354+
self.out_shapes = [expr.shape for expr in exprs]
4355+
self.n_exprs = len(exprs)
43514356
self.real = real
43524357
self.order = order
43534358
self.numpy_dtype = np.float64 if self.real else np.complex128
@@ -4362,19 +4367,11 @@ cdef class _Lambdify(object):
43624367
for j in range(i):
43634368
self.accum_out_sizes[i] += out_sizes[j]
43644369

4365-
def __init__(self, *args, **kwargs):
4366-
cdef:
4367-
Basic e_
4368-
size_t ri, ci, nr, nc
4369-
symengine.MatrixBase *mtx
4370-
RCP[const symengine.Basic] b_
4371-
symengine.vec_basic args_, outs_
4372-
4373-
for arg in np.ravel(self.args, order=self.order):
4370+
for arg in np.ravel(args, order=self.order):
43744371
e_ = _sympify(arg)
43754372
args_.push_back(e_.thisptr)
43764373

4377-
for curr_expr in self.exprs:
4374+
for curr_expr in exprs:
43784375
if curr_expr.ndim == 0:
43794376
e_ = _sympify(curr_expr.item())
43804377
outs_.push_back(e_.thisptr)

0 commit comments

Comments
 (0)