This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bigcorPar <- function(x, nblocks = 10, verbose = TRUE, ncore="all", ...){ | |
library(ff, quietly = TRUE) | |
require(doMC) | |
if(ncore=="all"){ | |
ncore = multicore:::detectCores() | |
registerDoMC(cores = ncore) | |
} else{ | |
registerDoMC(cores = ncore) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set use_cholesky if M is symmetric - it's faster and more stable | |
// for dep paring it won't be | |
template <typename MatrixType> | |
inline typename MatrixType::Scalar logdet(const MatrixType& M, bool use_cholesky = false) { | |
using namespace Eigen; | |
using std::log; | |
typedef typename MatrixType::Scalar Scalar; | |
Scalar ld = 0; | |
if (use_cholesky) { | |
LLT<Matrix<Scalar,Dynamic,Dynamic>> chol(M); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def confirm(): | |
""" | |
Ask user to enter Y or N (case-insensitive). | |
:return: True if the answer is Y. | |
:rtype: bool | |
""" | |
answer = "" | |
while answer not in ["y", "n"]: | |
answer = raw_input("OK to push to continue [Y/N]? ").lower() |