Neal Becker
2010-06-11 22:27:21 UTC
I needed the default constructor to allow pyublas::numpy_strided_vector to be
used with boost::iterator_adapator
Don't recall what the first patch is for
diff --git a/src/cpp/pyublas/numpy.hpp b/src/cpp/pyublas/numpy.hpp
index 90acfee..ba2b393 100644
--- a/src/cpp/pyublas/numpy.hpp
+++ b/src/cpp/pyublas/numpy.hpp
@@ -171,6 +171,15 @@ namespace pyublas
get_typenum(T())));
}
+ numpy_array(int ndim_, const npy_intp *dims_, T* data)
+ {
+ m_numpy_array = boost::python::handle<>(
+ PyArray_SimpleNewFromData(
+ ndim_,
+ const_cast<npy_intp *>(dims_),
+ get_typenum(T()), data));
+ }
+
numpy_array(size_type n, const value_type &v)
{
if (n)
@@ -868,6 +877,8 @@ namespace pyublas
typedef typename self_t::difference_type difference_type;
typedef typename numpy_strided_vector<T>::stride_type stride_type;
:
+ numpy_strided_vec_iterator() {}
+
numpy_strided_vec_iterator(T *it, stride_type s)
: stride(s), it(it)
{ }
used with boost::iterator_adapator
Don't recall what the first patch is for
diff --git a/src/cpp/pyublas/numpy.hpp b/src/cpp/pyublas/numpy.hpp
index 90acfee..ba2b393 100644
--- a/src/cpp/pyublas/numpy.hpp
+++ b/src/cpp/pyublas/numpy.hpp
@@ -171,6 +171,15 @@ namespace pyublas
get_typenum(T())));
}
+ numpy_array(int ndim_, const npy_intp *dims_, T* data)
+ {
+ m_numpy_array = boost::python::handle<>(
+ PyArray_SimpleNewFromData(
+ ndim_,
+ const_cast<npy_intp *>(dims_),
+ get_typenum(T()), data));
+ }
+
numpy_array(size_type n, const value_type &v)
{
if (n)
@@ -868,6 +877,8 @@ namespace pyublas
typedef typename self_t::difference_type difference_type;
typedef typename numpy_strided_vector<T>::stride_type stride_type;
:
+ numpy_strided_vec_iterator() {}
+
numpy_strided_vec_iterator(T *it, stride_type s)
: stride(s), it(it)
{ }