-
Notifications
You must be signed in to change notification settings - Fork 7
Suppport Diagonal block times padded #66
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
Conversation
The ones() thing was just an example. For the application I have in mind the multiplication would be between a block diagonal operator and a block vector, in the language of HarmonicOrthogonalPolynomials this is basically what |
Ok so that seems close to my example, so hopefully it’ll work 🤞 |
I can work with it as it is now with with a minor workaround, so there is no rush to get this completely ironed out. As it is, I'm seeing what appears to be two different kinds of errors now. Your example of julia> D*ones(∞)
ERROR: LoadError: ArgumentError: Cannot create infinite Array
Stacktrace:
[1] Vector{Vector{Float64}}(#unused#::UndefInitializer, #unused#::Tuple{InfiniteArrays.Infinity})
@ InfiniteArrays ~/.julia/packages/InfiniteArrays/YDweO/src/infarrays.jl:19
[2] _BlockArray(#unused#::Type{Vector{Vector{Float64}}}, baxes::Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}})
@ BlockArrays ~/.julia/packages/BlockArrays/Ssbrg/src/blockarray.jl:92
[3] macro expansion
@ ~/.julia/packages/BlockArrays/Ssbrg/src/blockarray.jl:126 [inlined]
[4] initialized_blocks_BlockArray(#unused#::Type{Vector{Vector{Float64}}}, baxes::Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}})
@ BlockArrays ~/.julia/packages/BlockArrays/Ssbrg/src/blockarray.jl:124
[5] BlockArray
@ ~/.julia/packages/BlockArrays/Ssbrg/src/blockarray.jl:140 [inlined]
[6] similar
@ ~/.julia/packages/BlockArrays/Ssbrg/src/blockarray.jl:354 [inlined]
[7] similar(a::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}, #unused#::Type{Float64})
@ BlockArrays ~/.julia/packages/BlockArrays/Ssbrg/src/abstractblockarray.jl:37
[8] AbstractVector{Float64}(A::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}})
@ Base ./array.jl:541
[9] convert(#unused#::Type{AbstractVector{Float64}}, a::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}})
@ Base ./abstractarray.jl:16
[10] copy_oftype(A::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}, #unused#::Type{Float64})
@ LinearAlgebra /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/LinearAlgebra.jl:350
[11] broadcasted(#unused#::BlockArrays.BlockStyle{1}, #unused#::typeof(*), a::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}, b::Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}})
@ BlockArrays ~/.julia/packages/BlockArrays/Ssbrg/src/blockbroadcast.jl:292
[12] broadcasted
@ ./broadcast.jl:1313 [inlined]
[13] broadcast(::typeof(*), ::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}, ::Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}})
@ Base.Broadcast ./broadcast.jl:821
[14] layout_broadcasted(#unused#::BlockArrays.BlockLayout{LazyArrays.BroadcastLayout{Type{Fill}}, ArrayLayouts.FillLayout}, #unused#::LazyArrays.CachedLayout{ArrayLayouts.DenseColumnMajor, ArrayLayouts.OnesLayout}, op::Function, A::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}, B::LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}})
@ LazyArrays ~/.julia/packages/LazyArrays/6zNYO/src/cache.jl:280
[15] layout_broadcasted(op::Function, A::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}, B::LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}})
@ LazyArrays ~/.julia/packages/LazyArrays/6zNYO/src/cache.jl:297
[16] broadcasted(#unused#::LazyArrays.LazyArrayStyle{1}, op::Function, A::BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}, B::LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}})
@ LazyArrays ~/.julia/packages/LazyArrays/6zNYO/src/cache.jl:301
[17] broadcasted
@ ./broadcast.jl:1313 [inlined]
[18] copy(M::ArrayLayouts.Lmul{ArrayLayouts.DiagonalLayout{BlockArrays.BlockLayout{LazyArrays.BroadcastLayout{Type{Fill}}, ArrayLayouts.FillLayout}}, LazyArrays.CachedLayout{ArrayLayouts.DenseColumnMajor, ArrayLayouts.OnesLayout}, Diagonal{Int64, BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}}, LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}})
@ ArrayLayouts ~/.julia/packages/ArrayLayouts/ATRic/src/diagonal.jl:20
[19] copy(M::Mul{ArrayLayouts.DiagonalLayout{BlockArrays.BlockLayout{LazyArrays.BroadcastLayout{Type{Fill}}, ArrayLayouts.FillLayout}}, LazyArrays.CachedLayout{ArrayLayouts.DenseColumnMajor, ArrayLayouts.OnesLayout}, Diagonal{Int64, BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}}, LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}})
@ ArrayLayouts ~/.julia/packages/ArrayLayouts/ATRic/src/mul.jl:108
[20] materialize(M::Mul{ArrayLayouts.DiagonalLayout{BlockArrays.BlockLayout{LazyArrays.BroadcastLayout{Type{Fill}}, ArrayLayouts.FillLayout}}, LazyArrays.CachedLayout{ArrayLayouts.DenseColumnMajor, ArrayLayouts.OnesLayout}, Diagonal{Int64, BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}}, LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}})
@ ArrayLayouts ~/.julia/packages/ArrayLayouts/ATRic/src/mul.jl:105
[21] mul
@ ~/.julia/packages/ArrayLayouts/ATRic/src/mul.jl:106 [inlined]
[22] *(A::Diagonal{Int64, BlockVector{Int64, BroadcastVector{Fill{Int64, 1, Tuple{OneTo{Int64}}}, Type{Fill}, Tuple{BroadcastVector{Int64, typeof(-), Tuple{InfiniteArrays.InfStepRange{Int64, Int64}, BroadcastVector{Int64, typeof(Base.literal_pow), Tuple{Base.RefValue{typeof(^)}, InfiniteArrays.InfUnitRange{Int64}, Base.RefValue{Val{2}}}}}}, InfiniteArrays.InfStepRange{Int64, Int64}}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, InfiniteArrays.InfStepRange{Int64, Int64}}}}}}, B::LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}})
@ ArrayLayouts ~/.julia/packages/ArrayLayouts/ATRic/src/mul.jl:135
[23] top-level scope |
Codecov Report
@@ Coverage Diff @@
## master #66 +/- ##
==========================================
+ Coverage 66.38% 66.70% +0.31%
==========================================
Files 9 9
Lines 940 949 +9
==========================================
+ Hits 624 633 +9
Misses 316 316
Continue to review full report at Codecov.
|
@TSGut this is done, for now. There is an issue with x̃ = PseudoBlockArray(x, (axes(D,1),))
D * x̃ that it is left lazy, whereas There's an easy work around by overloading |
@TSGut with this the following works:
I can't do your example of
D * ones(∞)
because of another bug. Do you really need this right now or was it just a test problem?