Skip to content

Commit 636fd7a

Browse files
committed
Merge pull request #17 from cfbaptista/patch-1
devectorise 'poly' for better performance
2 parents 57d1be9 + 7ba219f commit 636fd7a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Polynomials.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ function poly{T}(r::AbstractVector{T}, var=:x)
305305
c = zeros(T, n+1)
306306
c[1] = 1
307307
for j = 1:n
308-
c[2:j+1] = c[2:j+1]-r[j]*c[1:j]
308+
for i = j:-1:1
309+
c[i+1] = c[i+1]-r[j]*c[i]
310+
end
309311
end
310312
return Poly(reverse(c), var)
311313
end

0 commit comments

Comments
 (0)