Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More efficient methods for Eye, Fill, Diagonal, etc. #44

Open
jlapeyre opened this issue Dec 1, 2018 · 6 comments
Open

More efficient methods for Eye, Fill, Diagonal, etc. #44

jlapeyre opened this issue Dec 1, 2018 · 6 comments

Comments

@jlapeyre
Copy link
Contributor

jlapeyre commented Dec 1, 2018

I have collected several such methods here: https://github.com/jlapeyre/IdentityMatrix.jl.

All the methods included show significantly reduced benchmark times. (I have not posted the times yet) Despite the name of the module there are methods for types other than Eye. For instance an efficient method for kron(::AbstractMatrix, ::Diagonal) is almost as fast as one specialized for Eye.

Most of this stuff could be made into PRs to FillArrays.jl and LinearAlgebra.

I don't want to go much further before checking if there are other plans underway.

Also, there is some redundancy of methods with UniformScaling, which might be fixed with some refactoring or traits or the like.

@dlfivefifty
Copy link
Member

Cool! A PR would certainly be welcomed.

@jlapeyre
Copy link
Contributor Author

jlapeyre commented Dec 1, 2018

Great. A practical question. This could be bunch of small PRs, all to the same file. Should I make a branch for each feature from master, or a branch for feature B from the branch from feature A, or ... ?

@dlfivefifty
Copy link
Member

It shouldn't matter either way because I'll "squash and merge", so whatever is easiest for you.

@jlapeyre
Copy link
Contributor Author

jlapeyre commented Dec 1, 2018

Ok, I'll give it shot.

@ararslan
Copy link
Member

ararslan commented Jan 3, 2019

@jlapeyre, any updates on this?

@jlapeyre
Copy link
Contributor Author

jlapeyre commented Jan 4, 2019

Yes. So, some of the work mentioned above I have done. Here are the relevant PRs that have been merged to FillArrays.

Some of the inefficiencies are better addressed elsewhere. This PR to LinearAlgebra has been merged: JuliaLang/julia#30232. The corresponding PR for FillArrays has been merged. But, the improvement over julia#30232 (at least for what I tested) is very slight. One could argue its not worth the code complexity.

These PRs to LinearAlgebra still need some work: JuliaLang/julia#30236, JuliaLang/julia#30235

I also found that keeping track of which method is being called was a headache. So I wrote this: https://github.com/jlapeyre/MethodInSrc.jl. I'd like to apply it to other modules or base/stdlib to see if it turns up muddled tests.

There are other possible PRs that I did not yet make, for various reasons. At this point, mainly lack of time. I also made earlier, unrelated PRs that are languishing and need attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants