diff --git a/symengine/lib/symengine.pxd b/symengine/lib/symengine.pxd index 65b3456a..8de101f9 100644 --- a/symengine/lib/symengine.pxd +++ b/symengine/lib/symengine.pxd @@ -133,6 +133,7 @@ cdef extern from "" namespace "SymEngine": RCP[const Rational] rcp_static_cast_Rational "SymEngine::rcp_static_cast"(rcp_const_basic &b) nogil RCP[const Complex] rcp_static_cast_Complex "SymEngine::rcp_static_cast"(rcp_const_basic &b) nogil RCP[const Number] rcp_static_cast_Number "SymEngine::rcp_static_cast"(rcp_const_basic &b) nogil + RCP[const Dummy] rcp_static_cast_Dummy "SymEngine::rcp_static_cast"(rcp_const_basic &b) nogil RCP[const Add] rcp_static_cast_Add "SymEngine::rcp_static_cast"(rcp_const_basic &b) nogil RCP[const Mul] rcp_static_cast_Mul "SymEngine::rcp_static_cast"(rcp_const_basic &b) nogil RCP[const Pow] rcp_static_cast_Pow "SymEngine::rcp_static_cast"(rcp_const_basic &b) nogil @@ -180,7 +181,7 @@ cdef extern from "" namespace "SymEngine": Symbol(string name) nogil string get_name() nogil cdef cppclass Dummy(Symbol): - pass + size_t get_index() cdef extern from "" namespace "SymEngine": cdef cppclass Number(Basic): diff --git a/symengine/lib/symengine_wrapper.in.pyx b/symengine/lib/symengine_wrapper.in.pyx index 6fe0ffa5..061d57d3 100644 --- a/symengine/lib/symengine_wrapper.in.pyx +++ b/symengine/lib/symengine_wrapper.in.pyx @@ -1355,6 +1355,12 @@ cdef class Dummy(Symbol): def func(self): return self.__class__ + @property + def dummy_index(self): + cdef RCP[const symengine.Dummy] this = \ + symengine.rcp_static_cast_Dummy(self.thisptr) + cdef size_t index = deref(this).get_index() + return index def symarray(prefix, shape, **kwargs): """ Creates an nd-array of symbols diff --git a/symengine/tests/test_symbol.py b/symengine/tests/test_symbol.py index 49825914..42a2c519 100644 --- a/symengine/tests/test_symbol.py +++ b/symengine/tests/test_symbol.py @@ -156,6 +156,7 @@ def test_dummy(): x2 = Symbol('x') xdummy1 = Dummy('x') xdummy2 = Dummy('x') + assert xdummy1.dummy_index != xdummy2.dummy_index # maybe test using "less than"? assert x1 == x2 assert x1 != xdummy1