@@ -12,7 +12,7 @@ export degree, coeffs, variable
12
12
export polyval, polyint, polyder, roots, polyfit
13
13
export Pade, padeval
14
14
15
- import Base: start, next, done, length, size, eltype
15
+ import Base: start, next, done, length, size, eltype, collect
16
16
import Base: endof, getindex, setindex!, copy, zero, one, convert, norm, gcd
17
17
import Base: show, print, * , / , // , - , + , == , isapprox, divrem, div, rem, eltype
18
18
import Base: promote_rule, truncate, chop, conj, transpose, dot, hash
@@ -134,7 +134,8 @@ convert{T, S<:Number}(::Type{Poly{T}}, x::S, var::SymbolLike=:x) = Poly(T[x], va
134
134
convert {T, S<:Number} (:: Type{Poly{T}} , x:: AbstractArray{S} , var:: SymbolLike = :x ) = map (el-> Poly (T[el],var), x)
135
135
promote_rule {T, S} (:: Type{Poly{T}} , :: Type{Poly{S}} ) = Poly{promote_type (T, S)}
136
136
promote_rule {T, S<:Number} (:: Type{Poly{T}} , :: Type{S} ) = Poly{promote_type (T, S)}
137
- eltype {T} (:: Poly{T} ) = Poly{T}
137
+ # Check JuliaLang/METADATA.jl#8528
138
+ eltype {T} (:: Poly{T} ) = T
138
139
139
140
length (p:: Poly ) = length (coeffs (p))
140
141
endof (p:: Poly ) = length (p) - 1
@@ -144,6 +145,9 @@ next(p::Poly, state) = (temp = zeros(coeffs(p)); temp[state+1] = p[state]; (Pol
144
145
done (p:: Poly , state) = state > degree (p)
145
146
eltype {T} (:: Type{Poly{T}} ) = Poly{T}
146
147
148
+ # shortcut for collect(eltype, collection)
149
+ collect {T} (p:: Poly{T} ) = collect (Poly{T}, p)
150
+
147
151
size (p:: Poly ) = size (p. a)
148
152
size (p:: Poly , i:: Integer ) = size (p. a, i)
149
153
0 commit comments