xtensor
Loading...
Searching...
No Matches
xt::xstrided_container< D > Class Template Reference

Partial implementation of xcontainer that embeds the strides and the shape. More...

#include <xcontainer.hpp>

Inheritance diagram for xt::xstrided_container< D >:
xt::xcontainer< D > xt::xcontiguous_iterable< D > xt::xaccessible< D > xt::xiterable< D >

Public Types

using base_type = xcontainer<D>
 
using storage_type = typename base_type::storage_type
 
using value_type = typename base_type::value_type
 
using reference = typename base_type::reference
 
using const_reference = typename base_type::const_reference
 
using pointer = typename base_type::pointer
 
using const_pointer = typename base_type::const_pointer
 
using size_type = typename base_type::size_type
 
using shape_type = typename base_type::shape_type
 
using strides_type = typename base_type::strides_type
 
using inner_shape_type = typename base_type::inner_shape_type
 
using inner_strides_type = typename base_type::inner_strides_type
 
using inner_backstrides_type = typename base_type::inner_backstrides_type
 
- Public Types inherited from xt::xcontainer< D >
using derived_type = D
 
using inner_types = xcontainer_inner_types<D>
 
using storage_type = typename inner_types::storage_type
 
using allocator_type = allocator_type_t<std::decay_t<storage_type>>
 
using value_type = typename storage_type::value_type
 
using reference = typename inner_types::reference
 
using const_reference = typename inner_types::const_reference
 
using pointer = typename storage_type::pointer
 
using const_pointer = typename storage_type::const_pointer
 
using size_type = typename inner_types::size_type
 
using difference_type = typename storage_type::difference_type
 
using simd_value_type = xt_simd::simd_type<value_type>
 
using bool_load_type = xt::bool_load_type<value_type>
 
using shape_type = typename inner_types::shape_type
 
using strides_type = typename inner_types::strides_type
 
using backstrides_type = typename inner_types::backstrides_type
 
using inner_shape_type = typename inner_types::inner_shape_type
 
using inner_strides_type = typename inner_types::inner_strides_type
 
using inner_backstrides_type = typename inner_types::inner_backstrides_type
 
using iterable_base = xcontiguous_iterable<D>
 
using stepper = typename iterable_base::stepper
 
using const_stepper = typename iterable_base::const_stepper
 
using accessible_base = xaccessible<D>
 
using data_alignment = xt_simd::container_alignment_t<storage_type>
 
using simd_type = xt_simd::simd_type<value_type>
 
using linear_iterator = typename iterable_base::linear_iterator
 
using const_linear_iterator = typename iterable_base::const_linear_iterator
 
using reverse_linear_iterator = typename iterable_base::reverse_linear_iterator
 
using const_reverse_linear_iterator = typename iterable_base::const_reverse_linear_iterator
 
template<class requested_type >
using simd_return_type = xt_simd::simd_return_type<value_type, requested_type>
 
using container_iterator = linear_iterator
 
using const_container_iterator = const_linear_iterator
 
- Public Types inherited from xt::xcontiguous_iterable< D >
using derived_type = D
 
using inner_types = xcontainer_inner_types<D>
 
using iterable_base = xiterable<D>
 
using stepper = typename iterable_base::stepper
 
using const_stepper = typename iterable_base::const_stepper
 
template<layout_type L>
using layout_iterator = typename iterable_base::template layout_iterator<L>
 
template<layout_type L>
using const_layout_iterator = typename iterable_base::template const_layout_iterator<L>
 
template<layout_type L>
using reverse_layout_iterator = typename iterable_base::template reverse_layout_iterator<L>
 
template<layout_type L>
using const_reverse_layout_iterator = typename iterable_base::template const_reverse_layout_iterator<L>
 
template<class S , layout_type L>
using broadcast_iterator = typename iterable_base::template broadcast_iterator<S, L>
 
template<class S , layout_type L>
using const_broadcast_iterator = typename iterable_base::template const_broadcast_iterator<S, L>
 
template<class S , layout_type L>
using reverse_broadcast_iterator = typename iterable_base::template reverse_broadcast_iterator<S, L>
 
template<class S , layout_type L>
using const_reverse_broadcast_iterator = typename iterable_base::template const_reverse_broadcast_iterator<S, L>
 
using linear_traits = detail::linear_iterator_traits<D>
 
using linear_iterator = typename linear_traits::linear_iterator
 
using const_linear_iterator = typename linear_traits::const_linear_iterator
 
using reverse_linear_iterator = typename linear_traits::reverse_linear_iterator
 
using const_reverse_linear_iterator = typename linear_traits::const_reverse_linear_iterator
 
template<layout_type L, class It1 , class It2 >
using select_iterator_impl = std::conditional_t<L == static_layout, It1, It2>
 
template<layout_type L>
using select_iterator = select_iterator_impl<L, linear_iterator, layout_iterator<L>>
 
template<layout_type L>
using select_const_iterator = select_iterator_impl<L, const_linear_iterator, const_layout_iterator<L>>
 
template<layout_type L>
using select_reverse_iterator = select_iterator_impl<L, reverse_linear_iterator, reverse_layout_iterator<L>>
 
template<layout_type L>
using select_const_reverse_iterator
 
using iterator = select_iterator< ::xt::layout_type::row_major >
 
using const_iterator = select_const_iterator< ::xt::layout_type::row_major >
 
using reverse_iterator = select_reverse_iterator< ::xt::layout_type::row_major >
 
using const_reverse_iterator = select_const_reverse_iterator< ::xt::layout_type::row_major >
 

Protected Member Functions

 xstrided_container (const xstrided_container &)=default
 
xstrided_containeroperator= (const xstrided_container &)=default
 
 xstrided_container (xstrided_container &&)=default
 
xstrided_containeroperator= (xstrided_container &&)=default
 
- Protected Member Functions inherited from xt::xcontainer< D >
 xcontainer (const xcontainer &)=default
 
xcontaineroperator= (const xcontainer &)=default
 
 xcontainer (xcontainer &&)=default
 
xcontaineroperator= (xcontainer &&)=default
 
container_iterator data_xbegin () noexcept
 
const_container_iterator data_xbegin () const noexcept
 
container_iterator data_xend (layout_type l, size_type offset) noexcept
 
const_container_iterator data_xend (layout_type l, size_type offset) const noexcept
 
derived_type & derived_cast () &noexcept
 
const derived_type & derived_cast () const &noexcept
 
derived_type derived_cast () &&noexcept
 

Broadcasting

template<class S = shape_type>
void resize (S &&shape, bool force=false)
 Resizes the container.
 
template<class S = shape_type>
void resize (S &&shape, layout_type l)
 Resizes the container.
 
template<class S = shape_type>
void resize (S &&shape, const strides_type &strides)
 Resizes the container.
 
template<class S = shape_type>
autoreshape (S &&shape, layout_type layout=base_type::static_layout) &
 Reshapes the container and keeps old elements.
 
template<class T >
autoreshape (std::initializer_list< T > shape, layout_type layout=base_type::static_layout) &
 
layout_type layout () const noexcept
 Return the layout_type of the container.
 
bool is_contiguous () const noexcept
 
 xstrided_container (inner_shape_type &&, inner_strides_type &&) noexcept
 
 xstrided_container (inner_shape_type &&, inner_strides_type &&, inner_backstrides_type &&, layout_type &&) noexcept
 
inner_shape_type & shape_impl () noexcept
 
const inner_shape_type & shape_impl () const noexcept
 
inner_strides_type & strides_impl () noexcept
 
const inner_strides_type & strides_impl () const noexcept
 
inner_backstrides_type & backstrides_impl () noexcept
 
const inner_backstrides_type & backstrides_impl () const noexcept
 
template<class S = shape_type>
void reshape_impl (S &&shape, std::true_type, layout_type layout=base_type::static_layout)
 
template<class S = shape_type>
void reshape_impl (S &&shape, std::false_type, layout_type layout=base_type::static_layout)
 
layout_typemutable_layout () noexcept
 

Additional Inherited Members

- Public Member Functions inherited from xt::xcontainer< D >
template<class... Args>
reference operator() (Args... args)
 
template<class... Args>
const_reference operator() (Args... args) const
 
template<class... Args>
reference unchecked (Args... args)
 
template<class... Args>
const_reference unchecked (Args... args) const
 
template<class It >
reference element (It first, It last)
 
template<class It >
const_reference element (It first, It last) const
 
template<class S >
stepper stepper_begin (const S &shape) noexcept
 
template<class S >
stepper stepper_end (const S &shape, layout_type l) noexcept
 
template<class S >
const_stepper stepper_begin (const S &shape) const noexcept
 
template<class S >
const_stepper stepper_end (const S &shape, layout_type l) const noexcept
 
template<class align , class requested_type = value_type, std::size_t N = xt_simd::simd_traits<requested_type>::size>
container_simd_return_type_t< storage_type, value_type, requested_typeload_simd (size_type i) const
 
template<class... Args>
reference at (Args... args)
 
template<class... Args>
auto at (Args... args) -> reference
 Returns a reference to the element at the specified position in the expression, after dimension and bounds checking.
 
template<class... Args>
const_reference at (Args... args) const
 
template<class... Args>
auto at (Args... args) const -> const_reference
 Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking.
 
reference back ()
 Returns a reference to the last element of the expression.
 
const_reference back () const
 Returns a constant reference to last the element of the expression.
 
reference front ()
 Returns a reference to the first element of the expression.
 
const_reference front () const
 Returns a constant reference to first the element of the expression.
 
template<class... Args>
reference periodic (Args... args)
 
template<class... Args>
auto periodic (Args... args) -> reference
 Returns a reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and 'overflowing' indices are changed).
 
template<class... Args>
const_reference periodic (Args... args) const
 
template<class... Args>
auto periodic (Args... args) const -> const_reference
 Returns a constant reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and 'overflowing' indices are changed).
 
size_type size () const noexcept
 Returns the number of element in the container.
 
constexpr size_type dimension () const noexcept
 Returns the number of dimensions of the container.
 
constexpr const inner_shape_type & shape () const noexcept
 Returns the shape of the container.
 
constexpr const inner_strides_type & strides () const noexcept
 Returns the strides of the container.
 
constexpr const inner_backstrides_type & backstrides () const noexcept
 Returns the backstrides of the container.
 
template<class T >
void fill (const T &value)
 Fills the container with the given value.
 
storage_type & storage () noexcept
 Returns a reference to the buffer containing the elements of the container.
 
const storage_type & storage () const noexcept
 Returns a constant reference to the buffer containing the elements of the container.
 
pointer data () noexcept
 Returns a pointer to the underlying array serving as element storage.
 
const_pointer data () const noexcept
 Returns a constant pointer to the underlying array serving as element storage.
 
const size_type data_offset () const noexcept
 Returns the offset to the first element in the container.
 
template<class... Args>
auto operator() (Args... args) -> reference
 Returns a reference to the element at the specified position in the container.
 
template<class... Args>
auto operator() (Args... args) const -> const_reference
 Returns a constant reference to the element at the specified position in the container.
 
template<class... Args>
auto unchecked (Args... args) -> reference
 Returns a reference to the element at the specified position in the container.
 
template<class... Args>
auto unchecked (Args... args) const -> const_reference
 Returns a constant reference to the element at the specified position in the container.
 
template<class It >
auto element (It first, It last) -> reference
 Returns a reference to the element at the specified position in the container.
 
template<class It >
auto element (It first, It last) const -> const_reference
 Returns a reference to the element at the specified position in the container.
 
template<class S >
bool broadcast_shape (S &shape, bool reuse_cache=false) const
 Broadcast the shape of the container to the specified parameter.
 
template<class S >
bool has_linear_assign (const S &strides) const noexcept
 Checks whether the xcontainer can be linearly assigned to an expression with the specified strides.
 
reference data_element (size_type i)
 
const_reference data_element (size_type i) const
 
reference flat (size_type i)
 Returns a reference to the element at the specified position in the container storage (as if it was one dimensional).
 
const_reference flat (size_type i) const
 Returns a constant reference to the element at the specified position in the container storage (as if it was one dimensional).
 
template<class align , class simd >
void store_simd (size_type i, const simd &e)
 
linear_iterator linear_begin () noexcept
 
linear_iterator linear_end () noexcept
 
const_linear_iterator linear_begin () const noexcept
 
const_linear_iterator linear_end () const noexcept
 
const_linear_iterator linear_cbegin () const noexcept
 
const_linear_iterator linear_cend () const noexcept
 
reverse_linear_iterator linear_rbegin () noexcept
 
reverse_linear_iterator linear_rend () noexcept
 
const_reverse_linear_iterator linear_rbegin () const noexcept
 
const_reverse_linear_iterator linear_rend () const noexcept
 
const_reverse_linear_iterator linear_crbegin () const noexcept
 
const_reverse_linear_iterator linear_crend () const noexcept
 
template<class S >
auto stepper_begin (const S &shape) noexcept -> stepper
 
template<class S >
auto stepper_end (const S &shape, layout_type l) noexcept -> stepper
 
template<class S >
auto stepper_begin (const S &shape) const noexcept -> const_stepper
 
template<class S >
auto stepper_end (const S &shape, layout_type l) const noexcept -> const_stepper
 
template<class alignment , class requested_type , std::size_t N>
auto load_simd (size_type i) const -> container_simd_return_type_t< storage_type, value_type, requested_type >
 
- Public Member Functions inherited from xt::xcontiguous_iterable< D >
template<layout_type L = ::xt::layout_type::row_major>
select_iterator< Lbegin () noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_iterator< Lend () noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< Lbegin () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< Lend () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< Lcbegin () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< Lcend () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_reverse_iterator< Lrbegin () noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_reverse_iterator< Lrend () noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< Lrbegin () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< Lrend () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< Lcrbegin () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< Lcrend () const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
broadcast_iterator< S, Lbegin (const S &shape) noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
broadcast_iterator< S, Lend (const S &shape) noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_broadcast_iterator< S, Lbegin (const S &shape) const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_broadcast_iterator< S, Lend (const S &shape) const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_broadcast_iterator< S, Lcbegin (const S &shape) const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_broadcast_iterator< S, Lcend (const S &shape) const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
reverse_broadcast_iterator< S, Lrbegin (const S &shape) noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
reverse_broadcast_iterator< S, Lrend (const S &shape) noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_reverse_broadcast_iterator< S, Lrbegin (const S &shape) const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_reverse_broadcast_iterator< S, Lrend (const S &shape) const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_reverse_broadcast_iterator< S, Lcrbegin (const S &shape) const noexcept
 
template<layout_type L = ::xt::layout_type::row_major, class S >
const_reverse_broadcast_iterator< S, Lcrend (const S &shape) const noexcept
 
template<layout_type L>
auto begin () noexcept -> select_iterator< L >
 Returns an iterator to the first element of the expression.
 
template<layout_type L>
auto end () noexcept -> select_iterator< L >
 Returns an iterator to the element following the last element of the expression.
 
template<layout_type L>
auto begin () const noexcept -> select_const_iterator< L >
 Returns a constant iterator to the first element of the expression.
 
template<layout_type L>
auto end () const noexcept -> select_const_iterator< L >
 Returns a constant iterator to the element following the last element of the expression.
 
template<layout_type L>
auto cbegin () const noexcept -> select_const_iterator< L >
 Returns a constant iterator to the first element of the expression.
 
template<layout_type L>
auto cend () const noexcept -> select_const_iterator< L >
 Returns a constant iterator to the element following the last element of the expression.
 
template<layout_type L>
auto rbegin () noexcept -> select_reverse_iterator< L >
 Returns an iterator to the first element of the reversed expression.
 
template<layout_type L>
auto rend () noexcept -> select_reverse_iterator< L >
 Returns an iterator to the element following the last element of the reversed expression.
 
template<layout_type L>
auto rbegin () const noexcept -> select_const_reverse_iterator< L >
 Returns a constant iterator to the first element of the reversed expression.
 
template<layout_type L>
auto rend () const noexcept -> select_const_reverse_iterator< L >
 Returns a constant iterator to the element following the last element of the reversed expression.
 
template<layout_type L>
auto crbegin () const noexcept -> select_const_reverse_iterator< L >
 Returns a constant iterator to the first element of the reversed expression.
 
template<layout_type L>
auto crend () const noexcept -> select_const_reverse_iterator< L >
 Returns a constant iterator to the element following the last element of the reversed expression.
 
template<layout_type L, class S >
auto begin (const S &shape) noexcept -> broadcast_iterator< S, L >
 Returns an iterator to the first element of the expression.
 
template<layout_type L, class S >
auto end (const S &shape) noexcept -> broadcast_iterator< S, L >
 Returns an iterator to the element following the last element of the expression.
 
template<layout_type L, class S >
auto begin (const S &shape) const noexcept -> const_broadcast_iterator< S, L >
 Returns a constant iterator to the first element of the expression.
 
template<layout_type L, class S >
auto end (const S &shape) const noexcept -> const_broadcast_iterator< S, L >
 Returns a constant iterator to the element following the last element of the expression.
 
template<layout_type L, class S >
auto cbegin (const S &shape) const noexcept -> const_broadcast_iterator< S, L >
 Returns a constant iterator to the first element of the expression.
 
template<layout_type L, class S >
auto cend (const S &shape) const noexcept -> const_broadcast_iterator< S, L >
 Returns a constant iterator to the element following the last element of the expression.
 
template<layout_type L, class S >
auto rbegin (const S &shape) noexcept -> reverse_broadcast_iterator< S, L >
 Returns an iterator to the first element of the reversed expression.
 
template<layout_type L, class S >
auto rend (const S &shape) noexcept -> reverse_broadcast_iterator< S, L >
 Returns an iterator to the element following the last element of the reversed expression.
 
template<layout_type L, class S >
auto rbegin (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L >
 Returns a constant iterator to the first element of the reversed expression.
 
template<layout_type L, class S >
auto rend (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L >
 Returns a constant iterator to the element following the last element of the reversed expression.
 
template<layout_type L, class S >
auto crbegin (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L >
 Returns a constant iterator to the first element of the reversed expression.
 
template<layout_type L, class S >
auto crend (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L >
 Returns a constant iterator to the element following the last element of the reversed expression.
 
- Static Public Attributes inherited from xt::xcontainer< D >
static constexpr layout_type static_layout = inner_types::layout
 
static constexpr bool contiguous_layout = static_layout != layout_type::dynamic
 
- Static Public Attributes inherited from xt::xcontiguous_iterable< D >
static constexpr layout_type static_layout = inner_types::layout
 

Detailed Description

template<class D>
class xt::xstrided_container< D >

Partial implementation of xcontainer that embeds the strides and the shape.

The xstrided_container class is a partial implementation of the xcontainer interface that embed the strides and the shape of the multidimensional container. It does not embed the data container, this responsibility is delegated to the inheriting classes.

Template Parameters
DThe derived type, i.e. the inheriting class for which xstrided_container provides the partial imlpementation of xcontainer.

Definition at line 260 of file xcontainer.hpp.

Member Typedef Documentation

◆ base_type

template<class D >
using xt::xstrided_container< D >::base_type = xcontainer<D>

Definition at line 264 of file xcontainer.hpp.

◆ const_pointer

template<class D >
using xt::xstrided_container< D >::const_pointer = typename base_type::const_pointer

Definition at line 270 of file xcontainer.hpp.

◆ const_reference

template<class D >
using xt::xstrided_container< D >::const_reference = typename base_type::const_reference

Definition at line 268 of file xcontainer.hpp.

◆ inner_backstrides_type

template<class D >
using xt::xstrided_container< D >::inner_backstrides_type = typename base_type::inner_backstrides_type

Definition at line 276 of file xcontainer.hpp.

◆ inner_shape_type

template<class D >
using xt::xstrided_container< D >::inner_shape_type = typename base_type::inner_shape_type

Definition at line 274 of file xcontainer.hpp.

◆ inner_strides_type

template<class D >
using xt::xstrided_container< D >::inner_strides_type = typename base_type::inner_strides_type

Definition at line 275 of file xcontainer.hpp.

◆ pointer

template<class D >
using xt::xstrided_container< D >::pointer = typename base_type::pointer

Definition at line 269 of file xcontainer.hpp.

◆ reference

template<class D >
using xt::xstrided_container< D >::reference = typename base_type::reference

Definition at line 267 of file xcontainer.hpp.

◆ shape_type

template<class D >
using xt::xstrided_container< D >::shape_type = typename base_type::shape_type

Definition at line 272 of file xcontainer.hpp.

◆ size_type

template<class D >
using xt::xstrided_container< D >::size_type = typename base_type::size_type

Definition at line 271 of file xcontainer.hpp.

◆ storage_type

template<class D >
using xt::xstrided_container< D >::storage_type = typename base_type::storage_type

Definition at line 265 of file xcontainer.hpp.

◆ strides_type

template<class D >
using xt::xstrided_container< D >::strides_type = typename base_type::strides_type

Definition at line 273 of file xcontainer.hpp.

◆ value_type

template<class D >
using xt::xstrided_container< D >::value_type = typename base_type::value_type

Definition at line 266 of file xcontainer.hpp.

Constructor & Destructor Documentation

◆ xstrided_container() [1/3]

template<class D >
xt::xstrided_container< D >::xstrided_container ( )
inlineprotectednoexcept

Definition at line 851 of file xcontainer.hpp.

◆ xstrided_container() [2/3]

template<class D >
xt::xstrided_container< D >::xstrided_container ( inner_shape_type && shape,
inner_strides_type && strides )
inlineexplicitprotectednoexcept

Definition at line 860 of file xcontainer.hpp.

◆ xstrided_container() [3/3]

template<class D >
xt::xstrided_container< D >::xstrided_container ( inner_shape_type && shape,
inner_strides_type && strides,
inner_backstrides_type && backstrides,
layout_type && layout )
inlineexplicitprotectednoexcept

Definition at line 870 of file xcontainer.hpp.

Member Function Documentation

◆ backstrides_impl() [1/2]

template<class D >
auto xt::xstrided_container< D >::backstrides_impl ( ) const
inlineprotectednoexcept

Definition at line 915 of file xcontainer.hpp.

◆ backstrides_impl() [2/2]

template<class D >
auto xt::xstrided_container< D >::backstrides_impl ( )
inlineprotectednoexcept

Definition at line 909 of file xcontainer.hpp.

◆ is_contiguous()

template<class D >
bool xt::xstrided_container< D >::is_contiguous ( ) const
inlinenoexcept

Definition at line 931 of file xcontainer.hpp.

◆ layout()

template<class D >
layout_type xt::xstrided_container< D >::layout ( ) const
inlinenoexcept

Return the layout_type of the container.

Returns
layout_type of the container

Definition at line 925 of file xcontainer.hpp.

◆ mutable_layout()

template<class D >
auto xt::xstrided_container< D >::mutable_layout ( )
inlineprotectednoexcept

Definition at line 1186 of file xcontainer.hpp.

◆ reshape() [1/2]

template<class D >
template<class S >
auto & xt::xstrided_container< D >::reshape ( S && shape,
layout_type layout = base_type::static_layout ) &
inline

Reshapes the container and keeps old elements.

The shape argument can have one of its value equal to -1, in this case the value is inferred from the number of elements in the container and the remaining values in the shape.

xt::xarray<int> a = { 1, 2, 3, 4, 5, 6, 7, 8 };
a.reshape({-1, 4});
//a.shape() is {2, 4}
Parameters
shapethe new shape (has to have same number of elements as the original container)
layoutthe layout to compute the strides (defaults to static layout of the container, or for a container with dynamic layout to XTENSOR_DEFAULT_LAYOUT)

Definition at line 1094 of file xcontainer.hpp.

◆ reshape() [2/2]

template<class D >
template<class T >
auto & xt::xstrided_container< D >::reshape ( std::initializer_list< T > shape,
layout_type layout = base_type::static_layout ) &
inline

Definition at line 1106 of file xcontainer.hpp.

◆ reshape_impl() [1/2]

template<class D >
template<class S >
void xt::xstrided_container< D >::reshape_impl ( S && shape,
std::false_type ,
layout_type layout = base_type::static_layout )
inlineprotected

Definition at line 1118 of file xcontainer.hpp.

◆ reshape_impl() [2/2]

template<class D >
template<class S >
void xt::xstrided_container< D >::reshape_impl ( S && shape,
std::true_type ,
layout_type layout = base_type::static_layout )
inlineprotected

Definition at line 1145 of file xcontainer.hpp.

◆ resize() [1/3]

template<class D >
template<class S >
void xt::xstrided_container< D >::resize ( S && shape,
bool force = false )
inline

Resizes the container.

Warning
Contrary to STL containers like std::vector, resize does NOT preserve the container elements.
Parameters
shapethe new shape
forceforce reshaping, even if the shape stays the same (default: false)

Definition at line 1000 of file xcontainer.hpp.

◆ resize() [2/3]

template<class D >
template<class S >
void xt::xstrided_container< D >::resize ( S && shape,
const strides_type & strides )
inline

Resizes the container.

Warning
Contrary to STL containers like std::vector, resize does NOT preserve the container elements.
Parameters
shapethe new shape
stridesthe new strides

Definition at line 1058 of file xcontainer.hpp.

◆ resize() [3/3]

template<class D >
template<class S >
void xt::xstrided_container< D >::resize ( S && shape,
layout_type l )
inline

Resizes the container.

Warning
Contrary to STL containers like std::vector, resize does NOT preserve the container elements.
Parameters
shapethe new shape
lthe new layout_type

Definition at line 1032 of file xcontainer.hpp.

◆ shape_impl() [1/2]

template<class D >
auto xt::xstrided_container< D >::shape_impl ( ) const
inlineprotectednoexcept

Definition at line 891 of file xcontainer.hpp.

◆ shape_impl() [2/2]

template<class D >
auto xt::xstrided_container< D >::shape_impl ( )
inlineprotectednoexcept

Definition at line 885 of file xcontainer.hpp.

◆ strides_impl() [1/2]

template<class D >
auto xt::xstrided_container< D >::strides_impl ( ) const
inlineprotectednoexcept

Definition at line 903 of file xcontainer.hpp.

◆ strides_impl() [2/2]

template<class D >
auto xt::xstrided_container< D >::strides_impl ( )
inlineprotectednoexcept

Definition at line 897 of file xcontainer.hpp.


The documentation for this class was generated from the following file: