FillArrays.jl
FillArrays.jl copied to clipboard
Broadcasting rules for Diagonal AbstractFill
Define broadcasting rules so that structure-preserving operations involving a Diagonal
AbstractFill
do not allocate.
After this PR
julia> D = Diagonal(Fill(2,3))
3×3 Diagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}:
2 ⋅ ⋅
⋅ 2 ⋅
⋅ ⋅ 2
julia> D .+ D
3×3 Diagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}:
4 ⋅ ⋅
⋅ 4 ⋅
⋅ ⋅ 4
julia> D .* 2
3×3 Diagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}:
4 ⋅ ⋅
⋅ 4 ⋅
⋅ ⋅ 4
julia> D .^ 2
3×3 Diagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}:
4 ⋅ ⋅
⋅ 4 ⋅
⋅ ⋅ 4
Codecov Report
Merging #165 (bb36731) into master (aeb0aef) will increase coverage by
0.06%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #165 +/- ##
==========================================
+ Coverage 96.22% 96.29% +0.06%
==========================================
Files 4 4
Lines 636 647 +11
==========================================
+ Hits 612 623 +11
Misses 24 24
Impacted Files | Coverage Δ | |
---|---|---|
src/FillArrays.jl | 94.76% <100.00%> (ø) |
|
src/fillbroadcast.jl | 97.74% <100.00%> (+0.20%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update aeb0aef...bb36731. Read the comment docs.
Please add tests for non-structure preserving like D .+ 1
@jishnub do we want to finish this?
Perhaps this needs a re-think. I'll see if this can be done in LinearAlgebra
. Closing this for now. It's not breaking, so if needed, it can be opened again post 1.0