Created
February 15, 2019 05:51
-
-
Save briochemc/5d3a046613428528be10307df04fb947 to your computer and use it in GitHub Desktop.
Benchmarking backslash in Julia with Float64, ComplexF64, and Dual128 (via DualMatrixTools.jl)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LinearAlgebra, SparseArrays, SuiteSparse | |
using DualNumbers, DualMatrixTools | |
using BenchmarkTools | |
n = 1000 ; | |
y = rand(n) ; | |
A = sprand(n, n, 20/n) ; | |
i, j, v = findnz(A) ; | |
v2 = rand(length(v)) ; | |
complex_A = sparse(i, j, v .+ im .* v2 .* 1e-50) ; | |
dual_A = sparse(i, j, v .+ ε .* v2) ; | |
Af = factorize(A) ; | |
complex_Af = factorize(complex_A) ; | |
dual_Af = factorize(dual_A) ; | |
# factorization benchmark | |
@btime $A \ $y ; | |
@btime factorize($A) ; | |
@btime $Af \ $y ; | |
# complex version | |
@btime $complex_A \ $y ; | |
@btime factorize($complex_A) ; | |
@btime $complex_Af \ $y ; | |
# dual version | |
@btime $dual_A \ $y ; | |
@btime factorize($dual_A) ; | |
@btime $dual_Af \ $y ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment