Skip to content

Instantly share code, notes, and snippets.

@betatim
Last active December 30, 2015 03:49
Show Gist options
  • Save betatim/7771735 to your computer and use it in GitHub Desktop.
Save betatim/7771735 to your computer and use it in GitHub Desktop.
std::vector<std::function<Matrix5d()>> covariances;
for (int i(0); i<10000000; ++i) {
// delay calculation by sending back a lambda
//r3 += m*c*m.transpose();
covariances.push_back([=]() {return m*c*m.transpose();});
}
for (auto fun: covariances) {
if (rand.Rndm() > 0.75) {
r3 += fun();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment