#include #include #include #include int main () { using namespace boost::numeric::ublas; compressed_matrix m (4, 4); m.clear(); // entries m(0,0) = 1; m(0,3) = 5.5; m(1,3) = 2; m(1,2) = 2.3; m(2,2) = 4; m(3,1) = 5.5; std::cout << m << std::endl; int nnz = m.nnz(); //m.complete_index1_data(); // unbounded_array rowI(m.index1_data()); unbounded_array colI(m.index2_data()); unbounded_array vals(m.value_data()); // std::cout << "Size of nonzeros : " << nnz << std::endl; // for(unbounded_array::const_iterator iter1 = rowI.begin(); iter1 < rowI.end(); ++iter1) std::cout << *iter1 << ", " ; std::cout << std::endl; // for(unbounded_array::const_iterator iter2 = colI.begin(); iter2 < colI.end(); ++iter2) std::cout << *iter2 << ", " ; std::cout << std::endl; // for(unbounded_array::const_iterator iter3 = vals.begin(); iter3 < vals.end(); ++iter3) std::cout << *iter3 << ", " ; std::cout << std::endl; return 0; }