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

JuliaLang / julia / #37752
77%

Build:
DEFAULT BRANCH: master
Ran 18 Apr 2024 11:42AM UTC
Jobs 1
Files 361
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

18 Apr 2024 06:13AM UTC coverage: 87.412% (+1.8%) from 85.596%
#37752

push

local

web-flow
stdlib: faster kronecker product between hermitian and symmetric matrices (#53186)

The kronecker product between complex hermitian matrices is again
hermitian, so it can be computed much faster by only doing the upper (or
lower) triangular. As @andreasnoack will surely notice, this only true
for types where `conj(a*b) == conj(a)*conj(b)`, so I'm restricting the
function to act only on real and complex numbers. In the symmetric case,
however, no additional assumption is needed, so I'm letting it act on
anything.

Benchmarking showed that the code is roughly 2 times as fast as the
vanilla kronecker product, as expected. The fastest case was always the
UU case, and the slowest the LU case. The code I used is below
```julia
using LinearAlgebra
using BenchmarkTools
using Quaternions

randrmatrix(d, uplo = :U) = Hermitian(randn(Float64, d, d), uplo)
randcmatrix(d, uplo = :U) = Hermitian(randn(ComplexF64, d, d), uplo)
randsmatrix(d, uplo = :U) = Symmetric(randn(ComplexF64, d, d), uplo)
randqmatrix(d, uplo = :U) = Symmetric(randn(QuaternionF64, d, d), uplo)

dima = 69
dimb = 71
for randmatrix in [randrmatrix, randcmatrix, randsmatrix, randqmatrix]
    for auplo in [:U, :L]
        for buplo in [:U, :L]
            a = randmatrix(dima, auplo)
            b = randmatrix(dimb, buplo)
            c = kron(a,b)
            therm = @belapsed kron!($c, $a, $b)
            C = Matrix(c)
            A = Matrix(a)
            B = Matrix(b)
            told = @belapsed kron!($C, $A, $B)
            @show told/therm
        end
    end
end
```
Weirdly enough, I got this expected speedup in one of my machines, but
when running the benchmark in another I got roughly the same time. I
guess that's a bug with `BechmarkTools`, because that's not consistent
with the times I get running the functions individually, out of the
loop.

Another issue is that although I added a couple of tests, I couldn't get
them to run. Perhaps someone here can tell me what's going on? I could
run ... (continued)

170 of 172 new or added lines in 3 files covered. (98.84%)

72 existing lines in 8 files now uncovered.

76197 of 87170 relevant lines covered (87.41%)

15863283.27 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
96.78
0.32% stdlib/LinearAlgebra/src/symmetric.jl

Uncovered Existing Lines

Lines Coverage ∆ File
1
90.91
44.66% stdlib/Random/src/generation.jl
1
79.92
-0.21% stdlib/FileWatching/src/FileWatching.jl
1
96.12
-0.17% stdlib/LinearAlgebra/src/diagonal.jl
2
92.96
4.55% base/floatfuncs.jl
3
75.0
-2.21% base/stat.jl
4
76.58
-0.19% base/loading.jl
30
88.75
1.06% base/iobuffer.jl
30
92.32
0.13% base/compiler/abstractinterpretation.jl
Jobs
ID Job ID Ran Files Coverage
1 #37752.1 18 Apr 2024 11:42AM UTC 361
87.41
Source Files on build #37752
  • Tree
  • List 361
  • Changed 277
  • Source Changed 0
  • Coverage Changed 72
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • c741bd3d 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