Boost logo

Ublas :

From: Haroon Khan (haroon.khan_at_[hidden])
Date: 2006-06-18 23:26:42


I've been trying experiment with the matrix_slice class with the
following code, and it seems that the assignment operator defined for
matrix_slice only assigns the data of the matrix_slice, but not the
slice information.

        using namespace boost::numeric::ublas;
        matrix<double> m(6,6);
        matrix_slice<matrix<double> >ms(m, slice(0,1,3), slice(0,1,3));
        for (unsigned int i=0;i<ms.size1();++i){
                for (unsigned int j=0;j<ms.size2();++j){
                        ms(i,j)=6*i+j +1 ;
                }
        }

        //then I define another matrix slice with a stride of 2 and size of 3
        matrix_slice<matrix<double> > ms1(m, slice(0,2,3), slice(0,2,3);

        //and then I try to assign ms <- ms1
        ms=ms1 ; //This line does'nt work,

Is this by design or could it be a bug ?? I'm using boost v1.33.

Thanks, Haroon