Skip to content
Snippets Groups Projects
Commit 644f9cfe authored by SANTAGOSTINI Pierre's avatar SANTAGOSTINI Pierre
Browse files

Use base::lfactorial (instead of mggd::lnfactorial)

parent d58981ba
No related branches found
No related tags found
No related merge requests found
......@@ -81,15 +81,18 @@ lauricella <- function(a, b, g, x, eps = 1e-06) {
# Logarithm of the product m_1! * ... * m_n! for m_1 = 0...k, ..., m_n = 0...k
# i.e. \sum_{i=0}^n{\log{m_i!}}
# lnfact <- as.data.frame(
# matrix(sapply(Munique, lnfactorial), nrow = length(Munique),
# ncol = n, byrow = FALSE, dimnames = list(Munique, 1:n)))
lnfact <- as.data.frame(
matrix(sapply(Munique, lnfactorial), nrow = length(Munique),
matrix(lfactorial(Munique), nrow = length(Munique),
ncol = n, byrow = FALSE, dimnames = list(Munique, 1:n)))
# sumlnfact <- function(ind) {
# # sum(mapply(function(i, j) lnfact[i, j], ind+1, 1:n))
# sum(access(ind, lnfact))
# }
# Table of all combinations of the log(m_i)
gridlnfact <- expand.grid(as.data.frame(lnfact))
gridlnfact <- expand.grid(lnfact)
# Sum of the logarithms
sumlnfact <- rowSums(gridlnfact)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment