36#ifndef VIGRA_NUMPY_ARRAY_HXX
37#define VIGRA_NUMPY_ARRAY_HXX
39#ifndef NPY_NO_DEPRECATED_API
40# define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
46#include <numpy/arrayobject.h>
47#include "multi_array.hxx"
48#include "array_vector.hxx"
49#include "python_utility.hxx"
50#include "numpy_array_traits.hxx"
51#include "numpy_array_taggedshape.hxx"
58static inline void import_vigranumpy()
61 if(_import_array() < 0)
62 pythonToCppException(0);
66 char const * load_vigra =
68 "if 'vigra.vigranumpycore' not in sys.modules:\n"
70 pythonToCppException(PyRun_SimpleString(load_vigra) == 0);
80class MultibandVectorAccessor
91 typedef Multiband<T> value_type;
95 typedef T component_type;
97 typedef VectorElementAccessor<MultibandVectorAccessor<T> > ElementAccessor;
102 template <
class ITERATOR>
103 component_type
const & getComponent(ITERATOR
const & i,
int idx)
const
105 return *(&*i+idx*stride_);
113 template <
class V,
class ITERATOR>
114 void setComponent(V
const & value, ITERATOR
const & i,
int idx)
const
116 *(&*i+idx*stride_) = detail::RequiresExplicitCast<component_type>::cast(value);
122 template <
class ITERATOR,
class DIFFERENCE>
123 component_type
const & getComponent(ITERATOR
const & i, DIFFERENCE
const & diff,
int idx)
const
125 return *(&i[diff]+idx*stride_);
133 template <
class V,
class ITERATOR,
class DIFFERENCE>
135 setComponent(V
const & value, ITERATOR
const & i, DIFFERENCE
const & diff,
int idx)
const
137 *(&i[diff]+idx*stride_) = detail::RequiresExplicitCast<component_type>::cast(value);
149template <
class TYPECODE>
152constructArray(TaggedShape tagged_shape, TYPECODE typeCode,
bool init,
153 python_ptr arraytype = python_ptr());
157template <
class Shape>
158void numpyParseSlicing(Shape
const & shape, PyObject * idx, Shape & start, Shape & stop)
160 int N = shape.size();
161 for(
int k=0; k<N; ++k)
167 python_ptr index(idx);
168 if(!PySequence_Check(index))
170 index = python_ptr(PyTuple_Pack(1, index.ptr()), python_ptr::new_nonzero_reference);
172 int lindex = PyTuple_Size(index);
174 for(; kindex<lindex; ++kindex)
176 if(PyTuple_GET_ITEM((PyTupleObject *)index.ptr(), kindex) == Py_Ellipsis)
179 if(kindex == lindex && lindex < N)
181 python_ptr ellipsis = python_ptr(PyTuple_Pack(1, Py_Ellipsis), python_ptr::new_nonzero_reference);
182 index = python_ptr(PySequence_Concat(index, ellipsis), python_ptr::new_nonzero_reference);
186 for(
int k=0; k < N; ++k)
188 PyObject * item = PyTuple_GET_ITEM((PyTupleObject *)index.ptr(), kindex);
189#if PY_MAJOR_VERSION < 3
190 if(PyInt_Check(item))
194 if(PyLong_Check(item))
200 start[k] += shape[k];
204 else if(PySlice_Check(item))
206 Py_ssize_t sstart, sstop, step;
207#if PY_MAJOR_VERSION < 3
208 if(PySlice_GetIndices((PySliceObject *)item, shape[k], &sstart, &sstop, &step) != 0)
210 if(PySlice_GetIndices(item, shape[k], &sstart, &sstop, &step) != 0)
212 pythonToCppException(0);
213 vigra_precondition(step == 1,
214 "numpyParseSlicing(): only unit steps are supported.");
219 else if(item == Py_Ellipsis)
228 vigra_precondition(
false,
229 "numpyParseSlicing(): unsupported index object.");
262 static python_ptr getArrayTypeObject()
264 return detail::getArrayTypeObject();
267 static std::string defaultOrder(std::string defaultValue =
"C")
269 return detail::defaultOrder(defaultValue);
272 static python_ptr defaultAxistags(
int ndim, std::string order =
"")
274 return detail::defaultAxistags(
ndim, order);
277 static python_ptr emptyAxistags(
int ndim)
279 return detail::emptyAxistags(
ndim);
289 explicit NumpyAnyArray(PyObject * obj = 0,
bool createCopy =
false, PyTypeObject * type = 0)
293 vigra_precondition(type == 0 || PyType_IsSubtype(type, &PyArray_Type),
294 "NumpyAnyArray(obj, createCopy, type): type must be numpy.ndarray or a subclass thereof.");
298 vigra_precondition(
makeReference(obj, type),
"NumpyAnyArray(obj): obj isn't a numpy array.");
310 vigra_precondition(type == 0 || PyType_IsSubtype(type, &PyArray_Type),
311 "NumpyAnyArray(obj, createCopy, type): type must be numpy.ndarray or a subclass thereof.");
334 vigra_precondition(other.
hasData(),
335 "NumpyArray::operator=(): Cannot assign from empty array.");
337 python_ptr arraytype = getArrayTypeObject();
338 python_ptr f(pythonFromData(
"_copyValuesImpl"));
339 if(PyObject_HasAttr(arraytype, f))
341 python_ptr res(PyObject_CallMethodObjArgs(arraytype, f.get(),
342 pyArray_.get(), other.pyArray_.get(), NULL),
343 python_ptr::keep_count);
344 vigra_postcondition(res.get() != 0,
345 "NumpyArray::operator=(): VigraArray._copyValuesImpl() failed.");
349 PyArrayObject * sarray = (PyArrayObject *)pyArray_.get();
350 PyArrayObject * tarray = (PyArrayObject *)other.pyArray_.get();
352 if(PyArray_CopyInto(tarray, sarray) == -1)
353 pythonToCppException(0);
358 pyArray_ = other.pyArray_;
370 return PyArray_NDIM(
pyArray());
383 return pythonGetAttr(
pyObject(),
"spatialDimensions",
ndim());
386 bool hasChannelAxis()
const
390 return channelIndex() ==
ndim();
397 return pythonGetAttr(
pyObject(),
"channelIndex",
ndim());
404 return pythonGetAttr(
pyObject(),
"innerNonchannelIndex",
ndim());
436 if(stride[j] < stride[smallest])
441 std::swap(stride[k], stride[smallest]);
442 std::swap(permutation[k], permutation[smallest]);
447 ordering[permutation[k]] = k;
480 return PyArray_DESCR(
pyArray())->type_num;
487 template <
class Shape>
491 unsigned int size =
ndim();
492 vigra_precondition(start.size() == size && stop.size() == size,
493 "NumpyAnyArray::getitem(): shape has wrong dimension.");
497 python_ptr index(PyTuple_New(size), python_ptr::new_nonzero_reference);
498 for(
unsigned int k=0; k<size; ++k)
504 vigra_precondition(0 <= start[k] && start[k] <= stop[k] && stop[k] <= s[k],
505 "NumpyAnyArray::getitem(): slice out of bounds.");
507 if(start[k] == stop[k])
509 item = pythonFromData(start[k]);
513 python_ptr s0(pythonFromData(start[k]));
514 python_ptr s1(pythonFromData(stop[k]));
515 item = PySlice_New(s0, s1, 0);
517 pythonToCppException(item);
518 PyTuple_SET_ITEM((PyTupleObject *)index.ptr(), k, item);
520 python_ptr func(pythonFromData(
"__getitem__"));
521 python_ptr res(PyObject_CallMethodObjArgs(
pyObject(), func.ptr(), index.ptr(), NULL),
522 python_ptr::new_nonzero_reference);
536 python_ptr key(pythonFromData(
"axistags"));
549 return (PyArrayObject *)pyArray_.get();
558 return pyArray_.get();
571 if(obj == 0 || !PyArray_Check(obj))
575 vigra_precondition(PyType_IsSubtype(type, &PyArray_Type) != 0,
576 "NumpyAnyArray::makeReference(obj, type): type must be numpy.ndarray or a subclass thereof.");
577 obj = PyArray_View((PyArrayObject*)obj, 0, type);
578 pythonToCppException(obj);
590 void makeCopy(PyObject * obj, PyTypeObject * type = 0)
592 vigra_precondition(obj && PyArray_Check(obj),
593 "NumpyAnyArray::makeCopy(obj): obj is not an array.");
594 vigra_precondition(type == 0 || PyType_IsSubtype(type, &PyArray_Type),
595 "NumpyAnyArray::makeCopy(obj, type): type must be numpy.ndarray or a subclass thereof.");
596 python_ptr array(PyArray_NewCopy((PyArrayObject*)obj, NPY_ANYORDER), python_ptr::keep_count);
597 pythonToCppException(array);
606 return pyArray_ != 0;
619nontrivialPermutation(ArrayVector<npy_intp>
const & p)
621 for(
unsigned int k=0; k<p.size(); ++k)
629template <
class TYPECODE>
632constructArray(TaggedShape tagged_shape, TYPECODE typeCode,
bool init, python_ptr arraytype)
635 PyAxisTags axistags(tagged_shape.axistags);
637 int ndim = (int)shape.size();
644 arraytype = NumpyAnyArray::getArrayTypeObject();
646 inverse_permutation = axistags.permutationFromNormalOrder();
647 vigra_precondition(ndim == (
int)inverse_permutation.size(),
648 "axistags.permutationFromNormalOrder(): permutation has wrong size.");
652 arraytype = python_ptr((PyObject*)&PyArray_Type);
658 python_ptr array(PyArray_New((PyTypeObject *)arraytype.get(), ndim, shape.begin(),
659 typeCode, 0, 0, 0, order, 0),
660 python_ptr::keep_count);
661 pythonToCppException(array);
663 if(detail::nontrivialPermutation(inverse_permutation))
665 PyArray_Dims permute = { inverse_permutation.begin(), ndim };
666 array = python_ptr(PyArray_Transpose((PyArrayObject*)array.get(), &permute),
667 python_ptr::keep_count);
668 pythonToCppException(array);
671 if(arraytype != (PyObject*)&PyArray_Type && axistags)
672 pythonToCppException(PyObject_SetAttrString(array,
"axistags", axistags.axistags) != -1);
675 PyArray_FILLWBYTE((PyArrayObject *)array.get(), 0);
677 return array.release();
681template <
class TINY_VECTOR>
683python_ptr constructNumpyArrayFromData(
684 TINY_VECTOR
const & shape, npy_intp *strides,
685 NPY_TYPES typeCode,
void *data)
689#ifndef NPY_ARRAY_WRITEABLE
690# define NPY_ARRAY_WRITEABLE NPY_WRITEABLE
693 python_ptr array(PyArray_New(&PyArray_Type, shape.size(), pyShape.begin(),
694 typeCode, strides, data, 0, NPY_ARRAY_WRITEABLE, 0),
695 python_ptr::keep_count);
696 pythonToCppException(array);
715template <
unsigned int N,
class T,
class Str
ide = Str
idedArrayTag>
717:
public MultiArrayView<N, typename NumpyArrayTraits<N, T, Stride>::value_type, Stride>,
721 typedef NumpyArrayTraits<N, T, Stride> ArrayTraits;
722 typedef typename ArrayTraits::dtype dtype;
723 typedef T pseudo_value_type;
725 static NPY_TYPES
const typeCode = ArrayTraits::typeCode;
731 enum { actual_dimension = view_type::actual_dimension };
792 void setupArrayView();
795 std::string
const & order =
"")
797 vigra_precondition(order ==
"" || order ==
"C" || order ==
"F" ||
798 order ==
"V" || order ==
"A",
799 "NumpyArray.init(): order must be in ['C', 'F', 'V', 'A', ''].");
800 return python_ptr(constructArray(ArrayTraits::taggedShape(
shape, order), typeCode, init),
801 python_ptr::keep_count);
821 explicit NumpyArray(PyObject *obj = 0,
bool createCopy =
false)
829 "NumpyArray(obj): Cannot construct from incompatible array.");
854 template <
class U,
class S>
860 "NumpyArray(MultiArrayView): Python constructor did not produce a compatible array.");
861 view_type::operator=(other);
874 "NumpyArray(shape): Python constructor did not produce a compatible array.");
886 "NumpyArray(tagged_shape): Python constructor did not produce a compatible array.");
901 "NumpyArray(NumpyAnyArray): Cannot construct from incompatible or empty array.");
915 view_type::operator=(other);
929 template <
class U,
class S>
935 "NumpyArray::operator=(): shape mismatch.");
936 view_type::operator=(other);
941 copy.reshapeIfEmpty(other.taggedShape(),
942 "NumpyArray::operator=(): reshape failed unexpectedly.");
955 template <
class U,
class S>
961 "NumpyArray::operator=(): shape mismatch.");
962 view_type::operator=(other);
968 "NumpyArray::operator=(): reshape failed unexpectedly.");
995 vigra_precondition(
false,
996 "NumpyArray::operator=(): Cannot assign from incompatible array.");
1010 "NumpyArray::permuteLikewise(): array has no data.");
1013 ArrayTraits::permuteLikewise(this->pyArray_,
data, res);
1021 template <
class U,
int K>
1026 "NumpyArray::permuteLikewise(): array has no data.");
1029 ArrayTraits::permuteLikewise(this->pyArray_,
data, res);
1042 "NumpyArray::permuteLikewise(): array has no data.");
1046 ArrayTraits::permuteLikewise(this->pyArray_,
data, res);
1058#if VIGRA_CONVERTER_DEBUG
1059 std::cerr <<
"class " <<
typeid(
NumpyArray).name() <<
" got " << obj->ob_type->tp_name <<
"\n";
1060 std::cerr <<
"using traits " <<
typeid(ArrayTraits).name() <<
"\n";
1061 std::cerr<<
"isArray: "<< ArrayTraits::isArray(obj)<<std::endl;
1062 std::cerr<<
"isShapeCompatible: "<< ArrayTraits::isShapeCompatible((PyArrayObject *)obj)<<std::endl;
1065 return ArrayTraits::isArray(obj) &&
1066 ArrayTraits::isShapeCompatible((PyArrayObject *)obj);
1077 return ArrayTraits::isArray(obj) &&
1078 ArrayTraits::isPropertyCompatible((PyArrayObject *)obj);
1097 for(
unsigned int k=0; k<N; ++k)
1151 vigra_precondition(!
hasData(),
1152 "makeUnsafeReference(): cannot replace existing view with given buffer");
1155 python_ptr array(ArrayTraits::unsafeConstructorFromData(multiArrayView.
shape(),
1156 multiArrayView.
data(), multiArrayView.
stride()));
1158 view_type::operator=(multiArrayView);
1170#if VIGRA_CONVERTER_DEBUG
1171 int ndim = PyArray_NDIM((PyArrayObject *)obj);
1172 npy_intp * s = PyArray_DIMS((PyArrayObject *)obj);
1175 std::cerr <<
"for " <<
typeid(*this).name() <<
"\n";
1178 "NumpyArray::makeCopy(obj): Cannot copy an incompatible array.");
1196 "NumpyArray.reshape(shape): Python constructor did not produce a compatible array.");
1218 ArrayTraits::finalizeTaggedShape(tagged_shape);
1222 vigra_precondition(tagged_shape.compatible(taggedShape()), message.c_str());
1226 python_ptr array(constructArray(tagged_shape, typeCode,
true),
1227 python_ptr::keep_count);
1229 "NumpyArray.reshapeIfEmpty(): Python constructor did not produce a compatible array.");
1233 TaggedShape taggedShape()
const
1235 return ArrayTraits::taggedShape(this->
shape(), PyAxisTags(this->
axistags(),
true));
1240template <
unsigned int N,
class T,
class Str
ide>
1241void NumpyArray<N, T, Stride>::setupArrayView()
1245 permutation_type permute;
1246 ArrayTraits::permutationToSetupOrder(this->pyArray_, permute);
1248 vigra_precondition(
abs((
int)permute.size() - actual_dimension) <= 1,
1249 "NumpyArray::setupArrayView(): got array of incompatible shape (should never happen).");
1252 PyArray_DIMS(pyArray()), this->m_shape.begin());
1254 PyArray_STRIDES(pyArray()), this->m_stride.begin());
1256 if((
int)permute.size() == actual_dimension - 1)
1258 this->m_shape[actual_dimension-1] = 1;
1259 this->m_stride[actual_dimension-1] =
sizeof(value_type);
1262 this->m_stride /=
sizeof(value_type);
1264 for(
int k=0; k<actual_dimension; ++k)
1266 if(this->m_stride[k] == 0)
1268 vigra_precondition(this->m_shape[k] == 1,
1269 "NumpyArray::setupArrayView(): only singleton axes may have zero stride.");
1270 this->m_stride[k] = 1;
1274 this->m_ptr =
reinterpret_cast<pointer
>(PyArray_DATA(pyArray()));
1275 vigra_precondition(this->checkInnerStride(Stride()),
1276 "NumpyArray<..., UnstridedArrayTag>::setupArrayView(): First dimension of given array is not unstrided (should never happen).");
1302template <
class PixelType,
class Str
ide>
1303inline triple<ConstStridedImageIterator<PixelType>,
1305 MultibandVectorAccessor<PixelType> >
1306srcImageRange(
NumpyArray<3, Multiband<PixelType>, Stride>
const & img)
1309 ul(img.data(), 1, img.stride(0), img.stride(1));
1310 return triple<ConstStridedImageIterator<PixelType>,
1312 MultibandVectorAccessor<PixelType> >
1313 (ul, ul +
Size2D(img.shape(0), img.shape(1)), MultibandVectorAccessor<PixelType>(img.shape(2), img.stride(2)));
1316template <
class PixelType,
class Str
ide>
1317inline pair< ConstStridedImageIterator<PixelType>,
1318 MultibandVectorAccessor<PixelType> >
1319srcImage(
NumpyArray<3, Multiband<PixelType>, Stride>
const & img)
1322 ul(img.data(), 1, img.stride(0), img.stride(1));
1323 return pair<ConstStridedImageIterator<PixelType>, MultibandVectorAccessor<PixelType> >
1324 (ul, MultibandVectorAccessor<PixelType>(img.shape(2), img.stride(2)));
1327template <
class PixelType,
class Str
ide>
1328inline triple< StridedImageIterator<PixelType>,
1330 MultibandVectorAccessor<PixelType> >
1331destImageRange(
NumpyArray<3, Multiband<PixelType>, Stride> & img)
1334 ul(img.data(), 1, img.stride(0), img.stride(1));
1335 return triple<StridedImageIterator<PixelType>,
1337 MultibandVectorAccessor<PixelType> >
1338 (ul, ul +
Size2D(img.shape(0), img.shape(1)),
1339 MultibandVectorAccessor<PixelType>(img.shape(2), img.stride(2)));
1342template <
class PixelType,
class Str
ide>
1343inline pair< StridedImageIterator<PixelType>,
1344 MultibandVectorAccessor<PixelType> >
1345destImage(
NumpyArray<3, Multiband<PixelType>, Stride> & img)
1348 ul(img.data(), 1, img.stride(0), img.stride(1));
1349 return pair<StridedImageIterator<PixelType>, MultibandVectorAccessor<PixelType> >
1350 (ul, MultibandVectorAccessor<PixelType>(img.shape(2), img.stride(2)));
1353template <
class PixelType,
class Str
ide>
1354inline pair< ConstStridedImageIterator<PixelType>,
1355 MultibandVectorAccessor<PixelType> >
1356maskImage(
NumpyArray<3, Multiband<PixelType>, Stride>
const & img)
1359 ul(img.data(), 1, img.stride(0), img.stride(1));
1360 return pair<ConstStridedImageIterator<PixelType>, MultibandVectorAccessor<PixelType> >
1361 (ul, MultibandVectorAccessor<PixelType>(img.shape(2), img.stride(2)));
Definition array_vector.hxx:77
Definition array_vector.hxx:514
Const iterator to be used when pixels are to be skipped.
Definition imageiterator.hxx:1030
difference_type strideOrdering() const
Definition multi_array.hxx:1619
vigra::detail::MultiIteratorChooser< Stride >::template Traverser< actual_dimension, typename ArrayTraits::value_type, Tconst &, Tconst * >::type const_traverser
Definition multi_array.hxx:769
const value_type * const_pointer
Definition multi_array.hxx:735
MultiArrayIndex difference_type_1
Definition multi_array.hxx:751
typename ArrayTraits::value_type value_type
Definition multi_array.hxx:719
bool hasData() const
Definition multi_array.hxx:1915
const difference_type & shape() const
Definition multi_array.hxx:1650
StridedScanOrderIterator< actual_dimension, typename ArrayTraits::value_type, typename ArrayTraits::value_type const &, typename ArrayTraits::value_type const * > const_iterator
Definition multi_array.hxx:759
MultiArrayView & init(const U &init)
Definition multi_array.hxx:1208
MultiArrayShape< actual_dimension >::type difference_type
Definition multi_array.hxx:739
void copy(const MultiArrayView &rhs)
Definition multi_array.hxx:1218
difference_type size_type
Definition multi_array.hxx:747
value_type & reference
Definition multi_array.hxx:723
const difference_type & stride() const
Definition multi_array.hxx:1686
pointer data() const
Definition multi_array.hxx:1900
MultiArrayView()
Definition multi_array.hxx:829
vigra::detail::MultiIteratorChooser< Stride >::template Traverser< actual_dimension, typename ArrayTraits::value_type, typename ArrayTraits::value_type &, typename ArrayTraits::value_type * >::type traverser
Definition multi_array.hxx:764
value_type * pointer
Definition multi_array.hxx:731
StridedScanOrderIterator< actual_dimension, typename ArrayTraits::value_type, typename ArrayTraits::value_type &, typename ArrayTraits::value_type * > iterator
Definition multi_array.hxx:755
const value_type & const_reference
Definition multi_array.hxx:727
Definition numpy_array.hxx:253
difference_type strideOrdering() const
Definition numpy_array.hxx:422
difference_type shape() const
Definition numpy_array.hxx:411
NumpyAnyArray getitem(Shape start, Shape stop) const
Definition numpy_array.hxx:489
bool hasData() const
Definition numpy_array.hxx:604
ArrayVector< npy_intp > difference_type
difference type
Definition numpy_array.hxx:260
PyObject * pyObject() const
Definition numpy_array.hxx:556
MultiArrayIndex ndim() const
Definition numpy_array.hxx:367
NumpyAnyArray & operator=(NumpyAnyArray const &other)
Definition numpy_array.hxx:330
void makeCopy(PyObject *obj, PyTypeObject *type=0)
Definition numpy_array.hxx:590
python_ptr axistags() const
Definition numpy_array.hxx:531
int dtype() const
Definition numpy_array.hxx:477
PyArrayObject * pyArray() const
Definition numpy_array.hxx:547
NumpyAnyArray(NumpyAnyArray const &other, bool createCopy=false, PyTypeObject *type=0)
Definition numpy_array.hxx:306
bool makeReference(PyObject *obj, PyTypeObject *type=0)
Definition numpy_array.hxx:569
MultiArrayIndex spatialDimensions() const
Definition numpy_array.hxx:379
NumpyAnyArray(PyObject *obj=0, bool createCopy=false, PyTypeObject *type=0)
Definition numpy_array.hxx:289
Definition numpy_array.hxx:719
difference_type strideOrdering() const
void makeUnsafeReference(const view_type &multiArrayView)
Definition numpy_array.hxx:1149
static bool isStrictlyCompatible(PyObject *obj)
Definition numpy_array.hxx:1084
view_type::const_traverser const_traverser
Definition numpy_array.hxx:775
view_type::const_reference const_reference
Definition numpy_array.hxx:751
ArrayVector< U > permuteLikewise(ArrayVector< U > const &data) const
Definition numpy_array.hxx:1007
bool hasData() const
Definition multi_array.hxx:1915
static difference_type standardStrideOrdering()
Definition numpy_array.hxx:1094
TinyVector< npy_intp, K > permuteLikewise() const
Definition numpy_array.hxx:1039
NumpyArray(const MultiArrayView< N, U, S > &other)
Definition numpy_array.hxx:855
NumpyArray & operator=(const NumpyAnyArray &other)
Definition numpy_array.hxx:983
NumpyArray(PyObject *obj=0, bool createCopy=false)
Definition numpy_array.hxx:821
view_type::size_type size_type
Definition numpy_array.hxx:755
void reshapeIfEmpty(difference_type const &shape, std::string message="")
Definition numpy_array.hxx:1204
static bool isCopyCompatible(PyObject *obj)
Definition numpy_array.hxx:1056
static bool isReferenceCompatible(PyObject *obj)
Definition numpy_array.hxx:1075
NumpyArray & operator=(const NumpyArray< N, U, S > &other)
Definition numpy_array.hxx:930
bool makeReference(PyObject *obj, bool=false)
Definition numpy_array.hxx:1120
view_type::iterator iterator
Definition numpy_array.hxx:779
view_type::difference_type_1 difference_type_1
Definition numpy_array.hxx:763
view_type::const_pointer const_pointer
Definition numpy_array.hxx:743
const difference_type & shape() const
Definition multi_array.hxx:1650
TinyVector< U, K > permuteLikewise(TinyVector< U, K > const &data) const
Definition numpy_array.hxx:1023
view_type::difference_type difference_type
Definition numpy_array.hxx:759
view_type::pointer pointer
Definition numpy_array.hxx:739
view_type::reference reference
Definition numpy_array.hxx:747
void reshape(difference_type const &shape)
Definition numpy_array.hxx:1193
void makeReferenceUnchecked(PyObject *obj)
Definition numpy_array.hxx:1107
MultiArrayView< N, typename ArrayTraits::value_type, Stride > view_type
Definition numpy_array.hxx:729
NumpyArray(difference_type const &shape, std::string const &order="")
Definition numpy_array.hxx:871
void makeCopy(PyObject *obj, bool strict=false)
Definition numpy_array.hxx:1168
view_type::const_iterator const_iterator
Definition numpy_array.hxx:783
NumpyAnyArray::difference_type permutation_type
Definition numpy_array.hxx:767
NumpyArray(TaggedShape const &tagged_shape)
Definition numpy_array.hxx:883
void reshapeIfEmpty(TaggedShape tagged_shape, std::string message="")
Definition numpy_array.hxx:1216
bool makeReference(const NumpyAnyArray &array, bool strict=false)
Definition numpy_array.hxx:1134
NumpyArray & operator=(const MultiArrayView< N, U, S > &other)
Definition numpy_array.hxx:956
NumpyArray(const NumpyAnyArray &other, bool createCopy=false)
Definition numpy_array.hxx:893
view_type::traverser traverser
Definition numpy_array.hxx:771
view_type::value_type value_type
Definition numpy_array.hxx:735
NumpyArray(const NumpyArray &other, bool createCopy=false)
Definition numpy_array.hxx:839
NumpyArray & operator=(const NumpyArray &other)
Definition numpy_array.hxx:912
Two dimensional size object.
Definition diff2d.hxx:483
Iterator to be used when pixels are to be skipped.
Definition imageiterator.hxx:969
Class for fixed size vectors.
Definition tinyvector.hxx:1008
void linearSequence(Iterator first, Iterator last, Value start, Value step)
Fill an array with a sequence of numbers.
Definition algorithm.hxx:208
FFTWComplex< R >::NormType abs(const FFTWComplex< R > &a)
absolute value (= magnitude)
Definition fftw3.hxx:1002
std::ptrdiff_t MultiArrayIndex
Definition multi_fwd.hxx:60
void applyPermutation(IndexIterator index_first, IndexIterator index_last, InIterator in, OutIterator out)
Sort an array according to the given index permutation.
Definition algorithm.hxx:456