Boost logo

Ublas :

From: Richard_Harding_at_[hidden]
Date: 2007-02-07 21:12:02


Is it possible to create a matrix_range from a sparse matrix?

    typedef ublas::compressed_matrix<double, ublas::column_major, 0,
                                     ublas::unbounded_array<int>,
                                     ublas::unbounded_array<double> >
SparseMatrix;

    SparseMatrix A(7, 7, 12);
    ublas::matrix_range<SparseMatrix> submat(A, ublas::range(0, 4),
ublas::range(0, 4));

The code above will not compile giving me the follwing error message:

   MapMeshes.cpp(120) : error C2664:
'boost::numeric::ublas::matrix_range<M>::matrix_range(boost::numeric::ublas::matrix_r
   nge<M>::matrix_type &,const
boost::numeric::ublas::matrix_range<M>::range_type &,const
boost::numeric::ublas::matrix_ra
   ge<M>::range_type &)' : cannot convert parameter 2 from
'boost::numeric::ublas::basic_range<>' to 'const boost::numeric
   :ublas::matrix_range<M>::range_type &'
           with
           [
               M=SparseMatrix
           ]
           and
           [
               M=SparseMatrix
           ]
           Reason: cannot convert from
'boost::numeric::ublas::basic_range<>' to 'const
boost::numeric::ublas::matrix_rang
    <M>::range_type'
           with
           [
               M=SparseMatrix
           ]
           No constructor could take the source type, or constructor
overload resolution was ambiguous

If I use the free subrange() function instead, the code compiles but my app
crashes hard. I'm using uBLAS from Boost 1.33.1 with VC7.1 compiler. Is
this a bug, user-error, or not supported?

Thanks!

------------------------------------------------------------------
Richard Harding
Lead Engineer
Tools/Maya Technical Support Group
Sony Computer Entertainment America
Phone: (858) 824-5804
Fax: (858) 824-5757
richard_harding_at_[hidden]
LIVE IN YOUR WXRLD PLêY IN ¨URS
------------------------------------------------------------------