xstrided_view¶
Defined in xtensor/xstrided_view.hpp
-
template<class
CT, classS, layout_typeL= layout_type::dynamic, classFST= detail::flat_storage_getter<CT, xt::layout_type::row_major>>
classxstrided_view: public xt::xview_semantic<xstrided_view<CT, S, L, FST>>, public select_iterable_base_t<L, std::decay_t<CT>::static_layout, xstrided_view<CT, S, L, FST>>, private xt::xstrided_view_base<xstrided_view<CT, S, L, FST>>, public extension::xstrided_view_base_t<CT, S, L, FST>¶ View of an xexpression using strides.
The xstrided_view class implements a view utilizing an initial offset and strides.
- See
- Template Parameters
CT: the closure type of the xexpression type underlying this viewL: the layout of the strided viewS: the strides type of the strided viewFST: the flat storage type used for the strided view
Extended copy semantic
-
template<class
E>
autooperator=(const xexpression<E> &e)¶ The extended assignment operator.
Constructor
-
template<class
CTA, classSA>xstrided_view(CTA &&e, SA &&shape, strides_type &&strides, std::size_t offset, layout_type layout)¶ Constructs an xstrided_view.
- Parameters
e: the underlying xexpression for this viewshape: the shape of the viewstrides: the strides of the viewoffset: the offset of the first element in the underlying containerlayout: the layout of the view
-
typedef
xt::xstrided_slice_vector¶ vector of slices used to build a
xstrided_view
-
template<layout_type
L= layout_type::dynamic, classE, classS, classX>
autoxt::strided_view(E &&e, S &&shape, X &&stride, std::size_t offset = 0, layout_type layout = L) Construct a strided view from an xexpression, shape, strides and offset.
- Return
the view
- Parameters
e: xexpressionshape: the shape of the viewstrides: the new strides of the viewoffset: the offset of the first element in the underlying containerlayout: the new layout of the expression
- Template Parameters
L: the static layout type of the view (default: dynamic)E: type of xexpressionS: strides typeX: strides type
-
template<class
E>
autoxt::strided_view(E &&e, const xstrided_slice_vector &slices) Function to create a dynamic view from an xexpression and an xstrided_slice_vector.
xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}}; xt::xstrided_slice_vector sv({xt::range(0, 1)}); sv.push_back(xt::range(0, 3, 2)); auto v = xt::strided_view(a, sv); // ==> {{1, 3}}
- Return
initialized strided_view according to slices
- Parameters
e: xexpressionslices: the slice vector
You can also achieve the same with the following short-hand syntax:
xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}}; auto v = xt::strided_view(a, {xt::range(0, 1), xt::range(0, 3, 2)}); // ==> {{1, 3}}
-
template<layout_type
L= xt::layout_type::row_major, classE, classS>
autoxt::reshape_view(E &&e, S &&shape, layout_type) Return a view on a container with a new shape.
Note: if you resize the underlying container, this view becomes invalidated.
- Return
view on xexpression with new shape
- Parameters
e: xexpression to reshapeshape: new shapeorder: traversal order (optional)