Discussion:
[Pyublas] problem with strided iterators
Neal Becker
2010-05-17 12:57:37 UTC
Permalink
This code:

template<typename in_t>
typename boost::range_value<in_t>::type operator() (in_t const& x, double
tau) {
pyublas::numpy_vector<double> coef = lagrange (tau, order);
return ublas::inner_prod (coef, x); <<< problem here
}
};

when compiled with -DBOOST_USE_ITERATING is causing:

/usr/local/src/boost.hg/boost/numeric/ublas/vector_proxy.hpp:237: error: no
matching function for call to
'pyublas::detail::numpy_strided_vec_iterator<const std::complex<double>
::numpy_strided_vec_iterator(boost::numeric::ublas::vector_slice<pyublas::numpy_vector<std::complex<double>
::const_iterator)'
// Element lookup
BOOST_UBLAS_INLINE
const_iterator find (size_type i) const {
const_subiterator_type it (data_.find (start () + i)); << problem
is here
Andreas Kloeckner
2010-05-20 13:22:39 UTC
Permalink
Post by Neal Becker
template<typename in_t>
typename boost::range_value<in_t>::type operator() (in_t const& x, double
tau) {
pyublas::numpy_vector<double> coef = lagrange (tau, order);
return ublas::inner_prod (coef, x); <<< problem here
}
};
/usr/local/src/boost.hg/boost/numeric/ublas/vector_proxy.hpp:237: error: no
matching function for call to
'pyublas::detail::numpy_strided_vec_iterator<const std::complex<double>
::numpy_strided_vec_iterator(boost::numeric::ublas::vector_slice<pyublas::numpy_vector<std::complex<double>
::const_iterator)'
// Element lookup
BOOST_UBLAS_INLINE
const_iterator find (size_type i) const {
const_subiterator_type it (data_.find (start () + i)); << problem
is here
Well, it looks like the vector proxies make certain constructibility
assumptions on the vector they are proxying, which
numpy_strided_vec::iterator doesn't satisfy. Fixing this should be a
matter of adding the right constructor to that class. Can you give this
a shot? Failing that, can you post a self-contained failing example?

Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pyublas/attachments/20100520/3a3a79a9/attachment.pgp>
Neal Becker
2010-05-20 14:08:06 UTC
Permalink
Post by Andreas Kloeckner
Post by Neal Becker
template<typename in_t>
typename boost::range_value<in_t>::type operator() (in_t const& x, double
tau) {
pyublas::numpy_vector<double> coef = lagrange (tau, order);
return ublas::inner_prod (coef, x); <<< problem here
}
};
no matching function for call to
'pyublas::detail::numpy_strided_vec_iterator<const std::complex<double>
::numpy_strided_vec_iterator(boost::numeric::ublas::vector_slice<pyublas
::::numpy_vector<std::complex<double>
::const_iterator)'
// Element lookup
BOOST_UBLAS_INLINE
const_iterator find (size_type i) const {
const_subiterator_type it (data_.find (start () + i)); <<
problem
is here
Well, it looks like the vector proxies make certain constructibility
assumptions on the vector they are proxying, which
numpy_strided_vec::iterator doesn't satisfy. Fixing this should be a
matter of adding the right constructor to that class. Can you give this
a shot? Failing that, can you post a self-contained failing example?
Andreas
IIUC numpy_strided_vec::iterator needs a constructor taking data_.find
(start()+i)?? I don't see how this could work. But then, I don't see how
this works with ublas strided iterators either.
Andreas Kloeckner
2010-05-20 14:39:05 UTC
Permalink
Post by Neal Becker
Post by Andreas Kloeckner
Well, it looks like the vector proxies make certain constructibility
assumptions on the vector they are proxying, which
numpy_strided_vec::iterator doesn't satisfy. Fixing this should be a
matter of adding the right constructor to that class. Can you give this
a shot? Failing that, can you post a self-contained failing example?
Andreas
IIUC numpy_strided_vec::iterator needs a constructor taking data_.find
(start()+i)?? I don't see how this could work. But then, I don't see how
this works with ublas strided iterators either.
Well, kind of. It needs to take

boost::numeric::ublas::vector_slice<
pyublas::numpy_vector<std::complex<double> >
::const_iterator

which might be feasible.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pyublas/attachments/20100520/d4b4f9e2/attachment.pgp>
Loading...