Skip to content

Commit

Permalink
Switch to faster LU-factorization-based inversion for Erlangization.
Browse files Browse the repository at this point in the history
  • Loading branch information
smith-garrett committed Jan 6, 2023
1 parent b6041c2 commit e349398
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Uniformization.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Uniformization

using LinearAlgebra: I, eigen, diag, inv, nullspace
using LinearAlgebra: I, eigen, diag, inv, nullspace, inv!, lu!
using Distributions: Poisson, pdf, cdf, quantile

include("algorithms.jl")
Expand Down
3 changes: 2 additions & 1 deletion src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ at time 𝑡. The k parameter should be set to a power of two for efficiency.
"""
function erlangization(Q, k=2^10, t=0.0, args...)
λ = k / t
P = inv(I - Q ./ λ)
#P = inv(I - Q ./ λ)
P = inv!(lu!(I - Q ./ λ))
return P^k
end

Expand Down

0 comments on commit e349398

Please sign in to comment.