Speicalize copy! for triangular, and use copy! in ldiv
#1263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, we specialize
copyto!for a triangular source. However, this has two branches, depending on whether the axes match. In the branch where the axes do match, we may usecopy!instead, and specialize this in terms of the internal_copyto!which is identical in implementation.We also use
copy!inldivinstead ofcopyto!. These should be equivalent in most cases, barring one extra axes check incopy!, as the fallback method forcopy!callscopyto!internally. However, the advantage comes for triangular matrices, wherecopy!doesn't have branches, as the axes necessarily match.As a consequence, this reduces the TTFX in operations like
I've renamed the internal functions as
_copyto!->_copy!andcopyto_unaliased!->copy_unaliased!, as these are closer to the meaning ofcopy!than tocopyto!.