From b2058da0b05a0b28be8a5064e54e7f2da92cbdae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Wed, 23 Oct 2024 14:34:10 +0200 Subject: [PATCH] Skip deepcopy in addmul! in case of aliasing --- src/Sparse/Row.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Sparse/Row.jl b/src/Sparse/Row.jl index b4e08c7161..0f9d5cd882 100644 --- a/src/Sparse/Row.jl +++ b/src/Sparse/Row.jl @@ -839,10 +839,16 @@ function mul!(z::SRow{T}, c, y::SRow{T}) where T end function addmul!(z::SRow{T}, x::SRow{T}, y) where T + if z === x + return scale_row_right!(x, y+1) + end return add_right_scaled_row!(x, z, y) end function addmul!(z::SRow{T}, x, y::SRow{T}) where T + if z === x + return scale_row_left!(y, x+1) + end return add_left_scaled_row!(y, z, x) end