|
Ublas : |
From: Vadim Zborovskii (vadim_z_at_[hidden])
Date: 2006-08-17 07:45:22
Dear colleagues!
I failed to compile code which uses triangular_adaptor with compressed
matrix. Code sample which reproduces the error and compiler output is
attached. I used gcc-mingw-3.4.2 and boost 1.33.1.
Use of coordinate_matrix instead of compressed_matrix also leads to
compile error.
May be I'm doing something wrong or triangular_adaptor isn't intended to
be used with sparse matrices.
Thank you in advance.
Vadim Zborovskii
#include<iostream>
#include<boost/numeric/ublas/matrix_sparse.hpp>
#include<boost/numeric/ublas/triangular.hpp>
using namespace std;
using namespace boost::numeric::ublas;
typedef compressed_matrix<double> Mat;
int main(void) {
Mat M(5,5);
triangular_adaptor<Mat,strict_lower> T(M);
T*=2.0;
return 0;
}
c:/soft/boost/boost/numeric/ublas/triangular.hpp: In member function `typename boost::mpl::if_<boost::is_const<T>, typename E::const_iterator2, typename E::iterator2>::type::reference boost::numeric::ublas::triangular_adaptor<M, TRI>::iterator2::operator*() const [with M = Mat, TRI = boost::numeric::ublas::strict_lower]':
c:/soft/boost/boost/numeric/ublas/detail/matrix_assign.hpp:429: instantiated from `void boost::numeric::ublas::matrix_assign_scalar(M&, const T&, boost::numeric::ublas::sparse_proxy_tag, boost::numeric::ublas::row_major_tag) [with F = boost::numeric::ublas::scalar_multiplies_assign, M = boost::numeric::ublas::triangular_adaptor<Mat, boost::numeric::ublas::strict_lower>, T = double]'
c:/soft/boost/boost/numeric/ublas/detail/matrix_assign.hpp:460: instantiated from `void boost::numeric::ublas::matrix_assign_scalar(M&, const T&) [with F = boost::numeric::ublas::scalar_multiplies_assign, M = boost::numeric::ublas::triangular_adaptor<Mat, boost::numeric::ublas::strict_lower>, T = double]'
c:/soft/boost/boost/numeric/ublas/triangular.hpp:1066: instantiated from `boost::numeric::ublas::triangular_adaptor<M, TRI>& boost::numeric::ublas::triangular_adaptor<M, TRI>::operator*=(const AT&) [with AT = double, M = Mat, TRI = boost::numeric::ublas::strict_lower]'
xx.cxx:14: instantiated from here
c:/soft/boost/boost/numeric/ublas/triangular.hpp:1631: error: invalid initialization of non-const reference of type 'double&' from a temporary of type 'boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::compressed_matrix<double, boost::numeric::ublas::basic_row_major<size_t, ptrdiff_t>, 0u, boost::numeric::ublas::unbounded_array<size_t, std::allocator<size_t> >, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >'
c:/soft/boost/boost/numeric/ublas/triangular.hpp: In member function `typename boost::mpl::if_<boost::is_const<T>, typename E::const_reference, typename E::reference>::type boost::numeric::ublas::triangular_adaptor<M, TRI>::operator()(typename M::size_type, typename M::size_type) [with M = Mat, TRI = boost::numeric::ublas::strict_lower]':
c:/soft/boost/boost/numeric/ublas/triangular.hpp:1631: instantiated from `typename boost::mpl::if_<boost::is_const<T>, typename E::const_iterator2, typename E::iterator2>::type::reference boost::numeric::ublas::triangular_adaptor<M, TRI>::iterator2::operator*() const [with M = Mat, TRI = boost::numeric::ublas::strict_lower]'
c:/soft/boost/boost/numeric/ublas/detail/matrix_assign.hpp:429: instantiated from `void boost::numeric::ublas::matrix_assign_scalar(M&, const T&, boost::numeric::ublas::sparse_proxy_tag, boost::numeric::ublas::row_major_tag) [with F = boost::numeric::ublas::scalar_multiplies_assign, M = boost::numeric::ublas::triangular_adaptor<Mat, boost::numeric::ublas::strict_lower>, T = double]'
c:/soft/boost/boost/numeric/ublas/detail/matrix_assign.hpp:460: instantiated from `void boost::numeric::ublas::matrix_assign_scalar(M&, const T&) [with F = boost::numeric::ublas::scalar_multiplies_assign, M = boost::numeric::ublas::triangular_adaptor<Mat, boost::numeric::ublas::strict_lower>, T = double]'
c:/soft/boost/boost/numeric/ublas/triangular.hpp:1066: instantiated from `boost::numeric::ublas::triangular_adaptor<M, TRI>& boost::numeric::ublas::triangular_adaptor<M, TRI>::operator*=(const AT&) [with AT = double, M = Mat, TRI = boost::numeric::ublas::strict_lower]'
xx.cxx:14: instantiated from here
c:/soft/boost/boost/numeric/ublas/triangular.hpp:990: error: invalid use of const_cast with type `boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::compressed_matrix<double, boost::numeric::ublas::basic_row_major<size_t, ptrdiff_t>, 0u, boost::numeric::ublas::unbounded_array<size_t, std::allocator<size_t> >, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >', which is not a pointer, reference, nor a pointer-to-data-member type
c:/soft/boost/boost/numeric/ublas/triangular.hpp:990: error: invalid const_cast from type `double' to type `boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::compressed_matrix<double, boost::numeric::ublas::basic_row_major<size_t, ptrdiff_t>, 0u, boost::numeric::ublas::unbounded_array<size_t, std::allocator<size_t> >, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >'
c:/soft/boost/boost/numeric/ublas/triangular.hpp:1631: instantiated from `typename boost::mpl::if_<boost::is_const<T>, typename E::const_iterator2, typename E::iterator2>::type::reference boost::numeric::ublas::triangular_adaptor<M, TRI>::iterator2::operator*() const [with M = Mat, TRI = boost::numeric::ublas::strict_lower]'
c:/soft/boost/boost/numeric/ublas/detail/matrix_assign.hpp:429: instantiated from `void boost::numeric::ublas::matrix_assign_scalar(M&, const T&, boost::numeric::ublas::sparse_proxy_tag, boost::numeric::ublas::row_major_tag) [with F = boost::numeric::ublas::scalar_multiplies_assign, M = boost::numeric::ublas::triangular_adaptor<Mat, boost::numeric::ublas::strict_lower>, T = double]'
c:/soft/boost/boost/numeric/ublas/detail/matrix_assign.hpp:460: instantiated from `void boost::numeric::ublas::matrix_assign_scalar(M&, const T&) [with F = boost::numeric::ublas::scalar_multiplies_assign, M = boost::numeric::ublas::triangular_adaptor<Mat, boost::numeric::ublas::strict_lower>, T = double]'
c:/soft/boost/boost/numeric/ublas/triangular.hpp:1066: instantiated from `boost::numeric::ublas::triangular_adaptor<M, TRI>& boost::numeric::ublas::triangular_adaptor<M, TRI>::operator*=(const AT&) [with AT = double, M = Mat, TRI = boost::numeric::ublas::strict_lower]'
xx.cxx:14: instantiated from here
c:/soft/boost/boost/numeric/ublas/triangular.hpp:994: error: invalid use of const_cast with type `boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::compressed_matrix<double, boost::numeric::ublas::basic_row_major<size_t, ptrdiff_t>, 0u, boost::numeric::ublas::unbounded_array<size_t, std::allocator<size_t> >, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >', which is not a pointer, reference, nor a pointer-to-data-member type
c:/soft/boost/boost/numeric/ublas/triangular.hpp:994: error: invalid const_cast from type `double' to type `boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::compressed_matrix<double, boost::numeric::ublas::basic_row_major<size_t, ptrdiff_t>, 0u, boost::numeric::ublas::unbounded_array<size_t, std::allocator<size_t> >, boost::numeric::ublas::unbounded_array<double, std::allocator<double> > > >'