Skip to content
New issue

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

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

Already on GitHub? # to your account

Can't invert Diagonal{Int, InfUnitRange} #176

Closed
DanielVandH opened this issue Jun 17, 2024 · 0 comments · Fixed by #177
Closed

Can't invert Diagonal{Int, InfUnitRange} #176

DanielVandH opened this issue Jun 17, 2024 · 0 comments · Fixed by #177

Comments

@DanielVandH
Copy link
Contributor

julia> using InfiniteArrays, LinearAlgebra

julia> A = Diagonal(1:∞)
ℵ₀×ℵ₀ Diagonal{Int64, InfiniteArrays.InfUnitRange{Int64}} with indices OneToInf()×OneToInf():
 1                                                                                              
   2                                                                                             
     3                                                                                      
       4                                                                                    
         5                                                                                  
           6                                                                                  
             7                                                                              
                                                                                                                                 

julia> inv(A) # hangs because it hits the finite method
ERROR: InterruptException:
Stacktrace:
 [1] _vec_resizedata!(B::LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Zeros{Float64, 1, Tuple{…}}}, n::Int64)
   @ LazyArrays C:\Users\User\.julia\packages\LazyArrays\MLFsy\src\cache.jl:230
 [2] resizedata!
   @ C:\Users\User\.julia\packages\LazyArrays\MLFsy\src\cache.jl:251 [inlined]
 [3] resizedata!
   @ C:\Users\User\.julia\packages\LazyArrays\MLFsy\src\cache.jl:218 [inlined]
 [4] setindex!
   @ C:\Users\User\.julia\packages\LazyArrays\MLFsy\src\cache.jl:82 [inlined]
 [5] inv(D::Diagonal{Int64, InfiniteArrays.InfUnitRange{Int64}})
   @ LinearAlgebra C:\Users\User\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\LinearAlgebra\src\diagonal.jl:722
 [6] top-level scope
   @ REPL[11]:1
Some type information was truncated. Use `show(err)` to see complete types.

julia> Diagonal(inv.(A.diag))
ℵ₀×ℵ₀ Diagonal{Float64, LazyArrays.BroadcastVector{Float64, typeof(inv), Tuple{InfiniteArrays.InfUnitRange{Int64}}}} with indices OneToInf()×OneToInf():
 1.0                                                                                                                    
     0.5                                                                                                           
         0.333333                                                                                                  
                  0.25                                                                                             
                       0.2                                                                                               
                           0.166667                                                                                   
                                    0.142857                                                                       
                                                                                                                                         
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant