@@ -134,17 +134,17 @@ promote_symtype(::typeof(rem2pi), T::Type{<:Number}, mode) = T
134
134
135
135
error_f_symbolic (f, T) = error (" $f is not defined for $T ." )
136
136
137
- function Base. rem2pi (x:: Symbolic , mode:: Base.RoundingMode )
137
+ function Base. rem2pi (x:: BasicSymbolic , mode:: Base.RoundingMode )
138
138
T = symtype (x)
139
139
T <: Number ? term (rem2pi, x, mode) : error_f_symbolic (rem2pi, T)
140
140
end
141
141
142
142
# Specially handle inv and literal pow
143
- function Base. inv (x:: Symbolic )
143
+ function Base. inv (x:: BasicSymbolic )
144
144
T = symtype (x)
145
145
T <: Number ? Base.:^ (x, - 1 ) : error_f_symbolic (rem2pi, T)
146
146
end
147
- function Base. literal_pow (:: typeof (^ ), x:: Symbolic , :: Val{p} ) where {p}
147
+ function Base. literal_pow (:: typeof (^ ), x:: BasicSymbolic , :: Val{p} ) where {p}
148
148
T = symtype (x)
149
149
T <: Number ? Base.:^ (x, p) : error_f_symbolic (^ , T)
150
150
end
@@ -159,20 +159,20 @@ for f in monadic
159
159
@eval promote_symtype (:: $ (typeof (f)), T:: Type{<:LiteralRealImpl} ) = LiteralReal
160
160
end
161
161
162
- Base.:* (a:: AbstractArray , b:: Symbolic {<:Number} ) = map (x-> x* b, a)
163
- Base.:* (a:: Symbolic {<:Number} , b:: AbstractArray ) = map (x-> a* x, b)
162
+ Base.:* (a:: AbstractArray , b:: BasicSymbolic {<:Number} ) = map (x-> x* b, a)
163
+ Base.:* (a:: BasicSymbolic {<:Number} , b:: AbstractArray ) = map (x-> a* x, b)
164
164
165
165
for f in [identity, one, zero, * , + , - ]
166
166
@eval promote_symtype (:: $ (typeof (f)), T:: Type{<:Number} ) = T
167
167
end
168
168
169
169
promote_symtype (:: typeof (Base. real), T:: Type{<:Number} ) = Real
170
- Base. real (s:: Symbolic {<:Number} ) = islike (s, Real) ? s : term (real, s)
170
+ Base. real (s:: BasicSymbolic {<:Number} ) = islike (s, Real) ? s : term (real, s)
171
171
promote_symtype (:: typeof (Base. conj), T:: Type{<:Number} ) = T
172
- Base. conj (s:: Symbolic {<:Number} ) = islike (s, Real) ? s : term (conj, s)
172
+ Base. conj (s:: BasicSymbolic {<:Number} ) = islike (s, Real) ? s : term (conj, s)
173
173
promote_symtype (:: typeof (Base. imag), T:: Type{<:Number} ) = Real
174
- Base. imag (s:: Symbolic {<:Number} ) = islike (s, Real) ? zero (symtype (s)) : term (imag, s)
175
- Base. adjoint (s:: Symbolic {<:Number} ) = conj (s)
174
+ Base. imag (s:: BasicSymbolic {<:Number} ) = islike (s, Real) ? zero (symtype (s)) : term (imag, s)
175
+ Base. adjoint (s:: BasicSymbolic {<:Number} ) = conj (s)
176
176
177
177
178
178
# # Booleans
@@ -186,29 +186,29 @@ for (f, Domain) in [(==) => Number, (!=) => Number,
186
186
xor => Bool]
187
187
@eval begin
188
188
promote_symtype (:: $ (typeof (f)), :: Type{<:$Domain} , :: Type{<:$Domain} ) = Bool
189
- (:: $ (typeof (f)))(a:: Symbolic {<:$Domain} , b:: $Domain ) = term ($ f, a, b, type= Bool)
190
- (:: $ (typeof (f)))(a:: Symbolic {<:$Domain} , b:: Symbolic {<:$Domain} ) = term ($ f, a, b, type= Bool)
191
- (:: $ (typeof (f)))(a:: $Domain , b:: Symbolic {<:$Domain} ) = term ($ f, a, b, type= Bool)
189
+ (:: $ (typeof (f)))(a:: BasicSymbolic {<:$Domain} , b:: $Domain ) = term ($ f, a, b, type= Bool)
190
+ (:: $ (typeof (f)))(a:: BasicSymbolic {<:$Domain} , b:: BasicSymbolic {<:$Domain} ) = term ($ f, a, b, type= Bool)
191
+ (:: $ (typeof (f)))(a:: $Domain , b:: BasicSymbolic {<:$Domain} ) = term ($ f, a, b, type= Bool)
192
192
end
193
193
end
194
194
195
195
for f in [! , ~ ]
196
196
@eval begin
197
197
promote_symtype (:: $ (typeof (f)), :: Type{<:Bool} ) = Bool
198
- (:: $ (typeof (f)))(s:: Symbolic {Bool} ) = Term {Bool} (! , [s])
198
+ (:: $ (typeof (f)))(s:: BasicSymbolic {Bool} ) = Term {Bool} (! , [s])
199
199
end
200
200
end
201
201
202
202
203
203
# An ifelse node
204
- function Base. ifelse (_if:: Symbolic {Bool} , _then, _else)
204
+ function Base. ifelse (_if:: BasicSymbolic {Bool} , _then, _else)
205
205
Term {Union{symtype(_then), symtype(_else)}} (ifelse, Any[_if, _then, _else])
206
206
end
207
207
promote_symtype (:: typeof (ifelse), _, :: Type{T} , :: Type{S} ) where {T,S} = Union{T, S}
208
208
209
209
# Array-like operations
210
- Base. size (x:: Symbolic {<:Number} ) = ()
211
- Base. length (x:: Symbolic {<:Number} ) = 1
212
- Base. ndims (x:: Symbolic {T} ) where {T} = Base. ndims (T)
213
- Base. ndims (:: Type{<:Symbolic {T}} ) where {T} = Base. ndims (T)
214
- Base. broadcastable (x:: Symbolic {T} ) where {T<: Number } = Ref (x)
210
+ Base. size (x:: BasicSymbolic {<:Number} ) = ()
211
+ Base. length (x:: BasicSymbolic {<:Number} ) = 1
212
+ Base. ndims (x:: BasicSymbolic {T} ) where {T} = Base. ndims (T)
213
+ Base. ndims (:: Type{<:BasicSymbolic {T}} ) where {T} = Base. ndims (T)
214
+ Base. broadcastable (x:: BasicSymbolic {T} ) where {T<: Number } = Ref (x)
0 commit comments