Skip to content

Commit

Permalink
add some benchmarks for sparse matrix construction (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored and ararslan committed Sep 7, 2017
1 parent ef99131 commit 5e3f6b9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/sparse/SparseBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,23 @@ for b in values(g)
b.params.time_tolerance = 0.3
end

################
# constructors #
################
g = addgroup!(SUITE, "constructors")

const UPLO = VERSION >= v"0.7.0-DEV.884" ? :U : true
for s in sizes
nz = floor(Int, 1e-4*s*s)
I = samerand(1:s, nz)
J = samerand(1:s, nz)
V = randvec(nz)
g["IV", s] = @benchmarkable sparsevec($I, $V)
g["IJV", s] = @benchmarkable sparse($I, $J, $V)
g["Diagonal", s] = @benchmarkable sparse($(Diagonal(randvec(s))))
g["Bidiagonal", s] = @benchmarkable sparse($(Bidiagonal(randvec(s), randvec(s-1), UPLO)))
g["Tridiagonal", s] = @benchmarkable sparse($(Tridiagonal(randvec(s-1), randvec(s), randvec(s-1))))
g["SymTridiagonal", s] = @benchmarkable sparse($(SymTridiagonal(randvec(s), randvec(s-1))))
end

end # module

0 comments on commit 5e3f6b9

Please sign in to comment.