Skip to content

Commit bf295af

Browse files
dkarraschjverzani
andauthored
Replace inefficient broadcast with copyto! (#438)
* Replace inefficient broadcast with `copyto!` * Update src/polynomials/ngcd.jl Co-authored-by: Daniel Karrasch <[email protected]> Co-authored-by: john verzani <[email protected]>
1 parent ad781ef commit bf295af

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/polynomials/ngcd.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ function ngcd(p::PnPolynomial{T,X},
266266

267267
nr, nc = size(Sₓ) # m+1, m-n+2
268268
F = qr(Sₓ)
269-
Q[1:nr, 1:nr] .= F.Q
269+
dest = view(Q, 1:nr, 1:nr)
270+
copyto!(dest, I)
271+
lmul!(F.Q, dest)
270272
R[1:nc, 1:nc] .= F.R
271273

272274
# tolerances

0 commit comments

Comments
 (0)