
Dear ublas developers! (I am using boost 1.30 & gcc 3.2) the following program: #include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; matrix<double> m (4, 4); for (unsigned int i = 0; i < m.size1 (); ++ i) for (unsigned int j = 0; j < m.size2 (); ++ j) m(i, j) = 1; std::cout << m << std::endl; // multiply a slice of the matrix with 2.... project (m, slice (2, 1, m.size1()-2), slice (1, 0, m.size1()-2)) *= 2; // interesting result ... the slice has been multiplied with 4 std::cout << m << std::endl; } gives the following output: [4,4]((1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1)) [4,4]((1,1,1,1),(1,1,1,1),(1,4,1,1),(1,4,1,1)) Why is the slice multiplied with 4 and not with 2?? Do I make some fundamental mistake? Everything works fine if I am using a matrix_vector_slice. My second (stupid?) question is the following: Is it intentional, that it is not possible to compile: #include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; matrix<double> m (4, 4); for (unsigned int i = 0; i < m.size1 (); ++ i) for (unsigned int j = 0; j < m.size2 (); ++ j) m(i, j) = 4*i+j; std::cout << m << std::endl; swap(row(m,0), row(m,2)); std::cout << m << std::endl; } whereas matrix_row<matrix<double> > l(m, 0); matrix_row<matrix<double> > r(m, 2); swap(l, r); /* swap the rows */ works fine. MTL has support for a similar syntax: swap(rows(m)[0], rows(m)[2]); best regards and thanks for your help! Stephan