#include #include #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); hpc::matvec::apply(A, [&](ElementType& val, Index i, Index j) -> void { val = uniform(mt); }); } int main() { using namespace hpc::matvec; GeMatrix A(1000, 1000); auto half = A.numRows / 2; auto A1 = A(0, 0, half, A.numCols); auto A2 = A(half, 0, A.numRows - half, A.numCols); std::thread t1([&](){ randomInit(A1); }); std::thread t2([&](){ randomInit(A2); }); t1.join(); t2.join(); /* print a small block of each of the initialized matrices */ auto A_ = A(half-2, half-2, 5, 5); print(A_, "A_"); }