#include #include #include template typename std::enable_if::value, void>::type randomInit(MA& A) { using ElementType = typename MA::ElementType; using Index = typename MA::Index; std::random_device random; std::mt19937 mt(random()); std::uniform_real_distribution uniform(-100,100); if (A.incRow < A.incCol) { for (Index j = 0; j < A.numCols; ++j) { for (Index i = 0; i < A.numRows; ++i) { A(i, j) = uniform(mt); } } } else { for (Index i = 0; i < A.numRows; ++i) { for (Index j = 0; j < A.numCols; ++j) { A(i, j) = uniform(mt); } } } } int main() { using namespace hpc::matvec; GeMatrix A(7, 8); randomInit(A); print(A, "A"); }