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

Specialized Tridiagonal * Diagonal products #73

Closed
jlperla opened this issue Mar 13, 2019 · 2 comments
Closed

Specialized Tridiagonal * Diagonal products #73

jlperla opened this issue Mar 13, 2019 · 2 comments
Assignees

Comments

@jlperla
Copy link
Member

jlperla commented Mar 13, 2019

See JuliaLang/julia#28883 and all of the PRs/issues it references (also, perhaps JuliaLang/LinearAlgebra.jl#562 is relevant, though not sure).

In particular, the ones that come up with this package frequently are:

  • Diagonal * Tridiagonal
  • Tridiagonal * Diagonal

With Julia 1.1 at least, you can see that Diagonal * Tridiagonal -> Sparse, which is a fallback we don't want.

julia> using LinearAlgebra

julia> A = Tridiagonal(rand(2), rand(3), rand(2))
3×3 Tridiagonal{Float64,Array{Float64,1}}:
 0.651845  0.692459   
 0.571598  0.955736  0.929357
          0.460634  0.948893

julia> D = Diagonal(rand(3))
3×3 Diagonal{Float64,Array{Float64,1}}:
 0.235908            
          0.351151   
                   0.242416

julia> A * D
3×3 SparseArrays.SparseMatrixCSC{Float64,Int64} with 7 stored entries:
  [1, 1]  =  0.153776
  [2, 1]  =  0.134845
  [1, 2]  =  0.243158
  [2, 2]  =  0.335608
  [3, 2]  =  0.161752
  [2, 3]  =  0.225291
  [3, 3]  =  0.230026

This should be efficiently done as a tridiagonal instead.

@jlperla jlperla changed the title Check and fill in specialized matrix products Specialized Tridiagonal * Diagonal products Mar 13, 2019
@arnavs arnavs self-assigned this Mar 13, 2019
@mcognetta
Copy link

I have opened a PR to fix this: JuliaLang/julia#31889

If there are any others of a similar flair, I would be happy to help with them.

@jlperla
Copy link
Member Author

jlperla commented May 1, 2019

@mcognetta Spectacular. Thanks so much.

At this point, I am not aware of any others we have run into with this code. But while you are in the zone, consider asking @dlfivefifty if there are any specialized operations on https://github.com/JuliaMatrices/BandedMatrices.jl that need implementation.

@jlperla jlperla closed this as completed May 1, 2019
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