Discussion:
[Pyublas] norm_2 problem fixed
Neal Becker
2009-01-29 15:30:46 UTC
Permalink
Problem was caused by the iterators that I had introduced! It seems they need
to derive from ublas::dense_random_access_iterator_tag, not from
boost::random_access_traversal tag.

At least with this change, it does compile:

diff --git a/src/cpp/pyublas/numpy.hpp b/src/cpp/pyublas/numpy.hpp
index 1699e6f..3f87012 100644
--- a/src/cpp/pyublas/numpy.hpp
+++ b/src/cpp/pyublas/numpy.hpp
@@ -745,11 +745,13 @@ namespace pyublas

class numpy_vec_iterator :
public boost::iterator_facade<numpy_vec_iterator, T,
- boost::random_access_traversal_tag>
+ // boost::random_access_traversal_tag>
+ boost::numeric::ublas::dense_random_access_iterator_tag>
{
public:
typedef boost::iterator_facade<numpy_vec_iterator, T,
- boost::random_access_traversal_tag> self_t;
+ // boost::random_access_traversal_tag> self_t;
+ boost::numeric::ublas::dense_random_access_iterator_tag> self_t;

typedef typename self_t::difference_type difference_type;

@@ -789,12 +791,14 @@ namespace pyublas
class numpy_vec_const_iterator
: public boost::iterator_facade<
numpy_vec_const_iterator, const T,
- boost::random_access_traversal_tag >
+ // boost::random_access_traversal_tag >
+ boost::numeric::ublas::dense_random_access_iterator_tag>
{
public:
typedef boost::iterator_facade<
numpy_vec_const_iterator, const T,
- boost::random_access_traversal_tag> self_t;
+ // boost::random_access_traversal_tag> self_t;
+ boost::numeric::ublas::dense_random_access_iterator_tag> self_t;

typedef typename self_t::difference_type difference_type;

@@ -955,13 +959,15 @@ namespace pyublas
class numpy_strided_vec_iterator :
public boost::iterator_facade<
numpy_strided_vec_iterator, T,
- boost::random_access_traversal_tag >
+ // boost::random_access_traversal_tag >
+ boost::numeric::ublas::dense_random_access_iterator_tag> // Is this correct?
{
public:
typedef boost::iterator_facade<
numpy_strided_vec_iterator,
T,
- boost::random_access_traversal_tag
+ // boost::random_access_traversal_tag
+ boost::numeric::ublas::dense_random_access_iterator_tag // Is this
correct?
self_t;

@@ -1005,12 +1011,14 @@ namespace pyublas
class numpy_strided_vec_const_iterator :
public boost::iterator_facade<
numpy_strided_vec_const_iterator, const T,
- boost::random_access_traversal_tag >
+ // boost::random_access_traversal_tag >
+ boost::numeric::ublas::dense_random_access_iterator_tag> // ?
{
public:
typedef boost::iterator_facade<
numpy_strided_vec_const_iterator, const T,
- boost::random_access_traversal_tag > self_t;
+ // boost::random_access_traversal_tag > self_t;
+ boost::numeric::ublas::dense_random_access_iterator_tag> self_t; //?

typedef typename self_t::difference_type difference_type;

Loading...