Hello,

I have been getting compiling errors when using coordinate_matrix. For example:

#include <boost/numeric/bindings/ublas/matrix_sparse.hpp>
using namespace boost::numeric::ublas;

// File: b.cpp
int main ()
{
    coordinate_matrix<double> A(5, 5, 12);

    A(0, 0) = 2.;
    A(0, 1) = 3;
    A(1, 0) = 3.;
    A(1, 2) = 4.;
    A(1, 4) = 6;
    A(2, 1) = -1.;
    A(2, 2) = -3.;
    A(2, 3) = 2.;
    A(3, 2) = 1.;
    A(4, 1) = 4.;
    A(4, 2) = 2.;
    A(4, 4) = 1.;
   
    return 0;
}

The errors are:

In file included from /usr/include/c++/4.6/memory:68:0,
                 from /home/bacalfa/Documents/Programming/boost/trunk/boost/numeric/ublas/fwd.hpp:18,
                 from /home/bacalfa/Documents/Programming/boost-numeric-bindings/numeric_bindings/boost/numeric/bindings/ublas/detail/convert_to.hpp:14,
                 from /home/bacalfa/Documents/Programming/boost-numeric-bindings/numeric_bindings/boost/numeric/bindings/ublas/matrix_sparse.hpp:16,
                 from b.cpp:1:
/usr/include/c++/4.6/bits/stl_tempbuf.h: In constructor ‘std::_Temporary_buffer<_ForwardIterator, _Tp>::_Temporary_buffer(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >, std::random_access_iterator_tag>, _Tp = boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >]’:
/usr/include/c++/4.6/bits/stl_algo.h:3123:17:   instantiated from ‘void std::inplace_merge(_BIter, _BIter, _BIter) [with _BIter = boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >, std::random_access_iterator_tag>]’
/home/bacalfa/Documents/Programming/boost/trunk/boost/numeric/ublas/matrix_sparse.hpp:4403:17:   instantiated from ‘void boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::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<double, std::allocator<double> >]’
/home/bacalfa/Documents/Programming/boost/trunk/boost/numeric/ublas/matrix_sparse.hpp:4190:13:   instantiated from ‘const T* boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::find_element(boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type) 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<double, std::allocator<double> >, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::const_pointer = const double*, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type = long unsigned int]’
/home/bacalfa/Documents/Programming/boost/trunk/boost/numeric/ublas/matrix_sparse.hpp:4186:96:   instantiated from ‘T* boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::find_element(boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type) [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<double, std::allocator<double> >, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::pointer = double*, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type = long unsigned int]’
/home/bacalfa/Documents/Programming/boost/trunk/boost/numeric/ublas/matrix_sparse.hpp:51:56:   instantiated from ‘void boost::numeric::ublas::sparse_matrix_element<M>::set(const value_type&) const [with M = boost::numeric::ublas::coordinate_matrix<double>, boost::numeric::ublas::sparse_matrix_element<M>::value_type = double]’
/home/bacalfa/Documents/Programming/boost/trunk/boost/numeric/ublas/matrix_sparse.hpp:82:13:   instantiated from ‘boost::numeric::ublas::sparse_matrix_element<M>& boost::numeric::ublas::sparse_matrix_element<M>::operator=(const D&) [with D = double, M = boost::numeric::ublas::coordinate_matrix<double>, boost::numeric::ublas::sparse_matrix_element<M> = boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::coordinate_matrix<double> >]’
b.cpp:8:15:   instantiated from here
/usr/include/c++/4.6/bits/stl_tempbuf.h:257:6: error: invalid initialization of non-const reference of type ‘boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >&’ from an rvalue of type ‘boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >, std::random_access_iterator_tag>::reference {aka boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >}’
/usr/include/c++/4.6/bits/stl_tempbuf.h:232:5: error: in passing argument 3 of ‘void std::__uninitialized_construct_buf(_ForwardIterator, _ForwardIterator, _Tp&) [with _ForwardIterator = boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >*, _Tp = boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned int>, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >]’


If I change it to "compressed_matrix" it compiles just fine.

I just updated boost and bindings through svn.

Any ideas?


Bruno