#include #include #include #include #include namespace ublas = boost::numeric::ublas; int main() { typedef double value_type; typedef ublas::matrix matrix_type; typedef ublas::banded_adaptor adaptor_matrix_type; // Create the input matrix matrix_type A(5,4); for (std::size_t i = 0; i < A.size1(); ++i) { for (std::size_t j = 0; j < A.size2(); ++j) { A(i, j) = 3 * i + j + 1; } } std::cout << "A=" << A << std::endl; // Create the adaptor used in copy-assignment adaptor_matrix_type B(A, 1, 2); std::cout << "B=" << B << std::endl; // Test copy-assignment // - Case #1 adaptor_matrix_type C(A, 1, 2); try { C = B; std::cout << "C=" << C << std::endl; } catch (...) { std::cerr << "Failing to copy-assign B to C" << std::endl; } // - Case #2 adaptor_matrix_type D(A); try { D = B; std::cout << "D=" << D << std::endl; } catch (...) { std::cerr << "Failing to copy-assign B to D" << std::endl; } }