Skip to content

Commit 9d4b5f1

Browse files
authored
Merge pull request #242 from JuliaCI/an/sparsesolves
Add some benchmarks for sparse solves
2 parents 22b0153 + 82408a1 commit 9d4b5f1

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/sparse/SparseBenchmarks.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,44 @@ else
370370
g["adjoint"] = @benchmarkable At_mul_B(A, B)
371371
end
372372

373+
#################
374+
# sparse solves #
375+
#################
376+
g = addgroup!(SUITE, "sparse solves")
377+
# Problem similar to issue #30288
378+
let m = 10000, n = 9000
379+
A = spdiagm(0 => fill(2.0, m),
380+
-1 => fill(1.0, m - 1),
381+
1 => fill(1.0, m - 1),
382+
360 => fill(1.0, m - 360))[:, 1:n]
383+
AtA = A'A
384+
b = ones(m)
385+
B = ones(m, 2)
386+
Atb = A'b
387+
AtB = A'B
388+
389+
g["least squares (default), vector rhs"] = @benchmarkable $A\$b
390+
g["least squares (default), matrix rhs"] = @benchmarkable $A\$B
391+
if VERSION >= v"0.7.0-DEV.5211"
392+
g["least squares (qr), vector rhs"] = @benchmarkable qr($A)\$b
393+
g["least squares (qr), matrix rhs"] = @benchmarkable qr($A)\$B
394+
else
395+
g["least squares (qr), vector rhs"] = @benchmarkable qrfact($A)\$b
396+
g["least squares (qr), matrix rhs"] = @benchmarkable qrfact($A)\$B
397+
end
398+
g["square system (default), vector rhs"] = @benchmarkable $AtA\$Atb
399+
g["square system (default), matrix rhs"] = @benchmarkable $AtA\$AtB
400+
if VERSION >= v"0.7.0-DEV.5211"
401+
g["square system (ldlt), vector rhs"] = @benchmarkable ldlt($AtA)\$Atb
402+
g["square system (ldlt), matrix rhs"] = @benchmarkable ldlt($AtA)\$AtB
403+
g["square system (lu), vector rhs"] = @benchmarkable lu($AtA)\$Atb
404+
g["square system (lu), matrix rhs"] = @benchmarkable lu($AtA)\$AtB
405+
else
406+
g["square system (ldlt), vector rhs"] = @benchmarkable ldltfact($AtA)\$Atb
407+
g["square system (ldlt), matrix rhs"] = @benchmarkable ldltfact($AtA)\$AtB
408+
g["square system (lu), vector rhs"] = @benchmarkable lufact($AtA)\$Atb
409+
g["square system (lu), matrix rhs"] = @benchmarkable lufact($AtA)\$AtB
410+
end
411+
end
412+
373413
end # module

0 commit comments

Comments
 (0)