Improved array dropping
This commit is contained in:
parent
edd0cac775
commit
aa8a066530
1 changed files with 2 additions and 2 deletions
|
|
@ -13,14 +13,14 @@ computePopulationLogml <- function(pops, adjprior, priorTerm = 0) {
|
||||||
# ======================================================== #
|
# ======================================================== #
|
||||||
# Computation #
|
# Computation #
|
||||||
# ======================================================== #
|
# ======================================================== #
|
||||||
|
isarray <- length(dim(repmat(adjprior, c(1, 1, length(pops))))) > 2
|
||||||
term1 <- squeeze(
|
term1 <- squeeze(
|
||||||
# FIXME: assumes COUNTS has 3 dims. Where does this come from?
|
|
||||||
sum(
|
sum(
|
||||||
sum(
|
sum(
|
||||||
reshape(
|
reshape(
|
||||||
lgamma(
|
lgamma(
|
||||||
repmat(adjprior, c(1, 1, length(pops))) +
|
repmat(adjprior, c(1, 1, length(pops))) +
|
||||||
COUNTS[seq_len(nrow(adjprior)), seq_len(ncol(adjprior)), pops, drop=FALSE]
|
COUNTS[seq_len(nrow(adjprior)), seq_len(ncol(adjprior)), pops, drop=!isarray]
|
||||||
),
|
),
|
||||||
c(x, y, z)
|
c(x, y, z)
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue