• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #37939
77%

Build:
DEFAULT BRANCH: master
Ran 21 Oct 2024 10:48AM UTC
Jobs 1
Files 362
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

21 Oct 2024 06:01AM UTC coverage: 87.654% (+0.009%) from 87.645%
#37939

push

local

web-flow
Reroute` (Upper/Lower)Triangular * Diagonal` through `__muldiag` (#55984)

Currently, `::Diagonal * ::AbstractMatrix` calls the method
`LinearAlgebra.__muldiag!` in general that scales the rows, and
similarly for the diagonal on the right. The implementation of
`__muldiag` was duplicating the logic in `LinearAlgebra.modify!` and the
methods for `MulAddMul`. This PR replaces the various branches with
calls to `modify!` instead. I've also extracted the multiplication logic
into its own function `__muldiag_nonzeroalpha!` so that this may be
specialized for matrix types, such as triangular ones.

Secondly, `::Diagonal * ::UpperTriangular` (and similarly, other
triangular matrices) was specialized to forward the multiplication to
the parent of the triangular. For strided matrices, however, it makes
more sense to use the structure and scale only the filled half of the
matrix. Firstly, this improves performance, and secondly, this avoids
errors in case the parent isn't fully initialized corresponding to the
structural zero elements.

Performance improvement:
```julia
julia> D = Diagonal(1:400);

julia> U = UpperTriangular(zeros(size(D)));

julia> @btime $D * $U;
  314.944 μs (3 allocations: 1.22 MiB) # v"1.12.0-DEV.1288"
  195.960 μs (3 allocations: 1.22 MiB) # This PR
```
Fix:
```julia
julia> M = Matrix{BigFloat}(undef, 2, 2);

julia> M[1,1] = M[2,2] = M[1,2] = 3;

julia> U = UpperTriangular(M)
2×2 UpperTriangular{BigFloat, Matrix{BigFloat}}:
 3.0  3.0
  ⋅   3.0

julia> D = Diagonal(1:2);

julia> U * D # works after this PR
2×2 UpperTriangular{BigFloat, Matrix{BigFloat}}:
 3.0  6.0
  ⋅   6.0
```

63 of 63 new or added lines in 2 files covered. (100.0%)

80 existing lines in 7 files now uncovered.

79179 of 90331 relevant lines covered (87.65%)

17146814.57 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
81.15
-0.31% base/promotion.jl
1
90.91
-0.41% stdlib/Random/src/generation.jl
1
98.7
0.43% base/bitset.jl
1
94.74
-0.09% base/array.jl
1
96.7
-0.27% base/strings/util.jl
32
71.2
1.31% base/genericmemory.jl
43
81.36
-0.05% stdlib/REPL/src/REPL.jl
Jobs
ID Job ID Ran Files Coverage
1 #37939.1 21 Oct 2024 10:48AM UTC 362
87.65
Source Files on build #37939
  • Tree
  • List 362
  • Changed 254
  • Source Changed 0
  • Coverage Changed 12
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 04259daf on github
  • Prev Build on master
  • Next Build on master
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc