Skip to content

Commit

Permalink
Skip deepcopy in addmul! in case of aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Oct 25, 2024
1 parent ea21c55 commit 9ddf26e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Sparse/Row.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 843 in src/Sparse/Row.jl

View check run for this annotation

Codecov / codecov/patch

src/Sparse/Row.jl#L841-L843

Added lines #L841 - L843 were not covered by tests
end
return add_right_scaled_row!(x, z, y)

Check warning on line 845 in src/Sparse/Row.jl

View check run for this annotation

Codecov / codecov/patch

src/Sparse/Row.jl#L845

Added line #L845 was not covered by tests
end

function addmul!(z::SRow{T}, x, y::SRow{T}) where T
if z === x
return scale_row_left!(y, x+1)

Check warning on line 850 in src/Sparse/Row.jl

View check run for this annotation

Codecov / codecov/patch

src/Sparse/Row.jl#L848-L850

Added lines #L848 - L850 were not covered by tests
end
return add_left_scaled_row!(y, z, x)

Check warning on line 852 in src/Sparse/Row.jl

View check run for this annotation

Codecov / codecov/patch

src/Sparse/Row.jl#L852

Added line #L852 was not covered by tests
end

Expand Down

0 comments on commit 9ddf26e

Please sign in to comment.