Skip to content

Commit 38c17b3

Browse files
committed
eltype, abstractvector
1 parent d414255 commit 38c17b3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Polynomials.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ p + q # ERROR: Polynomials must have same variable.
5959
immutable Poly{T}
6060
a::Vector{T}
6161
var::Symbol
62-
@compat function (::Type{Poly}){T<:Number}(a::Vector{T}, var::SymbolLike = :x)
62+
@compat function (::Type{Poly}){T<:Number}(a::AbstractVector{T}, var::SymbolLike = :x)
6363
# if a == [] we replace it with a = [0]
6464
if length(a) == 0
6565
return new{T}(zeros(T,1), @compat Symbol(var))
@@ -72,7 +72,7 @@ immutable Poly{T}
7272
end
7373

7474
Poly(n::Number, var::SymbolLike = :x) = Poly([n], var)
75-
@compat (::Type{Poly{T}}){T,S}(x::Vector{S}, var::SymbolLike = :x) =
75+
@compat (::Type{Poly{T}}){T,S}(x::AbstractVector{S}, var::SymbolLike = :x) =
7676
Poly(convert(Vector{T}, x), var)
7777

7878
# create a Poly object from its roots

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,4 @@ for term in p1
324324
end
325325

326326
@test eltype(typeof(p1)) == typeof(p1)
327+
@test length(collect(p1)) == degree(p1)+1

0 commit comments

Comments
 (0)