Boost logo

Boost :

From: Kresimir Fresl (fresl_at_[hidden])
Date: 2003-02-02 04:38:29


Julius Muschaweck wrote:

>> now that sparse matrix_row's works with Joerg's latest CVS upload
>> (thanks Joerg), a const& parameter that used to work with 1_29_0 doesn't
>> anymore:
>>
>> using namespace boost::numeric;
>> typedef ublas::matrix<double> TM;
>>
>> double InnerProdConst( const TM& A, const ublas::vector<double>& x )
>> {
>> return ublas::inner_prod( ublas::matrix_row< const TM >( A, 2 ),
x );
>> }
>>
>> VC++.NET complains that some internal conversion loses qualifiers,
>> This does compile with a non const matrix reference parameter, the same
>> is true if I use a sparse_matrix or a compressed_matrix. I didn't try
>> the other matrix types, but since this breaks with three matrix types,
>> it looks like it has to do with matrix_row itself.

... or with VC++.NET ;o)

Joerg Walter wrote:

> The following code compiles successfully with GCC 3.2.1:
>
> #include <boost/numeric/ublas/matrix.hpp>
>
> using namespace boost::numeric;
> typedef ublas::matrix<double> TM;
>
> double InnerProdConst( const TM& A, const ublas::vector<double>& x )
> {
> return ublas::inner_prod( ublas::matrix_row< const TM >( A, 2 ), x );
> }
>
> int main()
> {
> ublas::matrix< double > A( 3, 3 );
> ublas::vector< double > x( 3 );
> std::cout << InnerProdConst( A, x ) << std::endl;
> }

... and with Comeau's C++ compiler 4.3.0.1, too.

Also with the following addition to `main()':

   ublas::matrix< double > const CA( A );
   std::cout << InnerProdConst( CA, x ) << std::endl;

fres


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk