Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-09-22 02:58:55


Darin,

A couple of issues here
> Given the following code snippet:
>
> ublas::vector<float> min;
> min.assign( ublas::scalar_vector<float> ( 10,
> std::numeric_limits<float>::max() ) );
>
> The question is should this work? It used to work with a previous version
> of boost but with 1.33 it doesn't'

I should NOT work. I can't understand that it previously worked. '.assign'
always required conformant sizes. In this case you could size construct min
first.
  ublas::vector<float> min(10);
  min.assign( ublas::scalar_vector<float> ( 10,
std::numeric_limits<float>::max() ) );

> I see same_impl_ex is testing to see if the l-value and r-value vectors are
> the same size, which they aren't. And that is throwing the exception.
That is correct.

> The fix seems to perform min.resize( 10 ), prior to the assign statement,
> and I can't use min = scalar_vector, because of the 'size' : is not a
> member of 'boost::numeric::ublas::vector_container<C>"

The simpilist way to construct 'min' with a value is:
  ublas::vector<float> min = ublas::scalar_vector<float> ( 10,
std::numeric_limits<float>::max() );

This constructs 'min' with the size of the expression.

Note in 1.33.0 the same assignment fails as you note. This is a bug
see
http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Release_Notes_UBLAS

The bug is fixed. If a 1.33.1 release comes out it will be in that or you can
get it from the RC_1_33_0 branch in ther Boost CVS.

All the best,
        Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________