LinearAlgebra traited matrix operations#48861
LinearAlgebra traited matrix operations#48861KlausC wants to merge 1 commit intoJuliaLang:masterfrom
Conversation
vchuravy
left a comment
There was a problem hiding this comment.
Very interesting idea!
In your mind would GPUArrays define it's own StorageType? Or would it also re-use DenseStorage?
| The concrete subtypes shall always contain a field named `data` keeping the | ||
| attributed object. | ||
| """ | ||
| abstract type AbstractStorageTrait{T} end |
There was a problem hiding this comment.
| abstract type AbstractStorageTrait{T} end | |
| abstract type AbstractStorageTrait{T} end | |
I am not fluent in It would define a trait A paradigmatic use is in JuliaSparse/SparseArrays.jl#354. |
|
This seems similar in some ways to https://github.com/JuliaLinearAlgebra/ArrayLayouts.jl. Do you envisage combining the two, such that the same traits may be used in both packages? |
There is the essential difference, that this PR tries to redirect the standard methods (All that can be managed inside |
|
We have moved the LinearAlgebra stdlib to an external repo: https://github.com/JuliaLang/LinearAlgebra.jl @KlausC If you think that this PR is still relevant, please open a new PR on the LinearAlgebra.jl repo. |
The functions
*,\forAbstractMatrixand[rl]mul!and[rl]div!for triangular matrices are equipped with an indirection trait, which allows to call specialized implementations, also if the type of the matrices is hidden for standard dispatch due to multiple wrappers.This is an effort to remedy the "Abstract Array Fallback Trap".
This PR does not introduce new behavior nor should it worsen runtime for the mentioned functions. But it allows other stdlibs or packages to use own implementations for selected subclasses of
AbstractMatrix(for exampleSparseArrays).