From bf295af9caddf88106b66900a8f6528a996b875a Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 29 Jul 2022 18:09:02 +0200 Subject: [PATCH] Replace inefficient broadcast with `copyto!` (#438) * Replace inefficient broadcast with `copyto!` * Update src/polynomials/ngcd.jl Co-authored-by: Daniel Karrasch Co-authored-by: john verzani --- src/polynomials/ngcd.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/polynomials/ngcd.jl b/src/polynomials/ngcd.jl index ec48949a..b54eeab7 100644 --- a/src/polynomials/ngcd.jl +++ b/src/polynomials/ngcd.jl @@ -266,7 +266,9 @@ function ngcd(p::PnPolynomial{T,X}, nr, nc = size(Sₓ) # m+1, m-n+2 F = qr(Sₓ) - Q[1:nr, 1:nr] .= F.Q + dest = view(Q, 1:nr, 1:nr) + copyto!(dest, I) + lmul!(F.Q, dest) R[1:nc, 1:nc] .= F.R # tolerances