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'
Looking at the methods in the stack trace
boost::numeric::ublas::bad_argument::raise() Line
108 C++
boost::numeric::ublas::same_impl_ex<unsigned int>(const unsigned
int & size1=0, const unsigned int & size2=10, const char *
file=0x0099d988, int line=265) Line 279 +
0x113 C++
boost::numeric::ublas::indexing_vector_assign<boost::numeric::ublas::scalar_assign,boost::numeric::ublas::vector<float,boost::numeric::ublas::unbounded_array<float,std::allocator<float>
> >,boost::numeric::ublas::scalar_vector<float>
>(boost::numeric::ublas::vector<float,boost::numeric::ublas::unbounded_array<float,std::allocator<float>
> > & v={...}, const
boost::numeric::ublas::vector_expression<boost::numeric::ublas::scalar_vector<float>
> & e={...}) Line 265 +
0x34 C++
boost::numeric::ublas::vector_assign<boost::numeric::ublas::scalar_assign,boost::numeric::ublas::vector<float,boost::numeric::ublas::unbounded_array<float,std::allocator<float>
> >,boost::numeric::ublas::scalar_vector<float>
>(boost::numeric::ublas::vector<float,boost::numeric::ublas::unbounded_array<float,std::allocator<float>
> > & v={...}, const
boost::numeric::ublas::vector_expression<boost::numeric::ublas::scalar_vector<float>
> & e={...}, boost::numeric::ublas::dense_proxy_tag
__formal={...}) Line 280 + 0xd C++
boost::numeric::ublas::vector_assign<boost::numeric::ublas::scalar_assign,boost::numeric::ublas::vector<float,boost::numeric::ublas::unbounded_array<float,std::allocator<float>
> >,boost::numeric::ublas::scalar_vector<float>
>(boost::numeric::ublas::vector<float,boost::numeric::ublas::unbounded_array<float,std::allocator<float>
> > & v={...}, const
boost::numeric::ublas::vector_expression<boost::numeric::ublas::scalar_vector<float>
> & e={...}) Line 448 +
0x11 C++
boost::numeric::ublas::vector<float,boost::numeric::ublas::unbounded_array<float,std::allocator<float>
> >::assign<boost::numeric::ublas::scalar_vector<float>
>() Line 174 +
0xd C++
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.
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>"