Skip to content

Commit 7cb51d3

Browse files
committed
Add func to more classes
1 parent 0430e95 commit 7cb51d3

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

symengine/lib/symengine_wrapper.pyx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,8 @@ class Symbol(Basic):
765765
def is_Symbol(self):
766766
return True
767767

768+
func = __class__
769+
768770

769771
def symarray(prefix, shape, **kwargs):
770772
""" Creates an nd-array of symbols
@@ -887,6 +889,7 @@ class Rational(Number):
887889
rat = self.get_num_den()
888890
return rat[0]._sage_() / rat[1]._sage_()
889891

892+
func = __class__
890893

891894
class Integer(Rational):
892895

@@ -986,6 +989,8 @@ class Integer(Rational):
986989
def get_num_den(Basic self):
987990
return self, 1
988991

992+
func = __class__
993+
989994

990995
def dps_to_prec(n):
991996
"""Return the number of bits required to represent n decimals accurately."""
@@ -1180,9 +1185,7 @@ class Add(Basic):
11801185
deref(X).as_two_terms(symengine.outArg(a), symengine.outArg(b))
11811186
return c2py(a)._sage_() + c2py(b)._sage_()
11821187

1183-
@property
1184-
def func(self):
1185-
return Add
1188+
func = __class__
11861189

11871190
def as_coefficients_dict(Basic self):
11881191
cdef RCP[const symengine.Add] X = symengine.rcp_static_cast_Add(self.thisptr)
@@ -1223,9 +1226,7 @@ class Mul(Basic):
12231226
deref(X).as_two_terms(symengine.outArg(a), symengine.outArg(b))
12241227
return c2py(a)._sage_() * c2py(b)._sage_()
12251228

1226-
@property
1227-
def func(self):
1228-
return Mul
1229+
func = __class__
12291230

12301231
def as_coefficients_dict(Basic self):
12311232
cdef RCP[const symengine.Mul] X = symengine.rcp_static_cast_Mul(self.thisptr)
@@ -1260,8 +1261,7 @@ class Pow(Basic):
12601261
exp = c2py(deref(X).get_exp())
12611262
return base._sage_() ** exp._sage_()
12621263

1263-
def func(self, *values):
1264-
return _sympify(values[0]) ** _sympify(values[1])
1264+
func = __class__
12651265

12661266

12671267
class Function(Basic):
@@ -1490,6 +1490,7 @@ class Abs(OneArgFunction):
14901490
arg = c2py(deref(X).get_arg())._sage_()
14911491
return abs(arg)
14921492

1493+
func = __class__
14931494

14941495
class FunctionSymbol(Function):
14951496

@@ -1641,6 +1642,7 @@ class Max(Function):
16411642
s = self.args_as_sage()
16421643
return sage.max(*s)
16431644

1645+
func = __class__
16441646

16451647
class Min(Function):
16461648

@@ -1657,6 +1659,7 @@ class Min(Function):
16571659
s = self.args_as_sage()
16581660
return sage.min(*s)
16591661

1662+
func = __class__
16601663

16611664
class Derivative(Basic):
16621665

@@ -1697,6 +1700,9 @@ class Derivative(Basic):
16971700
s.append(c2py(<RCP[const symengine.Basic]>(i))._sage_())
16981701
return arg.diff(*s)
16991702

1703+
func = __class__
1704+
1705+
17001706
class Subs(Basic):
17011707

17021708
def __new__(self, expr, variables, point):
@@ -1743,6 +1749,9 @@ class Subs(Basic):
17431749
c2py(<RCP[const symengine.Basic]>(P[i]))._sage_()
17441750
return arg.subs(v)
17451751

1752+
func = __class__
1753+
1754+
17461755
cdef class MatrixBase:
17471756

17481757
@property

0 commit comments

Comments
 (0)