Lines Matching defs:strides

34    and dimension types (e.g. shape, strides, indexing), instead of inflicting this
65 ssize_t *strides;
328 ssize_t byte_offset_unsafe(const Strides &strides, ssize_t i, Ix... index) {
329 return i * strides[Dim] + byte_offset_unsafe<Dim + 1>(strides, index...);
342 // Storing the shape & strides in local variables (i.e. these arrays) allows the compiler to
351 unchecked_reference(const void *data, const ssize_t *shape, const ssize_t *strides, enable_if_t<!Dyn, ssize_t>)
355 strides_[i] = strides[i];
360 unchecked_reference(const void *data, const ssize_t *shape, const ssize_t *strides, enable_if_t<Dyn, ssize_t> dims)
361 : data_{reinterpret_cast<const unsigned char *>(data)}, shape_{shape}, strides_{strides}, dims_{dims} {}
404 /// memory may be larger if the referenced array has non-contiguous strides (e.g. for a slice).
553 // Constructs an array taking shape/strides from arbitrary container types
554 array(const pybind11::dtype &dt, ShapeContainer shape, StridesContainer strides,
557 if (strides->empty())
558 *strides = c_strides(*shape, dt.itemsize());
561 if (ndim != strides->size())
562 pybind11_fail("NumPy: shape ndim doesn't match strides ndim");
577 api.PyArray_Type_, descr.release().ptr(), (int) ndim, shape->data(), strides->data(),
599 array(ShapeContainer shape, StridesContainer strides, const T *ptr, handle base = handle())
600 : array(pybind11::dtype::of<T>(), std::move(shape), std::move(strides), ptr, base) { }
610 : array(pybind11::dtype(info), info.shape, info.strides, info.ptr) { }
655 const ssize_t* strides() const {
656 return detail::array_proxy(m_ptr)->strides;
660 ssize_t strides(ssize_t dim) const {
663 return strides()[dim];
721 return detail::unchecked_mutable_reference<T, Dims>(mutable_data(), shape(), strides(), ndim());
735 return detail::unchecked_reference<T, Dims>(data(), shape(), strides(), ndim());
778 return detail::byte_offset_unsafe(strides(), ssize_t(index)...);
786 // Default, C-style strides
789 std::vector<ssize_t> strides(ndim, itemsize);
792 strides[i - 1] = strides[i] * shape[i];
793 return strides;
796 // F-style strides; default when constructing an array_t with `ExtraFlags & f_style`
799 std::vector<ssize_t> strides(ndim, itemsize);
801 strides[i] = strides[i - 1] * shape[i - 1];
802 return strides;
835 array_t(private_ctor, ShapeContainer &&shape, StridesContainer &&strides, const T *ptr, handle base)
836 : array(std::move(shape), std::move(strides), ptr, base) {}
858 array_t(ShapeContainer shape, StridesContainer strides, const T *ptr = nullptr, handle base = handle())
859 : array(std::move(shape), std::move(strides), ptr, base) { }
1288 common_iterator(void* ptr, const container_type& strides, const container_type& shape)
1289 : p_ptr(reinterpret_cast<char*>(ptr)), m_strides(strides.size()) {
1290 m_strides.back() = static_cast<value_type>(strides.back());
1294 m_strides[j] = strides[j] + m_strides[i] - strides[i] * s;
1324 container_type strides(shape.size());
1326 init_common_iterator(buffers[i], shape, m_common_iterator[i], strides);
1353 container_type &strides) {
1355 auto buffer_strides_iter = buffer.strides.rbegin();
1357 auto strides_iter = strides.rbegin();
1371 std::fill(strides_iter, strides.rend(), 0);
1372 iterator = common_iter(buffer.ptr, strides, shape);
1435 for (auto shape_iter = buffers[i].shape.crbegin(), stride_iter = buffers[i].strides.crbegin();
1448 for (auto shape_iter = buffers[i].shape.cbegin(), stride_iter = buffers[i].strides.cbegin();