Edit:
a = np.arange(n_a_rows * n_a_cols).reshape(n_a_rows, n_a_cols) b = np.arange(n_b_rows * n_b_cols).reshape(n_b_rows, n_b_cols)
in
a = np.arange(n_a_rows * n_a_cols).reshape(n_a_rows, n_a_cols)*1.0 b = np.arange(n_b_rows * n_b_cols).reshape(n_b_rows, n_b_cols)*1.0
This gives a factor increase of 100 at least on my laptop:
time taken : 11.1231250763
vs
time taken : 0.124922037125
Unless you really want to multiply integers. Eigen also accelerates the multiplication of numbers with double precision (the number is replaced by MatrixXi with MatrixXd three times), but there I see only a factor of 1.5: time taken: 0.555005 versus 0.846788.
Lacek source share