File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ cdef extern from "<symengine/basic.h>" namespace "SymEngine":
133133 RCP[const Rational] rcp_static_cast_Rational " SymEngine::rcp_static_cast<const SymEngine::Rational>" (rcp_const_basic & b) nogil
134134 RCP[const Complex] rcp_static_cast_Complex " SymEngine::rcp_static_cast<const SymEngine::Complex>" (rcp_const_basic & b) nogil
135135 RCP[const Number] rcp_static_cast_Number " SymEngine::rcp_static_cast<const SymEngine::Number>" (rcp_const_basic & b) nogil
136+ RCP[const Dummy] rcp_static_cast_Dummy " SymEngine::rcp_static_cast<const SymEngine::Dummy>" (rcp_const_basic & b) nogil
136137 RCP[const Add] rcp_static_cast_Add " SymEngine::rcp_static_cast<const SymEngine::Add>" (rcp_const_basic & b) nogil
137138 RCP[const Mul] rcp_static_cast_Mul " SymEngine::rcp_static_cast<const SymEngine::Mul>" (rcp_const_basic & b) nogil
138139 RCP[const Pow] rcp_static_cast_Pow " SymEngine::rcp_static_cast<const SymEngine::Pow>" (rcp_const_basic & b) nogil
@@ -180,7 +181,7 @@ cdef extern from "<symengine/symbol.h>" namespace "SymEngine":
180181 Symbol(string name) nogil
181182 string get_name() nogil
182183 cdef cppclass Dummy(Symbol):
183- pass
184+ size_t get_index()
184185
185186cdef extern from " <symengine/number.h>" namespace " SymEngine" :
186187 cdef cppclass Number(Basic):
Original file line number Diff line number Diff line change @@ -1343,9 +1343,13 @@ cdef class Dummy(Symbol):
13431343 else :
13441344 self .thisptr = symengine.make_rcp_Dummy(name.encode(" utf-8" ))
13451345
1346+ @property
1347+ def name (self ):
1348+ return self .__str__ ()[1 :]
1349+
13461350 def _sympy_ (self ):
13471351 import sympy
1348- return sympy.Dummy(str ( self )[ 1 :] )
1352+ return sympy.Dummy(name = self .name, dummy_index = self .dummy_index )
13491353
13501354 @property
13511355 def is_Dummy (self ):
@@ -1355,6 +1359,12 @@ cdef class Dummy(Symbol):
13551359 def func (self ):
13561360 return self .__class__
13571361
1362+ @property
1363+ def dummy_index (self ):
1364+ cdef RCP[const symengine.Dummy] this = \
1365+ symengine.rcp_static_cast_Dummy(self .thisptr)
1366+ cdef size_t index = deref(this).get_index()
1367+ return index
13581368
13591369def symarray (prefix , shape , **kwargs ):
13601370 """ Creates an nd-array of symbols
Original file line number Diff line number Diff line change 22from symengine .test_utilities import raises
33import unittest
44import platform
5-
5+ import sympy
66
77def test_symbol ():
88 x = Symbol ("x" )
@@ -156,6 +156,7 @@ def test_dummy():
156156 x2 = Symbol ('x' )
157157 xdummy1 = Dummy ('x' )
158158 xdummy2 = Dummy ('x' )
159+ assert xdummy1 .dummy_index != xdummy2 .dummy_index # maybe test using "less than"?
159160
160161 assert x1 == x2
161162 assert x1 != xdummy1
You can’t perform that action at this time.
0 commit comments