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

Base class for dense multidimensional containers. More...

#include <xcontainer.hpp>

Inheritance diagram for xt::xcontainer< D >:
xt::xcontiguous_iterable< D > xt::xaccessible< D > xt::xiterable< D > xt::xfixed_container< typename storage_type::value_type, S, L, SH, Tag > xt::xfixed_container< T, FSH, L, Sharable > xt::xstrided_container< D > xt::xarray_adaptor< value_container &, L, SC > xt::xarray_adaptor< flag_container &, L, SC > xt::xarray_adaptor< const value_container &, L, SC > xt::xarray_adaptor< const flag_container &, L, SC > xt::xarray_adaptor< EC, L, SC, xoptional_expression_tag > xt::xarray_container< temporary_container_t< storage_type >, L, SC, Tag > xt::xarray_container< uvector< T, A >, L, xt::svector< typename uvector< T, A >::size_type, 4, SA, true > > xt::xarray_container< xtl::xoptional_vector< T, A, BC >, L, xt::svector< typename uvector< T, A >::size_type, 4, SA, true >, xoptional_expression_tag > xt::xarray_container< EC, L, SC, xoptional_expression_tag > xt::xtensor_adaptor< value_container &, N, L > xt::xtensor_adaptor< flag_container &, N, L > xt::xtensor_adaptor< const value_container &, N, L > xt::xtensor_adaptor< const flag_container &, N, L > xt::xtensor_adaptor< EC, N, L, xoptional_expression_tag > xt::xtensor_container< temporary_container_t< storage_type >, N, L, Tag > xt::xtensor_container< uvector< T, A >, N, L > xt::xtensor_container< xtl::xoptional_vector< T, A, BC >, N, L, xoptional_expression_tag > xt::xtensor_container< std::vector< T, A >, 2, layout_type::row_major > xt::xtensor_container< EC, N, L, xoptional_expression_tag > xt::xtensor_view< EC, N, L, xoptional_expression_tag >

Public Types

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 >

Public Member Functions

template<class... Args>
reference at (Args... args)
 Returns a reference to the element at the specified position in the expression, after dimension and bounds checking.
template<class S>
disable_integral_t< S, reference > operator[] (const S &index)
 Returns a reference to the element at the specified position in the expression.
template<class I>
reference operator[] (std::initializer_list< I > index)
reference operator[] (size_type i)
reference back ()
 Returns a reference to the last element of the expression.
reference front ()
 Returns a reference to the first element of the expression.
template<class... Args>
reference periodic (Args... args)
 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).
Size and shape
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.
Data
template<class T>
void fill (const T &value)
 Fills the container with the given value.
template<class... Args>
reference operator() (Args... args)
 Returns a reference to the element at the specified position in the container.
template<class... Args>
const_reference operator() (Args... args) const
 Returns a constant reference to the element at the specified position in the container.
template<class... Args>
reference unchecked (Args... args)
 Returns a reference to the element at the specified position in the container.
template<class... Args>
const_reference unchecked (Args... args) const
 Returns a constant reference to the element at the specified position in the container.
template<class It>
reference element (It first, It last)
 Returns a reference to the element at the specified position in the container.
template<class It>
const_reference element (It first, It last) const
 Returns a reference to the element at the specified position in the container.
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.
Public Member Functions inherited from xt::xcontiguous_iterable< D >
template<layout_type L = ::xt::layout_type::row_major>
select_iterator< L > begin () noexcept
 Returns an iterator to the first element of the expression.
template<layout_type L = ::xt::layout_type::row_major>
select_iterator< L > end () noexcept
 Returns an iterator to the element following the last element of the expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< L > begin () const noexcept
 Returns a constant iterator to the first element of the expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< L > end () const noexcept
 Returns a constant iterator to the element following the last element of the expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< L > cbegin () const noexcept
 Returns a constant iterator to the first element of the expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_iterator< L > cend () const noexcept
 Returns a constant iterator to the element following the last element of the expression.
template<layout_type L = ::xt::layout_type::row_major>
select_reverse_iterator< L > rbegin () noexcept
 Returns an iterator to the first element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major>
select_reverse_iterator< L > rend () noexcept
 Returns an iterator to the element following the last element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< L > rbegin () const noexcept
 Returns a constant iterator to the first element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< L > rend () const noexcept
 Returns a constant iterator to the element following the last element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< L > crbegin () const noexcept
 Returns a constant iterator to the first element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major>
select_const_reverse_iterator< L > crend () const noexcept
 Returns a constant iterator to the element following the last element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
broadcast_iterator< S, L > begin (const S &shape) noexcept
 Returns an iterator to the first element of the expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
broadcast_iterator< S, L > end (const S &shape) noexcept
 Returns an iterator to the element following the last element of the expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_broadcast_iterator< S, L > begin (const S &shape) const noexcept
 Returns a constant iterator to the first element of the expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_broadcast_iterator< S, L > end (const S &shape) const noexcept
 Returns a constant iterator to the element following the last element of the expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_broadcast_iterator< S, L > cbegin (const S &shape) const noexcept
 Returns a constant iterator to the first element of the expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_broadcast_iterator< S, L > cend (const S &shape) const noexcept
 Returns a constant iterator to the element following the last element of the expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
reverse_broadcast_iterator< S, L > rbegin (const S &shape) noexcept
 Returns an iterator to the first element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
reverse_broadcast_iterator< S, L > rend (const S &shape) noexcept
 Returns an iterator to the element following the last element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_reverse_broadcast_iterator< S, L > rbegin (const S &shape) const noexcept
 Returns a constant iterator to the first element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_reverse_broadcast_iterator< S, L > rend (const S &shape) const noexcept
 Returns a constant iterator to the element following the last element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_reverse_broadcast_iterator< S, L > crbegin (const S &shape) const noexcept
 Returns a constant iterator to the first element of the reversed expression.
template<layout_type L = ::xt::layout_type::row_major, class S>
const_reverse_broadcast_iterator< S, L > crend (const S &shape) const noexcept
 Returns a constant iterator to the element following the last element of the reversed expression.

Static Public Attributes

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

Protected Member Functions

 xcontainer (const xcontainer &)=default
xcontainer & operator= (const xcontainer &)=default
 xcontainer (xcontainer &&)=default
xcontainer & operator= (xcontainer &&)=default

Friends

template<class C>
class xstepper
class xaccessible< D >
class xconst_accessible< D >

Broadcasting

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.
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
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)
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_type > load_simd (size_type i) const
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
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

Detailed Description

template<class D>
class xt::xcontainer< D >

Base class for dense multidimensional containers.

The xcontainer class defines the interface for dense multidimensional container classes. It does not embed any data container, this responsibility is delegated to the inheriting classes.

Template Parameters
DThe derived type, i.e. the inheriting class for which xcontainer provides the interface.

Definition at line 69 of file xcontainer.hpp.

Member Typedef Documentation

◆ accessible_base

template<class D>
using xt::xcontainer< D >::accessible_base = xaccessible<D>

Definition at line 101 of file xcontainer.hpp.

◆ allocator_type

template<class D>
using xt::xcontainer< D >::allocator_type = allocator_type_t<std::decay_t<storage_type>>

Definition at line 78 of file xcontainer.hpp.

◆ backstrides_type

template<class D>
using xt::xcontainer< D >::backstrides_type = typename inner_types::backstrides_type

Definition at line 91 of file xcontainer.hpp.

◆ bool_load_type

template<class D>
using xt::xcontainer< D >::bool_load_type = xt::bool_load_type<value_type>

Definition at line 87 of file xcontainer.hpp.

◆ const_container_iterator

template<class D>
using xt::xcontainer< D >::const_container_iterator = const_linear_iterator

Definition at line 205 of file xcontainer.hpp.

◆ const_linear_iterator

template<class D>
using xt::xcontainer< D >::const_linear_iterator = typename iterable_base::const_linear_iterator

Definition at line 109 of file xcontainer.hpp.

◆ const_pointer

template<class D>
using xt::xcontainer< D >::const_pointer = typename storage_type::const_pointer

Definition at line 83 of file xcontainer.hpp.

◆ const_reference

template<class D>
using xt::xcontainer< D >::const_reference = typename inner_types::const_reference

Definition at line 81 of file xcontainer.hpp.

◆ const_reverse_linear_iterator

template<class D>
using xt::xcontainer< D >::const_reverse_linear_iterator = typename iterable_base::const_reverse_linear_iterator

Definition at line 111 of file xcontainer.hpp.

◆ const_stepper

template<class D>
using xt::xcontainer< D >::const_stepper = typename iterable_base::const_stepper

Definition at line 99 of file xcontainer.hpp.

◆ container_iterator

template<class D>
using xt::xcontainer< D >::container_iterator = linear_iterator

Definition at line 204 of file xcontainer.hpp.

◆ data_alignment

template<class D>
using xt::xcontainer< D >::data_alignment = xt_simd::container_alignment_t<storage_type>

Definition at line 105 of file xcontainer.hpp.

◆ derived_type

template<class D>
using xt::xcontainer< D >::derived_type = D

Definition at line 74 of file xcontainer.hpp.

◆ difference_type

template<class D>
using xt::xcontainer< D >::difference_type = typename storage_type::difference_type

Definition at line 85 of file xcontainer.hpp.

◆ inner_backstrides_type

template<class D>
using xt::xcontainer< D >::inner_backstrides_type = typename inner_types::inner_backstrides_type

Definition at line 95 of file xcontainer.hpp.

◆ inner_shape_type

template<class D>
using xt::xcontainer< D >::inner_shape_type = typename inner_types::inner_shape_type

Definition at line 93 of file xcontainer.hpp.

◆ inner_strides_type

template<class D>
using xt::xcontainer< D >::inner_strides_type = typename inner_types::inner_strides_type

Definition at line 94 of file xcontainer.hpp.

◆ inner_types

template<class D>
using xt::xcontainer< D >::inner_types = xcontainer_inner_types<D>

Definition at line 76 of file xcontainer.hpp.

◆ iterable_base

template<class D>
using xt::xcontainer< D >::iterable_base = xcontiguous_iterable<D>

Definition at line 97 of file xcontainer.hpp.

◆ linear_iterator

template<class D>
using xt::xcontainer< D >::linear_iterator = typename iterable_base::linear_iterator

Definition at line 108 of file xcontainer.hpp.

◆ pointer

template<class D>
using xt::xcontainer< D >::pointer = typename storage_type::pointer

Definition at line 82 of file xcontainer.hpp.

◆ reference

template<class D>
using xt::xcontainer< D >::reference = typename inner_types::reference

Definition at line 80 of file xcontainer.hpp.

◆ reverse_linear_iterator

template<class D>
using xt::xcontainer< D >::reverse_linear_iterator = typename iterable_base::reverse_linear_iterator

Definition at line 110 of file xcontainer.hpp.

◆ shape_type

template<class D>
using xt::xcontainer< D >::shape_type = typename inner_types::shape_type

Definition at line 89 of file xcontainer.hpp.

◆ simd_return_type

template<class D>
template<class requested_type>
using xt::xcontainer< D >::simd_return_type = xt_simd::simd_return_type<value_type, requested_type>

Definition at line 180 of file xcontainer.hpp.

◆ simd_type

template<class D>
using xt::xcontainer< D >::simd_type = xt_simd::simd_type<value_type>

Definition at line 106 of file xcontainer.hpp.

◆ simd_value_type

template<class D>
using xt::xcontainer< D >::simd_value_type = xt_simd::simd_type<value_type>

Definition at line 86 of file xcontainer.hpp.

◆ size_type

template<class D>
using xt::xcontainer< D >::size_type = typename inner_types::size_type

Definition at line 84 of file xcontainer.hpp.

◆ stepper

template<class D>
using xt::xcontainer< D >::stepper = typename iterable_base::stepper

Definition at line 98 of file xcontainer.hpp.

◆ storage_type

template<class D>
using xt::xcontainer< D >::storage_type = typename inner_types::storage_type

Definition at line 77 of file xcontainer.hpp.

◆ strides_type

template<class D>
using xt::xcontainer< D >::strides_type = typename inner_types::strides_type

Definition at line 90 of file xcontainer.hpp.

◆ value_type

template<class D>
using xt::xcontainer< D >::value_type = typename storage_type::value_type

Definition at line 79 of file xcontainer.hpp.

Member Function Documentation

◆ at()

template<class D>
template<class... Args>
auto xt::xaccessible< D >::at ( Args... args) -> reference
inline

Returns a reference to the element at the specified position in the expression, after dimension and bounds checking.

Parameters
argsa list of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices should be equal to the number of dimensions of the expression.
Exceptions
std::out_of_rangeif the number of argument is greater than the number of dimensions or if indices are out of bounds.

Definition at line 97 of file xaccessible.hpp.

◆ back()

template<class D>
auto xt::xaccessible< D >::back ( )
inline

Returns a reference to the last element of the expression.

Definition at line 109 of file xaccessible.hpp.

◆ backstrides()

template<class D>
auto xt::xcontainer< D >::backstrides ( ) const
constexprnoexcept

Returns the backstrides of the container.

Definition at line 403 of file xcontainer.hpp.

◆ broadcast_shape()

template<class D>
template<class S>
bool xt::xcontainer< D >::broadcast_shape ( S & shape,
bool reuse_cache = false ) const
inline

Broadcast the shape of the container to the specified parameter.

Parameters
shapethe result shape
reuse_cacheparameter for internal optimization
Returns
a boolean indicating whether the broadcasting is trivial

Definition at line 619 of file xcontainer.hpp.

◆ data() [1/2]

template<class D>
auto xt::xcontainer< D >::data ( ) const
inlinenoexcept

Returns a constant pointer to the underlying array serving as element storage.

The pointer is such that range [data(); data() + size()] is always a valid range, even if the container is empty (data() is not is not dereferenceable in that case)

Definition at line 591 of file xcontainer.hpp.

◆ data() [2/2]

template<class D>
auto xt::xcontainer< D >::data ( )
inlinenoexcept

Returns a pointer to the underlying array serving as element storage.

The pointer is such that range [data(); data() + size()] is always a valid range, even if the container is empty (data() is not is not dereferenceable in that case)

Definition at line 580 of file xcontainer.hpp.

◆ data_element() [1/2]

template<class D>
auto xt::xcontainer< D >::data_element ( size_type i)
inline

Definition at line 651 of file xcontainer.hpp.

◆ data_element() [2/2]

template<class D>
auto xt::xcontainer< D >::data_element ( size_type i) const
inline

Definition at line 657 of file xcontainer.hpp.

◆ data_offset()

template<class D>
auto xt::xcontainer< D >::data_offset ( ) const
inlinenoexcept

Returns the offset to the first element in the container.

Definition at line 600 of file xcontainer.hpp.

◆ data_xbegin() [1/2]

template<class D>
auto xt::xcontainer< D >::data_xbegin ( ) const
inlineprotectednoexcept

Definition at line 731 of file xcontainer.hpp.

◆ data_xbegin() [2/2]

template<class D>
auto xt::xcontainer< D >::data_xbegin ( )
inlineprotectednoexcept

Definition at line 725 of file xcontainer.hpp.

◆ data_xend() [1/2]

template<class D>
auto xt::xcontainer< D >::data_xend ( layout_type l,
size_type offset ) const
inlineprotectednoexcept

Definition at line 743 of file xcontainer.hpp.

◆ data_xend() [2/2]

template<class D>
auto xt::xcontainer< D >::data_xend ( layout_type l,
size_type offset )
inlineprotectednoexcept

Definition at line 737 of file xcontainer.hpp.

◆ derived_cast() [1/3]

template<class D>
auto xt::xcontainer< D >::derived_cast ( ) &&
inlineprotectednoexcept

Definition at line 645 of file xcontainer.hpp.

◆ derived_cast() [2/3]

template<class D>
auto xt::xcontainer< D >::derived_cast ( ) &
inlineprotectednoexcept

Definition at line 839 of file xcontainer.hpp.

◆ derived_cast() [3/3]

template<class D>
auto xt::xcontainer< D >::derived_cast ( ) const &
inlineprotectednoexcept

Definition at line 639 of file xcontainer.hpp.

◆ dimension()

template<class D>
auto xt::xcontainer< D >::dimension ( ) const
constexprnoexcept

Returns the number of dimensions of the container.

Definition at line 376 of file xcontainer.hpp.

◆ element() [1/2]

template<class D>
template<class It>
auto xt::xcontainer< D >::element ( It first,
It last ) -> reference
inline

Returns a reference to the element at the specified position in the container.

Parameters
firstiterator starting the sequence of indices
lastiterator ending the sequence of indices The number of indices in the sequence should be equal to or greater than the number of dimensions of the container.

Definition at line 534 of file xcontainer.hpp.

◆ element() [2/2]

template<class D>
template<class It>
auto xt::xcontainer< D >::element ( It first,
It last ) const
inline

Returns a reference to the element at the specified position in the container.

Parameters
firstiterator starting the sequence of indices
lastiterator ending the sequence of indices The number of indices in the sequence should be equal to or greater than the number of dimensions of the container.

Definition at line 549 of file xcontainer.hpp.

◆ fill()

template<class D>
template<class T>
void xt::xcontainer< D >::fill ( const T & value)
inline

Fills the container with the given value.

Parameters
valuethe value to fill the container with.

Definition at line 421 of file xcontainer.hpp.

◆ flat() [1/2]

template<class D>
auto xt::xcontainer< D >::flat ( size_type i)
inline

Returns a reference to the element at the specified position in the container storage (as if it was one dimensional).

Parameters
iindex specifying the position in the storage. Must be smaller than the number of elements in the container.

Definition at line 669 of file xcontainer.hpp.

◆ flat() [2/2]

template<class D>
auto xt::xcontainer< D >::flat ( size_type i) const
inline

Returns a constant reference to the element at the specified position in the container storage (as if it was one dimensional).

Parameters
iindex specifying the position in the storage. Must be smaller than the number of elements in the container.

Definition at line 682 of file xcontainer.hpp.

◆ front()

template<class D>
auto xt::xaccessible< D >::front ( )
inline

Returns a reference to the first element of the expression.

Definition at line 108 of file xaccessible.hpp.

◆ has_linear_assign()

template<class D>
template<class S>
bool xt::xcontainer< D >::has_linear_assign ( const S & str) const
inlinenoexcept

Checks whether the xcontainer can be linearly assigned to an expression with the specified strides.

Returns
a boolean indicating whether a linear assign is possible

Definition at line 631 of file xcontainer.hpp.

◆ linear_begin() [1/2]

template<class D>
auto xt::xcontainer< D >::linear_begin ( ) const
inlinenoexcept

Definition at line 779 of file xcontainer.hpp.

◆ linear_begin() [2/2]

template<class D>
auto xt::xcontainer< D >::linear_begin ( )
inlinenoexcept

Definition at line 767 of file xcontainer.hpp.

◆ linear_cbegin()

template<class D>
auto xt::xcontainer< D >::linear_cbegin ( ) const
inlinenoexcept

Definition at line 791 of file xcontainer.hpp.

◆ linear_cend()

template<class D>
auto xt::xcontainer< D >::linear_cend ( ) const
inlinenoexcept

Definition at line 797 of file xcontainer.hpp.

◆ linear_crbegin()

template<class D>
auto xt::xcontainer< D >::linear_crbegin ( ) const
inlinenoexcept

Definition at line 827 of file xcontainer.hpp.

◆ linear_crend()

template<class D>
auto xt::xcontainer< D >::linear_crend ( ) const
inlinenoexcept

Definition at line 833 of file xcontainer.hpp.

◆ linear_end() [1/2]

template<class D>
auto xt::xcontainer< D >::linear_end ( ) const
inlinenoexcept

Definition at line 785 of file xcontainer.hpp.

◆ linear_end() [2/2]

template<class D>
auto xt::xcontainer< D >::linear_end ( )
inlinenoexcept

Definition at line 773 of file xcontainer.hpp.

◆ linear_rbegin() [1/2]

template<class D>
auto xt::xcontainer< D >::linear_rbegin ( ) const
inlinenoexcept

Definition at line 815 of file xcontainer.hpp.

◆ linear_rbegin() [2/2]

template<class D>
auto xt::xcontainer< D >::linear_rbegin ( )
inlinenoexcept

Definition at line 803 of file xcontainer.hpp.

◆ linear_rend() [1/2]

template<class D>
auto xt::xcontainer< D >::linear_rend ( ) const
inlinenoexcept

Definition at line 821 of file xcontainer.hpp.

◆ linear_rend() [2/2]

template<class D>
auto xt::xcontainer< D >::linear_rend ( )
inlinenoexcept

Definition at line 809 of file xcontainer.hpp.

◆ load_simd()

template<class D>
template<class alignment, class requested_type, std::size_t N>
auto xt::xcontainer< D >::load_simd ( size_type i) const -> container_simd_return_type_t< storage_type, value_type, requested_type >
inline

Definition at line 759 of file xcontainer.hpp.

◆ operator()() [1/2]

template<class D>
template<class... Args>
auto xt::xcontainer< D >::operator() ( Args... args) -> reference
inline

Returns a reference to the element at the specified position in the container.

Parameters
argsa list of indices specifying the position in the container. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the container.

Definition at line 441 of file xcontainer.hpp.

◆ operator()() [2/2]

template<class D>
template<class... Args>
auto xt::xcontainer< D >::operator() ( Args... args) const
inline

Returns a constant reference to the element at the specified position in the container.

Parameters
argsa list of indices specifying the position in the container. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the container.

Definition at line 457 of file xcontainer.hpp.

◆ operator[]() [1/3]

template<class D>
template<class S>
auto xt::xaccessible< D >::operator[] ( const S & index) -> disable_integral_t< S, reference >
inline

Returns a reference to the element at the specified position in the expression.

Parameters
indexa sequence of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices in the list should be equal or greater than the number of dimensions of the expression.

Definition at line 100 of file xaccessible.hpp.

◆ operator[]() [2/3]

template<class D>
auto xt::xaccessible< D >::operator[] ( size_type i)
inline

Definition at line 103 of file xaccessible.hpp.

◆ operator[]() [3/3]

template<class D>
template<class I>
auto xt::xaccessible< D >::operator[] ( std::initializer_list< I > index)
inline

Definition at line 102 of file xaccessible.hpp.

◆ periodic()

template<class D>
template<class... Args>
auto xt::xaccessible< D >::periodic ( Args... args) -> reference
inline

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).

Parameters
argsa list of indices specifying the position in the expression. Indices must be integers, the number of indices should be equal to the number of dimensions of the expression.

Definition at line 106 of file xaccessible.hpp.

◆ shape()

template<class D>
auto xt::xcontainer< D >::shape ( ) const
constexprnoexcept

Returns the shape of the container.

Definition at line 385 of file xcontainer.hpp.

◆ size()

template<class D>
auto xt::xcontainer< D >::size ( ) const
inlinenoexcept

Returns the number of element in the container.

Definition at line 367 of file xcontainer.hpp.

◆ stepper_begin() [1/2]

template<class D>
template<class S>
auto xt::xcontainer< D >::stepper_begin ( const S & shape) const
inlinenoexcept

Definition at line 710 of file xcontainer.hpp.

◆ stepper_begin() [2/2]

template<class D>
template<class S>
auto xt::xcontainer< D >::stepper_begin ( const S & shape) -> stepper
inlinenoexcept

Definition at line 694 of file xcontainer.hpp.

◆ stepper_end() [1/2]

template<class D>
template<class S>
auto xt::xcontainer< D >::stepper_end ( const S & shape,
layout_type l ) const
inlinenoexcept

Definition at line 718 of file xcontainer.hpp.

◆ stepper_end() [2/2]

template<class D>
template<class S>
auto xt::xcontainer< D >::stepper_end ( const S & shape,
layout_type l ) -> stepper
inlinenoexcept

Definition at line 702 of file xcontainer.hpp.

◆ storage() [1/2]

template<class D>
auto xt::xcontainer< D >::storage ( ) const
inlinenoexcept

Returns a constant reference to the buffer containing the elements of the container.

Definition at line 569 of file xcontainer.hpp.

◆ storage() [2/2]

template<class D>
auto xt::xcontainer< D >::storage ( )
inlinenoexcept

Returns a reference to the buffer containing the elements of the container.

Definition at line 559 of file xcontainer.hpp.

◆ store_simd()

template<class D>
template<class alignment, class simd>
void xt::xcontainer< D >::store_simd ( size_type i,
const simd & e )
inline

Definition at line 751 of file xcontainer.hpp.

◆ strides()

template<class D>
auto xt::xcontainer< D >::strides ( ) const
constexprnoexcept

Returns the strides of the container.

Definition at line 394 of file xcontainer.hpp.

◆ unchecked() [1/2]

template<class D>
template<class... Args>
auto xt::xcontainer< D >::unchecked ( Args... args) -> reference
inline

Returns a reference to the element at the specified position in the container.

Parameters
argsa list of indices specifying the position in the container. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the container, else the behavior is undefined.
Warning
This method is meant for performance, for expressions with a dynamic number of dimensions (i.e. not known at compile time). Since it may have undefined behavior (see parameters), operator() should be preferred whenever it is possible.
This method is NOT compatible with broadcasting, meaning the following code has undefined behavior:
xt::xarray<double> a = {{0, 1}, {2, 3}};
xt::xarray<double> b = {0, 1};
auto fd = a + b;
double res = fd.uncheked(0, 1);
xarray_container< uvector< T, A >, L, xt::svector< typename uvector< T, A >::size_type, 4, SA, true > > xarray
Alias template on xarray_container with default parameters for data container type and shape / stride...

Definition at line 486 of file xcontainer.hpp.

◆ unchecked() [2/2]

template<class D>
template<class... Args>
auto xt::xcontainer< D >::unchecked ( Args... args) const
inline

Returns a constant reference to the element at the specified position in the container.

Parameters
argsa list of indices specifying the position in the container. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the container, else the behavior is undefined.
Warning
This method is meant for performance, for expressions with a dynamic number of dimensions (i.e. not known at compile time). Since it may have undefined behavior (see parameters), operator() should be preferred whenever it is possible.
This method is NOT compatible with broadcasting, meaning the following code has undefined behavior:
xt::xarray<double> a = {{0, 1}, {2, 3}};
xt::xarray<double> b = {0, 1};
auto fd = a + b;
double res = fd.uncheked(0, 1);

Definition at line 516 of file xcontainer.hpp.

◆ xaccessible< D >

template<class D>
friend class xaccessible< D >
friend

Definition at line 239 of file xcontainer.hpp.

◆ xconst_accessible< D >

template<class D>
friend class xconst_accessible< D >
friend

Definition at line 239 of file xcontainer.hpp.

◆ xstepper

template<class D>
template<class C>
friend class xstepper
friend

Definition at line 239 of file xcontainer.hpp.

Member Data Documentation

◆ contiguous_layout

template<class D>
bool xt::xcontainer< D >::contiguous_layout = static_layout != layout_type::dynamic
staticconstexpr

Definition at line 104 of file xcontainer.hpp.

◆ static_layout

template<class D>
layout_type xt::xcontainer< D >::static_layout = inner_types::layout
staticconstexpr

Definition at line 103 of file xcontainer.hpp.


The documentation for this class was generated from the following file:
  • /home/runner/work/xtensor/xtensor/include/xtensor/containers/xcontainer.hpp