Skip to content

Instantly share code, notes, and snippets.

View matthieugomez's full-sized avatar

Matthieu Gomez matthieugomez

View GitHub Profile
using Base.Test
@enum ECompoundingType EContinuous=1 ESimple=2 EExponential=3
abstract TCompoundType
type TContinuous <: TCompoundType end
type TSimple <: TCompoundType end
type TExponential <: TCompoundType end
@zachmayer
zachmayer / openblas.sh
Last active March 14, 2022 03:20
Mac BLAS
#Option 1 - install openblas with homebrew and link to CRAN installed R
brew tap homebrew/science
brew install openblas
ln -sf /usr/local/Cellar/openblas/0.2.12/lib/libopenblas.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib
#Option 2 - install r with openblas through homebrew
brew tap homebrew/science
brew install r --with-openblas
@arunsrinivasan
arunsrinivasan / reply_tweet.md
Last active August 29, 2015 14:01
A suggestion on Hadley's point about "Performance", "Premature optimisation" and "vectorise"

Under the section Vectorise (and also briefly mentioned under section Do as little as possible), one point I think would be nice to have is to be aware of the data structure the vectorised functions are implemented for. Using vectorised code without understanding that is a form of "premature optimisation" as well, IMHO.

For example, consider the case of rowSums on a data.frame. Some issues to consider here are:

  • Memory - using rowSums on a data.frame will coerce into a matrix first. Imagine a huge (> 1Gb) data.frame and this might turn out to be a bad idea if the conversion drains memory and starts swapping.

Note: I personally think discussion about performance should merit on trade-offs between "speed" and "memory".

  • Data structure - We can do much more in terms of speed (and memory) by taking advantage of the data structure here. Here's an example:
@robsimmons
robsimmons / gh-like.css
Created August 25, 2011 23:11 — forked from somebox/gh-like.css
GitHub-esque syntax highlight CSS
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;