Created
October 23, 2012 04:17
-
-
Save jey/3936616 to your computer and use it in GitHub Desktop.
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
// compile in C++11 mode | |
#include <Eigen/Dense> | |
using namespace Eigen; | |
typedef Matrix<double, Dynamic, Dynamic, RowMajor> RowMajorMatrix; | |
typedef Matrix<double, Dynamic, Dynamic, ColMajor> ColMajorMatrix; | |
int main() | |
{ | |
unsigned p = 50000; | |
unsigned q = 4; | |
const auto &rnds = RowMajorMatrix::Random(q, p).eval().transpose(); | |
ColMajorMatrix nu = ColMajorMatrix::Random(p, q); | |
ColMajorMatrix eta(p, q); | |
for(unsigned j = 0; j < q; ++j) { | |
eta.col(j) = rnds.col(j).array() * nu.col(j).array(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment