File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -106,8 +106,25 @@ function get_class_from_id(id::UInt)
106106 str
107107end
108108
109+ # use value of `get_type` to index into a vector storing symbols
110+ function _get_symengine_classes ()
111+ d = Vector {Symbol} ()
112+ i = 0
113+ while true
114+ s = get_class_from_id (UInt (i))
115+ if s == " "
116+ break
117+ end
118+ push! (d, Symbol (s))
119+ i+= 1
120+ end
121+ return d
122+ end
123+
124+ const symengine_classes = _get_symengine_classes ()
125+
109126" Get SymEngine class of an object (e.g. 1=>:Integer, 1//2 =:Rational, sin(x) => :Sin, ..."
110- get_symengine_class (s:: Basic ) = Symbol ( get_class_from_id ( get_type (s)))
127+ get_symengine_class (s:: Basic ) = symengine_classes[ get_type (s) + 1 ]
111128
112129
113130# # Construct symbolic objects
194211# # and then
195212# # meth(x::BasicType{Val{:Integer}}) = ... or
196213# # meth(x::BasicNumber) = ...
197- mutable struct BasicType{T} <: Number
214+ struct BasicType{T} <: Number
198215 x:: Basic
199216end
200217
You can’t perform that action at this time.
0 commit comments