Boost logo

Ublas :

Subject: [ublas] [bindings][traits] traits::vector_storage / traits::matrix_storage does not work with ublas::unbounded_array
From: Hidekazu Ikeno (hide.ikeno+boost_at_[hidden])
Date: 2009-05-11 12:43:00


Hello,

I have tested the latest numeric bindings, but have met compilation errors
when
I use ublas vector/matrix classes with default storage array
(ublas::unbounded_array).
It seems that traits::vector_storage / traits::matrix_storage fails because
of the missing
traits class for unbounded_array. It works if I use the std::vector for a
storage array
instead of unbounded_array:

#include <boost/numeric/bindings/traits/vector_traits.hpp>
#include <boost/numeric/bindings/traits/std_vector.hpp>
#include <boost/numeric/bindings/traits/ublas_vector.hpp>

namespace traits = boost::numeric::bindings::traits;
namespace ublas = boost::numeric::ublas;
int main()
{
        ublas::vector<double, std::vector<double> > v(10);
        double *vp = traits::vector_storage(v); // <- OK
        ublas::vector<double, ublas::unbounded_array<double> > w(10);
        double *wp = traits::vector_storage(w); // <- Error
        return 0;
}

The error messages I got is as follows (using g++ 4.3.3):

./boost/numeric/bindings/traits/ublas_vector.hpp: In static member function
‘static typename boost::numeric::bindings::traits::default_vector_traits<V,
T>::pointer
boost::numeric::bindings::traits::vector_detail_traits<boost::numeric::ublas::vector<T,
A>, V>::storage(V&) [with T = double, ArrT =
boost::numeric::ublas::unbounded_array<double, std::allocator<double> >, V =
boost::numeric::ublas::vector<double,
boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >]’:
./boost/numeric/bindings/traits/vector_traits.hpp:79: instantiated from
‘typename boost::numeric::bindings::traits::vector_traits<V, void>::pointer
boost::numeric::bindings::traits::vector_storage(V&) [with V =
boost::numeric::ublas::vector<double,
boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >]’
vector_storage.cpp:12: instantiated from here
./boost/numeric/bindings/traits/ublas_vector.hpp:43: error: ‘storage’ is not
a member of
‘boost::numeric::bindings::traits::vector_traits<boost::numeric::ublas::unbounded_array<double,
std::allocator<double> >, void>’

Could you kindly fix this problem?

Best regards,

Hidekazu Ikeno