Hi, I am trying to convert a coordinate_matrix to a compressed_matrix using the "assign" function and got weird compilations errors. Could you please help me with what the problem is.I am running the following code:------------------int size=10;typedef ublas::coordinate_matrix<double> data_type_1;typedef ublas::compressed_matrix<double> data_type;
data_type_1 A(size,size, 9*size);data_type M;M.resize(A.size1(),A.size2(),A.nnz()); // Convert matrix A into a compressed one.M.assign(A); // <----------- Error occurs here!-------------------------
I get the following compilation errors:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/bits/stl_tempbuf.h: In constructor 'std::_Temporary_buffer<_ForwardIterator, _Tp>::_Temporary_buffer(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = boost::numeric::ublas::indexed_iterator >, std::random_access_iterator_tag>, _Tp = boost::numeric::ublas::index_triple > >]':/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/bits/stl_algo.h:3084:17: instantiated from 'void std::inplace_merge(_BIter, _BIter, _BIter) [with _BIter = boost::numeric::ublas::indexed_iterator >, std::random_access_iterator_tag>]'/usr/include/boost/numeric/ublas/matrix_sparse.hpp:4403:17: instantiated from 'void boost::numeric::ublas::coordinate_matrix::sort() const [with T = double, L = boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul, IA = boost::numeric::ublas::unbounded_array<long unsigned int>, TA = boost::numeric::ublas::unbounded_array]'/usr/include/boost/numeric/ublas/matrix_sparse.hpp:4486:13: instantiated from 'boost::numeric::ublas::coordinate_matrix::const_iterator1 boost::numeric::ublas::coordinate_matrix::find1(int, boost::numeric::ublas::coordinate_matrix::size_type, boost::numeric::ublas::coordinate_matrix::size_type, int) const [with T = double, L = boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul, IA = boost::numeric::ublas::unbounded_array<long unsigned int>, TA = boost::numeric::ublas::unbounded_array, boost::numeric::ublas::coordinate_matrix::size_type = long unsigned int]'/usr/include/boost/numeric/ublas/matrix_sparse.hpp:4798:34: instantiated from 'boost::numeric::ublas::coordinate_matrix::const_iterator1 boost::numeric::ublas::coordinate_matrix::begin1() const [with T = double, L = boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul, IA = boost::numeric::ublas::unbounded_array<long unsigned int>, TA = boost::numeric::ublas::unbounded_array]'/usr/include/boost/numeric/ublas/detail/matrix_assign.hpp:909:57: instantiated from 'void boost::numeric::ublas::matrix_assign(M&, const boost::numeric::ublas::matrix_expression<E>&, boost::numeric::ublas::sparse_tag, boost::numeric::ublas::row_major_tag) [with F = boost::numeric::ublas::scalar_assign, R = boost::numeric::ublas::basic_full<>, M = boost::numeric::ublas::compressed_matrix<double>, E = boost::numeric::ublas::coordinate_matrix<double>]'/usr/include/boost/numeric/ublas/detail/matrix_assign.hpp:1216:9: instantiated from 'void boost::numeric::ublas::matrix_assign(M&, const boost::numeric::ublas::matrix_expression<E2>&) [with F = boost::numeric::ublas::scalar_assign, M = boost::numeric::ublas::compressed_matrix<double>, E = boost::numeric::ublas::coordinate_matrix<double>]'/usr/include/boost/numeric/ublas/matrix_sparse.hpp:2992:13: instantiated from 'boost::numeric::ublas::compressed_matrix& boost::numeric::ublas::compressed_matrix::assign(const boost::numeric::ublas::matrix_expression<E1>&) [with AE = boost::numeric::ublas::coordinate_matrix<double>, T = double, L = boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul, IA = boost::numeric::ublas::unbounded_array<long unsigned int>, TA = boost::numeric::ublas::unbounded_array, boost::numeric::ublas::compressed_matrix = boost::numeric::ublas::compressed_matrix<double>]'mexLapBoo.cc:254:12: instantiated from here/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/bits/stl_tempbuf.h:192:6: error: invalid initialization of non-const reference of type 'boost::numeric::ublas::index_triple > >&' from an rvalue of type 'boost::numeric::ublas::indexed_iterator >, std::random_access_iterator_tag>::reference'/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/bits/stl_uninitialized.h:223:5: error: in passing argument 3 of 'void std::__uninitialized_construct_range(_ForwardIterator, _ForwardIterator, _Tp&) [with _ForwardIterator = boost::numeric::ublas::index_triple > >*, _Tp = boost::numeric::ublas::index_triple > >]'
Your help is really appreciated. Thanks a lot!