@@ -13,10 +13,11 @@ export polyval, polyint, polyder, roots, polyfit
1313export Pade, padeval
1414
1515import Base: start, next, done, length, size, eltype, collect, eachindex
16- import Base: endof, getindex, setindex!, copy, zero, one, convert, norm, gcd
16+ import Base: endof, getindex, setindex!, copy, zero, one, convert, gcd
1717import Base: show, print, * , / , // , - , + , == , isapprox, divrem, div, rem, eltype
18- import Base: promote_rule, truncate, chop, conj, transpose, dot, hash
18+ import Base: promote_rule, truncate, chop, conj, transpose, hash
1919import Base: isequal
20+ import Compat. LinearAlgebra: norm, dot, eigvals, diagm, vecnorm, qrfact
2021
2122const SymbolLike = Union{AbstractString,Char,Symbol}
2223
@@ -79,7 +80,8 @@ struct Poly{T}
7980 return new {T} (zeros (T,1 ),Symbol (var))
8081 else
8182 # determine the last nonzero element and truncate a accordingly
82- a_last = max (1 ,findlast (x-> x!= zero (T), a))
83+ last_nz = findlast (! iszero, a)
84+ a_last = max (1 , last_nz === nothing ? 0 : last_nz)
8385 new {T} (a[1 : a_last], Symbol (var))
8486 end
8587 end
0 commit comments