Skip to content

Commit

Permalink
Add P method for an array of t, storing eigen decomposition of Q matr…
Browse files Browse the repository at this point in the history
…ix for GTR
  • Loading branch information
jangevaare committed Jul 27, 2017
1 parent 65f9e71 commit 914acd5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/substitution_models/gtr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ function P(gtr::GTR, t::Float64)
end


"Generate an array of P matrices for a specified array of times"
function P(gtr::GTR, t::Array{Float64})
if any(t .< 0.0)
error("t must be positive")
end
eig_vals, eig_vecs = eig(Q(mod))
return [expm(eig_vecs * (diagm(eig_vals)*i) * eig_vecs') for i in t]
end


type GTRPrior <: SubstitutionModelPrior
Θ::Vector{UnivariateDistribution}
π::Dirichlet
Expand Down

0 comments on commit 914acd5

Please sign in to comment.