From 27338a3983e4ace9a91ded18999773d9feaa5163 Mon Sep 17 00:00:00 2001 From: James Joseph Balamuta Date: Fri, 5 May 2017 03:41:59 -0500 Subject: [PATCH] Use the transpose of the cholseky decomposition (lower vs. upper triangle) --- inst/include/dist/rmatrixnorm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/include/dist/rmatrixnorm.h b/inst/include/dist/rmatrixnorm.h index 2d8ae8c..3822bad 100644 --- a/inst/include/dist/rmatrixnorm.h +++ b/inst/include/dist/rmatrixnorm.h @@ -12,7 +12,7 @@ inline arma::mat rmatnormal_chol(const arma::mat& mu, X.imbue(norm_rand); // Use R's PNG seed instead of Armadillo // N x P + N x N * N x P * P x P - return mu + arma::chol(Sigma_row) * X * arma::chol(Sigma_col); + return mu + arma::chol(Sigma_row, "lower") * X * arma::chol(Sigma_col); } // helper function