Skip to content

Commit

Permalink
Switch back to choleski inverse
Browse files Browse the repository at this point in the history
  • Loading branch information
haziqj committed May 29, 2024
1 parent 15a288b commit 5e2a9ea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions R/20-rgeneric.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,10 @@ inla_sem <- function(
front <- Lambda %*% solve(IminB)
}
Sigma <- front %*% tcrossprod(Psi, front) + Theta
# Sigma <- Sigma + diag(1e-10, nrow(Sigma)) # for stability
# chol2inv(chol(Sigma))
# MASS::ginv(Sigma)
Sigma <- Matrix::forceSymmetric(Matrix::Matrix(Sigma))
Matrix::solve(Sigma)
Sigma <- Sigma + diag(1e-5, nrow(Sigma)) # for stability
chol2inv(chol(Sigma))
# Sigma <- Matrix::forceSymmetric(Matrix::Matrix(Sigma))
# Matrix::solve(Sigma)
}

mu <- function() { numeric(0) }
Expand Down

0 comments on commit 5e2a9ea

Please sign in to comment.