Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance for det(F) where F is a LUfactor #12460

Merged
merged 1 commit into from
Aug 6, 2015

Conversation

KristofferC
Copy link
Member

I noticed that some of the vectorized operations in the determinants on LUFactors took a very long time. This devectorizes them for a significant speed up, especially for small matrices (600x speedup). These are used in the calculation of determinants for normal matrices so it is good to get them fast.

Benchmark code

function f(N, n)
    A = rand(n,n)
    F = lufact(A)
    @time for i = 1:N
        logabsdet(F)
    end
     @time for i = 1:N
        det(F)
    end
end

for elty in (Float64, Complex128)
    println("eltype $elty:")
    println("n = 4")
    f(10^5, 4)
    println("n = 100")
    f(10^5, 100)
end

Master

eltype Float64:
n = 4
  0.604570 seconds (2.50 M allocations: 505.066 MB, 5.28% gc time)
  0.579472 seconds (2.20 M allocations: 477.600 MB, 4.88% gc time)
n = 100
  0.886912 seconds (2.50 M allocations: 810.242 MB, 3.91% gc time)
  0.651776 seconds (2.20 M allocations: 553.894 MB, 4.27% gc time)
eltype Complex{Float64}:
n = 4
  0.603211 seconds (2.50 M allocations: 505.066 MB, 5.09% gc time)
  0.577971 seconds (2.20 M allocations: 477.600 MB, 4.83% gc time)
n = 100
  0.849031 seconds (2.50 M allocations: 810.242 MB, 3.81% gc time)
  0.650605 seconds (2.20 M allocations: 553.894 MB, 4.08% gc time)

PR

eltype Float64:
n = 4
  0.007293 seconds
  0.000908 seconds
n = 100
  0.173780 seconds
  0.011353 seconds
eltype Complex{Float64}:
n = 4
  0.007362 seconds
  0.000880 seconds
n = 100
  0.165616 seconds
  0.011188 seconds

@KristofferC
Copy link
Member Author

I think AppVeyor needs a restart. Not sure what the errors on Travis are. Anyone?

@tkelman
Copy link
Contributor

tkelman commented Aug 5, 2015

Bugs for everyone. Travis was one fatal: unable to connect to github.com: and one fatal: unable to access 'https://github.com/JuliaLang/JuliaDoc.git/': gnutls_handshake() failed: A TLS packet with unexpected length was received., and appveyor was appveyor/ci#353. Can you rebase and force push here?

@KristofferC
Copy link
Member Author

Rebased and green now. From my point of view, this is good to go.

andreasnoack added a commit that referenced this pull request Aug 6, 2015
Improve performance for det(F) where F is a LUfactor
@andreasnoack andreasnoack merged commit c889d6f into JuliaLang:master Aug 6, 2015
@andreasnoack
Copy link
Member

Thanks.

@KristofferC KristofferC deleted the kc/devec_lu_dets branch June 8, 2017 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants