Skip to content

Instantly share code, notes, and snippets.

View BERENZ's full-sized avatar

Maciej Beręsewicz BERENZ

View GitHub Profile
@BERENZ
BERENZ / gist:ff274ebbf00ee111c708
Created November 23, 2015 15:01
Armadillo with Openblas

Setup Armadillo with openblas

OpenBLAS includes not-only BLAS (multithreaded) but also LAPACK (copy from Netlib).

OpenBLAS

git clone git://github.com/xianyi/OpenBLAS.git
cd OpenBLAS/
git checkout develop     # Dev branch, usually stable. 'master' branch is release branch
@BERENZ
BERENZ / gist:62bb9794826ff98cd716
Created November 20, 2015 15:24 — forked from kaneplusplus/gist:6067445
A parallel, block-matrix multiply for dense and sparse R matrices.
require(foreach)
require(itertools)
# block matrix multiplication
bmm <- function(x, y, chunkSize=max(1, floor(nrow(x)/6)), verbose=FALSE,
writeBlock=FALSE, returnResult=TRUE, filePrefix="block.", writeDir="",
projectionBlocks=FALSE) {
if (ncol(x) != nrow(y))
stop("Non-conformable matrices")
if (verbose) {
@BERENZ
BERENZ / recode.R
Last active August 29, 2015 14:22 — forked from hadley/recode.R
recode <- function(df, ..., match = c("first", "last")) {
match <- match.arg(match)
cases <- lapply(list(...), as.case)
if (identical(match, "last")) cases <- rev(cases)
n <- nrow(df)
out <- rep(NA, length(n)) # logical will be upcast as needed
# Simple loop-y implementation
@BERENZ
BERENZ / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console