diff --git a/R/makeAinv.R b/R/makeAinv.R index 5a3c1fa..e5b3da0 100644 --- a/R/makeAinv.R +++ b/R/makeAinv.R @@ -294,12 +294,12 @@ makeAinv.default <- function(pedigree, f = NULL, Ainv <- crossprod(fsOrd, Ainv) %*% fsOrd if(ptype == "D"){ Ainv@Dimnames <- list(as.character(pedalt[, 1]), NULL) - f <- Cout[[3]][t(fsOrd)@perm][-seq(nggroups)] - dii <- Cout[[4]][t(fsOrd)@perm][-seq(nggroups)] + f <- Cout[[3]][invPerm(fsOrd@perm)][-seq(nggroups)] + dii <- Cout[[4]][invPerm(fsOrd@perm)][-seq(nggroups)] } else { Ainv@Dimnames <- list(as.character(pedigree[, 1]), NULL) - f <- c(rep(0, nggroups), Cout[[3]][t(fsOrd)@perm][(nggroups+1):(nggroups + eN)]) - dii <- c(rep(0, nggroups), Cout[[4]][t(fsOrd)@perm][(nggroups+1):(nggroups + eN)]) + f <- c(rep(0, nggroups), Cout[[3]][invPerm(fsOrd@perm)][(nggroups+1):(nggroups + eN)]) + dii <- c(rep(0, nggroups), Cout[[4]][invPerm(fsOrd@perm)][(nggroups+1):(nggroups + eN)]) } if(!is.null(ggroups) && !gOnTop){ permute <- as(as.integer(c(seq(eN+1, N, 1), seq(eN))), "pMatrix") diff --git a/R/makeTinvDF.R b/R/makeTinvDF.R index 41bac9b..49be78b 100644 --- a/R/makeTinvDF.R +++ b/R/makeTinvDF.R @@ -229,8 +229,8 @@ makeDiiF.default <- function(pedigree, f = NULL, ...){ as.integer(0), #number genetic groups as.integer(fmiss - 1)) #first f to calculate (not supplied) fsOrd <- as(as.integer(renPed), "pMatrix") - f <- Cout[[3]][t(fsOrd)@perm] - dii <- Cout[[4]][t(fsOrd)@perm] + f <- Cout[[3]][invPerm(fsOrd@perm)] + dii <- Cout[[4]][invPerm(fsOrd@perm)] return(list(D = Diagonal(x = dii, n = N), @@ -265,8 +265,8 @@ makeDiiF.numPed <- function(pedigree, f = NULL, ...){ as.integer(0), #number genetic groups as.integer(fmiss)) #first f to calculate (not supplied) fsOrd <- as(as.integer(renPed), "pMatrix") - f <- Cout[[3]][t(fsOrd)@perm] - dii <- Cout[[4]][t(fsOrd)@perm] + f <- Cout[[3]][invPerm(fsOrd@perm)] + dii <- Cout[[4]][invPerm(fsOrd@perm)] return(list(D = Diagonal(x = dii, n = N),