#include #include #include #include #include #include #include #include #ifdef USE_OLD_IO # include #else # include "io.hpp" #endif using namespace boost::numeric::ublas; int main(int argc, char *argv[]) { boost::minstd_rand *_generator; boost::uniform_real *_distribution; boost::variate_generator< boost::minstd_rand&, boost::uniform_real > *_uniform; _generator = new boost::minstd_rand(static_cast(std::time(NULL))); _distribution = new boost::uniform_real(0, 1); _uniform = new boost::variate_generator< boost::minstd_rand&, boost::uniform_real >(*_generator, *_distribution); matrix A(4,5); for (unsigned int i = 0; i < A.size1(); i++) { for (unsigned int j = 0; j < A.size2(); j++) { A(i,j) = (*_uniform)(); } } std::cout << A << std::endl; matrix< std::complex > B(4,5); for (unsigned int i = 0; i < B.size1(); i++) { for (unsigned int j = 0; j < B.size2(); j++) { B(i,j).real() = (*_uniform)(); B(i,j).imag() = (*_uniform)(); } } std::cout << B << std::endl; return EXIT_SUCCESS; }