-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Less restrictive copyto! signature for triangular matrices (#54649)
On nightly, `copyto!(A::T, B::T) where {T<:UpperTriangular}` checks for the types to be identical. This is overly restrictive, as we only need to check that they are both `UpperTriangular`. This PR relaxes this, which provides a significant performance boost for mismatched types. ```julia julia> using LinearAlgebra julia> A = UpperTriangular(rand(200,200)); B = UpperTriangular(view(rand(200,200),:,:)); julia> @Btime copyto!($A, $B); 44.878 μs (0 allocations: 0 bytes) # nightly v"1.12.0-DEV.641" 5.658 μs (0 allocations: 0 bytes) # this PR ``` This PR also changes the behavior when the source and the destination don't have the same size, in which case, `copyto!` should carry out a linear copy and not a Cartesian one, as per its docstring. The previous behavior may be obtained by calling ```julia copyto!(A, CartesianIndices(B), B, CartesianIndices(B)) ``` This change would mean that certain operations that used to work would error now, e.g.: ```julia julia> A = UpperTriangular(zeros(3,3)); B = UpperTriangular(rand(2,2)); julia> copyto!(A, B) ERROR: ArgumentError: cannot set index in the upper triangular part (3, 1) of an UpperTriangular matrix to a nonzero value (0.6898709830945821) ``` whereas this used to carry out a Cartesian copy previously. --------- Co-authored-by: Dilum Aluthge <[email protected]>
- Loading branch information
1 parent
5034e87
commit b8e714d
Showing
2 changed files
with
52 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b8e714d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Executing the daily package evaluation, I will reply here when finished:
@nanosoldier
runtests(isdaily = true)
b8e714d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.
b8e714d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nanosoldier
runbenchmarks(ALL, isdaily = true)
b8e714d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your job failed.
b8e714d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there was some process stuff left behind by that last OOM kill, so I just rebooted the machines to clear away any accumulating junk
@nanosoldier
runbenchmarks(ALL, isdaily = true)
b8e714d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.
b8e714d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all basic complex arithmetic is 3x slower, which is odd