xtensor
Loading...
Searching...
No Matches
xt::xview< CT, S > Class Template Reference

Multidimensional view with tensor semantic. More...

#include <xview.hpp>

Inheritance diagram for xt::xview< CT, S >:
xt::xview_semantic< xview< CT, S... > > xt::xaccessible< xview< CT, S... > > xt::xsemantic_base< xview< CT, S... > > xt::xconst_accessible< xview< CT, S... > >

Public Types

using self_type = xview<CT, S...>
using inner_types = xcontainer_inner_types<self_type>
using xexpression_type = std::decay_t<CT>
using semantic_base = xview_semantic<self_type>
using temporary_type = typename xcontainer_inner_types<self_type>::temporary_type
using accessible_base = xaccessible<self_type>
using extension_base = extension::xview_base_t<CT, S...>
using expression_tag = typename extension_base::expression_tag
using value_type = typename xexpression_type::value_type
using simd_value_type = xt_simd::simd_type<value_type>
using bool_load_type = typename xexpression_type::bool_load_type
using reference = typename inner_types::reference
using const_reference = typename inner_types::const_reference
using pointer
using const_pointer = typename xexpression_type::const_pointer
using size_type = typename inner_types::size_type
using difference_type = typename xexpression_type::difference_type
using iterable_base = xiterable<self_type>
using inner_shape_type = typename iterable_base::inner_shape_type
using shape_type = typename xview_shape_type<typename xexpression_type::shape_type, S...>::type
using xexpression_inner_strides_type
using xexpression_inner_backstrides_type
using storage_type = typename inner_types::storage_type
using inner_strides_type
using inner_backstrides_type
using strides_type = get_strides_t<shape_type>
using backstrides_type = strides_type
using slice_type = std::tuple<S...>
using stepper = typename iterable_base::stepper
using const_stepper = typename iterable_base::const_stepper
using linear_iterator
using const_linear_iterator
using reverse_linear_iterator = std::reverse_iterator<linear_iterator>
using const_reverse_linear_iterator = std::reverse_iterator<const_linear_iterator>
using container_iterator = pointer
using const_container_iterator = const_pointer
template<class E>
using rebind_t = xview<E, S...>
template<class requested_type>
using simd_return_type = xt_simd::simd_return_type<value_type, requested_type>
Public Types inherited from xt::xview_semantic< xview< CT, S... > >
using base_type
using derived_type
using temporary_type
Public Types inherited from xt::xsemantic_base< xview< CT, S... > >
using base_type
using derived_type
using temporary_type
Public Types inherited from xt::xaccessible< xview< CT, S... > >
using base_type
using derived_type
using reference
using size_type
Public Types inherited from xt::xconst_accessible< xview< CT, S... > >
using derived_type
using inner_types
using reference
using const_reference
using size_type

Public Member Functions

 xview (const xview &)=default
template<class T = xexpression_type>
requires (data_interface_expression<T>)
storage_type & storage ()
template<class T = xexpression_type>
requires (data_interface_expression<T>)
const storage_type & storage () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
linear_iterator linear_begin ()
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
linear_iterator linear_end ()
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_linear_iterator linear_begin () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_linear_iterator linear_end () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_linear_iterator linear_cbegin () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_linear_iterator linear_cend () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
reverse_linear_iterator linear_rbegin ()
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
reverse_linear_iterator linear_rend ()
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_reverse_linear_iterator linear_rbegin () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_reverse_linear_iterator linear_rend () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_reverse_linear_iterator linear_crbegin () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_reverse_linear_iterator linear_crend () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const inner_strides_type & strides () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const inner_strides_type & backstrides () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
const_pointer data () const
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
pointer data ()
template<xscalar_concept ST = self_type>
 operator reference ()
template<xscalar_concept ST = self_type>
 operator const_reference () const
template<class align, class simd, class T = xexpression_type>
requires (has_simd_interface_concept<T> and strided_view_concept<CT, S...>)
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, class T = xexpression_type>
requires (has_simd_interface_concept<T> and strided_view_concept<CT, S...>)
simd_return_type< requested_type > load_simd (size_type i) const
template<class T = xexpression_type>
requires (has_simd_interface_concept<T> and strided_view_concept<CT, S...>)
reference data_element (size_type i)
template<class T = xexpression_type>
requires (has_simd_interface_concept<T> and strided_view_concept<CT, S...>)
const_reference data_element (size_type i) const
template<class T = xexpression_type>
requires (has_simd_interface_concept<T> and strided_view_concept<CT, S...>)
reference flat (size_type i)
template<class T = xexpression_type>
requires (has_simd_interface_concept<T> and strided_view_concept<CT, S...>)
const_reference flat (size_type i) const
Extended copy semantic
template<class E>
self_type & operator= (const xexpression< E > &e)
 The extended assignment operator.
template<class E>
disable_xexpression< E, self_type > & operator= (const E &e)
Size and shape
const inner_shape_type & shape () const noexcept
 Returns the shape of the view.
const slice_type & slices () const noexcept
 Returns the slices of the view.
layout_type layout () const noexcept
 Returns the slices of the view.
bool is_contiguous () const noexcept
Public Member Functions inherited from xt::xview_semantic< xview< CT, S... > >
derived_type & assign_temporary (temporary_type &&)
 Assigns the temporary tmp to *this.
derived_type & assign_xexpression (const xexpression< E > &e)
derived_type & computed_assign (const xexpression< E > &e)
derived_type & scalar_computed_assign (const E &e, F &&f)
Public Member Functions inherited from xt::xsemantic_base< xview< CT, S... > >
disable_xexpression< E, derived_type & > operator+= (const E &)
 Adds the scalar e to *this.
disable_xexpression< E, derived_type & > operator-= (const E &)
 Subtracts the scalar e from *this.
disable_xexpression< E, derived_type & > operator*= (const E &)
 Multiplies *this with the scalar e.
disable_xexpression< E, derived_type & > operator/= (const E &)
 Divides *this by the scalar e.
disable_xexpression< E, derived_type & > operator%= (const E &)
 Computes the remainder of *this after division by the scalar e.
disable_xexpression< E, derived_type & > operator&= (const E &)
 Computes the bitwise and of *this and the scalar e and assigns it to *this.
disable_xexpression< E, derived_type & > operator|= (const E &)
 Computes the bitwise or of *this and the scalar e and assigns it to *this.
disable_xexpression< E, derived_type & > operator^= (const E &)
 Computes the bitwise xor of *this and the scalar e and assigns it to *this.
derived_type & assign (const xexpression< E > &)
 Assigns the xexpression e to *this.
derived_type & plus_assign (const xexpression< E > &)
 Adds the xexpression e to *this.
derived_type & minus_assign (const xexpression< E > &)
 Subtracts the xexpression e to *this.
derived_type & multiplies_assign (const xexpression< E > &)
 Multiplies *this with the xexpression e.
derived_type & divides_assign (const xexpression< E > &)
 Divides *this by the xexpression e.
derived_type & modulus_assign (const xexpression< E > &)
 Computes the remainder of *this after division by the xexpression e.
derived_type & bit_and_assign (const xexpression< E > &)
 Computes the bitwise and of e to *this.
derived_type & bit_or_assign (const xexpression< E > &)
 Computes the bitwise or of e to *this.
derived_type & bit_xor_assign (const xexpression< E > &)
 Computes the bitwise xor of e to *this.
Public Member Functions inherited from xt::xaccessible< xview< CT, S... > >
const_reference at (Args... args) const
 Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking.
disable_integral_t< S, const_reference > operator[] (const S &index) const
 Returns a constant reference to the element at the specified position in the expression.
const_reference operator[] (std::initializer_list< I > index) const
const_reference operator[] (size_type i) const
const_reference back () const
 Returns a constant reference to last the element of the expression.
const_reference front () const
 Returns a constant reference to first the element of the expression.
const_reference periodic (Args... args) const
 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).
Public Member Functions inherited from xt::xconst_accessible< xview< CT, S... > >
size_type size () const noexcept(noexcept(derived_cast().shape()))
 Returns the size of the expression.
size_type dimension () const noexcept
 Returns the number of dimensions of the expression.
size_type shape (size_type index) const
 Returns the i-th dimension of the expression.
const_reference at (Args... args) const
 Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking.
disable_integral_t< S, const_reference > operator[] (const S &index) const
 Returns a constant reference to the element at the specified position in the expression.
const_reference periodic (Args... args) const
 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).
bool in_bounds (Args... args) const
 Returns true only if the the specified position is a valid entry in the expression.
const_reference front () const
 Returns a constant reference to first the element of the expression.
const_reference back () const
 Returns a constant reference to last the element of the expression.

Static Public Attributes

static constexpr bool is_const = std::is_const<std::remove_reference_t<CT>>::value
static constexpr layout_type static_layout = inner_types::layout
static constexpr bool contiguous_layout = static_layout != layout_type::dynamic
static constexpr bool is_strided_view = detail::is_strided_view<xexpression_type, S...>::value
static constexpr bool is_contiguous_view = contiguous_layout
static constexpr bool has_trivial_strides
static constexpr std::size_t rank = SIZE_MAX

Friends

class xview_semantic< xview< CT, S... > >

Constructor

template<class CTA, class FSL, class... SL>
 xview (CTA &&e, FSL &&first_slice, SL &&... slices) noexcept
 Constructs a view on the specified xexpression.
self_type & operator= (const xview &rhs)

Data

template<class T>
void fill (const T &value)
 Fills the view with the given value.
template<class... Args>
reference operator() (Args... args)
 Returns a reference to the element at the specified position in the view.
template<class... Args>
reference unchecked (Args... args)
 Returns a reference to the element at the specified position in the view.
template<class It>
reference element (It first, It last)
template<class... Args>
const_reference operator() (Args... args) const
 Returns a constant reference to the element at the specified position in the view.
template<class... Args>
const_reference unchecked (Args... args) const
 Returns a constant reference to the element at the specified position in the view.
template<class It>
const_reference element (It first, It last) const
xexpression_type & expression () noexcept
 Returns a reference to the underlying expression of the view.
const xexpression_type & expression () const noexcept
 Returns a const reference to the underlying expression of the view.
template<class T = xexpression_type>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
std::size_t data_offset () const noexcept
 Return the offset to the first element of the view in the underlying container.
size_type underlying_size (size_type dim) const
xtl::xclosure_pointer< self_type & > operator& () &
xtl::xclosure_pointer< const self_type & > operator& () const &
xtl::xclosure_pointer< self_type > operator& () &&
template<class T>
auto storage () -> storage_type &requires(data_interface_expression< T >)
 Returns the data holder of the underlying container (only if the view is on a realized container).
template<class T>
auto storage () const -> const storage_type &requires(data_interface_expression< T >)
template<class T>
auto linear_begin () -> linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_end () -> linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_begin () const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_end () const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_cbegin () const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_cend () const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_rbegin () -> reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_rend () -> reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_rbegin () const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_rend () const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_crbegin () const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto linear_crend () const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
template<class T>
auto strides () const -> const inner_strides_type &requires(data_interface_expression< T >and strided_view_concept< CT, S... >)
 Return the strides for the underlying container of the view.
template<class T>
auto backstrides () const -> const inner_strides_type &requires(data_interface_expression< T >and strided_view_concept< CT, S... >)
template<class T>
auto data () const -> const_pointer requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
 Return the pointer to the underlying buffer.
template<class T>
auto data () -> pointer requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Broadcasting

template<class ST>
bool broadcast_shape (ST &shape, bool reuse_cache=false) const
 Broadcast the shape of the view to the specified parameter.
template<class ST>
bool has_linear_assign (const ST &strides) const
 Checks whether the xview can be linearly assigned to an expression with the specified strides.
template<class ST>
stepper stepper_begin (const ST &shape)
template<class ST>
stepper stepper_end (const ST &shape, layout_type l)
template<class ST>
const_stepper stepper_begin (const ST &shape) const
template<class ST>
const_stepper stepper_end (const ST &shape, layout_type l) const
template<class It>
It data_xbegin_impl (It begin) const noexcept
template<class It>
It data_xend_impl (It begin, layout_type l, size_type offset) 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
template<class E, class T = xexpression_type>
requires (data_interface_expression<T> and contiguous_view_concept<E, S...>)
void assign_to (xexpression< E > &e, bool force_resize) const
template<class E>
rebind_t< E > build_view (E &&e) const
template<class align, class simd, class T>
auto store_simd (size_type i, const simd &e) -> void requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
template<class align, class requested_type, std::size_t N, class T>
auto load_simd (size_type i) const -> simd_return_type< requested_type > requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
template<class T>
auto data_element (size_type i) -> reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
template<class T>
auto data_element (size_type i) const -> const_reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
template<class T>
auto flat (size_type i) -> reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
template<class T>
auto flat (size_type i) const -> const_reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
template<typename std::decay_t< CT >::size_type I, class T, class... Args>
auto sliced_access (const T &squeeze, Args...) const -> size_type requires(!is_xslice< T >::value)

Additional Inherited Members

Protected Member Functions inherited from xt::xview_semantic< xview< CT, S... > >
xview_semantic & operator= (const xview_semantic &)=default
Protected Member Functions inherited from xt::xsemantic_base< xview< CT, S... > >
xsemantic_base & operator= (const xsemantic_base &)=default
Protected Member Functions inherited from xt::xaccessible< xview< CT, S... > >
xaccessible & operator= (const xaccessible &)=default
Protected Member Functions inherited from xt::xconst_accessible< xview< CT, S... > >
xconst_accessible & operator= (const xconst_accessible &)=default

Detailed Description

template<class CT, class... S>
class xt::xview< CT, S >

Multidimensional view with tensor semantic.

The xview class implements a multidimensional view with tensor semantic. It is used to adapt the shape of an xexpression without changing it. xview is not meant to be used directly, but only with the view helper functions.

Template Parameters
CTthe closure type of the xexpression to adapt
Sthe slices type describing the shape adaptation
See also
view, range, all, newaxis, keep, drop
Examples
/home/runner/work/xtensor/xtensor/include/xtensor/views/index_mapper.hpp.

Definition at line 357 of file xview.hpp.

Member Typedef Documentation

◆ accessible_base

template<class CT, class... S>
using xt::xview< CT, S >::accessible_base = xaccessible<self_type>

Definition at line 373 of file xview.hpp.

◆ backstrides_type

template<class CT, class... S>
using xt::xview< CT, S >::backstrides_type = strides_type

Definition at line 430 of file xview.hpp.

◆ bool_load_type

template<class CT, class... S>
using xt::xview< CT, S >::bool_load_type = typename xexpression_type::bool_load_type

Definition at line 380 of file xview.hpp.

◆ const_container_iterator

template<class CT, class... S>
using xt::xview< CT, S >::const_container_iterator = const_pointer

Definition at line 451 of file xview.hpp.

◆ const_linear_iterator

template<class CT, class... S>
using xt::xview< CT, S >::const_linear_iterator
Initial value:
std::conditional_t<
typename xexpression_type::const_linear_iterator,
typename iterable_base::const_linear_iterator>

Definition at line 442 of file xview.hpp.

◆ const_pointer

template<class CT, class... S>
using xt::xview< CT, S >::const_pointer = typename xexpression_type::const_pointer

Definition at line 385 of file xview.hpp.

◆ const_reference

template<class CT, class... S>
using xt::xview< CT, S >::const_reference = typename inner_types::const_reference

Definition at line 382 of file xview.hpp.

◆ const_reverse_linear_iterator

template<class CT, class... S>
using xt::xview< CT, S >::const_reverse_linear_iterator = std::reverse_iterator<const_linear_iterator>

Definition at line 448 of file xview.hpp.

◆ const_stepper

template<class CT, class... S>
using xt::xview< CT, S >::const_stepper = typename iterable_base::const_stepper

Definition at line 436 of file xview.hpp.

◆ container_iterator

template<class CT, class... S>
using xt::xview< CT, S >::container_iterator = pointer

Definition at line 450 of file xview.hpp.

◆ difference_type

template<class CT, class... S>
using xt::xview< CT, S >::difference_type = typename xexpression_type::difference_type

Definition at line 387 of file xview.hpp.

◆ expression_tag

template<class CT, class... S>
using xt::xview< CT, S >::expression_tag = typename extension_base::expression_tag

Definition at line 375 of file xview.hpp.

◆ extension_base

template<class CT, class... S>
using xt::xview< CT, S >::extension_base = extension::xview_base_t<CT, S...>

Definition at line 374 of file xview.hpp.

◆ inner_backstrides_type

template<class CT, class... S>
using xt::xview< CT, S >::inner_backstrides_type
Initial value:
std::conditional_t<
has_trivial_strides,
typename detail::unwrap_offset_container<
xexpression_type::static_layout,
xexpression_inner_backstrides_type,
integral_count<S...>()>::type,
get_strides_t<shape_type>>

Definition at line 421 of file xview.hpp.

◆ inner_shape_type

template<class CT, class... S>
using xt::xview< CT, S >::inner_shape_type = typename iterable_base::inner_shape_type

Definition at line 396 of file xview.hpp.

◆ inner_strides_type

template<class CT, class... S>
using xt::xview< CT, S >::inner_strides_type
Initial value:
std::conditional_t<
has_trivial_strides,
typename detail::unwrap_offset_container<
xexpression_type::static_layout,
xexpression_inner_strides_type,
integral_count<S...>()>::type,
get_strides_t<shape_type>>

Definition at line 413 of file xview.hpp.

◆ inner_types

template<class CT, class... S>
using xt::xview< CT, S >::inner_types = xcontainer_inner_types<self_type>

Definition at line 368 of file xview.hpp.

◆ iterable_base

template<class CT, class... S>
using xt::xview< CT, S >::iterable_base = xiterable<self_type>

Definition at line 395 of file xview.hpp.

◆ linear_iterator

template<class CT, class... S>
using xt::xview< CT, S >::linear_iterator
Initial value:
std::conditional_t<
std::conditional_t<is_const, typename xexpression_type::const_linear_iterator, typename xexpression_type::linear_iterator>,
typename iterable_base::linear_iterator>

Definition at line 438 of file xview.hpp.

◆ pointer

template<class CT, class... S>
using xt::xview< CT, S >::pointer
Initial value:
std::
conditional_t<is_const, typename xexpression_type::const_pointer, typename xexpression_type::pointer>

Definition at line 383 of file xview.hpp.

◆ rebind_t

template<class CT, class... S>
template<class E>
using xt::xview< CT, S >::rebind_t = xview<E, S...>

Definition at line 621 of file xview.hpp.

◆ reference

template<class CT, class... S>
using xt::xview< CT, S >::reference = typename inner_types::reference

Definition at line 381 of file xview.hpp.

◆ reverse_linear_iterator

template<class CT, class... S>
using xt::xview< CT, S >::reverse_linear_iterator = std::reverse_iterator<linear_iterator>

Definition at line 447 of file xview.hpp.

◆ self_type

template<class CT, class... S>
using xt::xview< CT, S >::self_type = xview<CT, S...>

Definition at line 367 of file xview.hpp.

◆ semantic_base

template<class CT, class... S>
using xt::xview< CT, S >::semantic_base = xview_semantic<self_type>

Definition at line 370 of file xview.hpp.

◆ shape_type

template<class CT, class... S>
using xt::xview< CT, S >::shape_type = typename xview_shape_type<typename xexpression_type::shape_type, S...>::type

Definition at line 397 of file xview.hpp.

◆ simd_return_type

template<class CT, class... S>
template<class requested_type>
using xt::xview< CT, S >::simd_return_type = xt_simd::simd_return_type<value_type, requested_type>

Definition at line 631 of file xview.hpp.

◆ simd_value_type

template<class CT, class... S>
using xt::xview< CT, S >::simd_value_type = xt_simd::simd_type<value_type>

Definition at line 379 of file xview.hpp.

◆ size_type

template<class CT, class... S>
using xt::xview< CT, S >::size_type = typename inner_types::size_type

Definition at line 386 of file xview.hpp.

◆ slice_type

template<class CT, class... S>
using xt::xview< CT, S >::slice_type = std::tuple<S...>

Definition at line 433 of file xview.hpp.

◆ stepper

template<class CT, class... S>
using xt::xview< CT, S >::stepper = typename iterable_base::stepper

Definition at line 435 of file xview.hpp.

◆ storage_type

template<class CT, class... S>
using xt::xview< CT, S >::storage_type = typename inner_types::storage_type

Definition at line 409 of file xview.hpp.

◆ strides_type

template<class CT, class... S>
using xt::xview< CT, S >::strides_type = get_strides_t<shape_type>

Definition at line 429 of file xview.hpp.

◆ temporary_type

template<class CT, class... S>
using xt::xview< CT, S >::temporary_type = typename xcontainer_inner_types<self_type>::temporary_type

Definition at line 371 of file xview.hpp.

◆ value_type

template<class CT, class... S>
using xt::xview< CT, S >::value_type = typename xexpression_type::value_type

Definition at line 378 of file xview.hpp.

◆ xexpression_inner_backstrides_type

template<class CT, class... S>
using xt::xview< CT, S >::xexpression_inner_backstrides_type
Initial value:
typename std::conditional_t<
detail::expr_inner_backstrides_type<xexpression_type>,

Definition at line 404 of file xview.hpp.

◆ xexpression_inner_strides_type

template<class CT, class... S>
using xt::xview< CT, S >::xexpression_inner_strides_type
Initial value:
typename std::conditional_t<
detail::expr_inner_strides_type<xexpression_type>,

Definition at line 399 of file xview.hpp.

◆ xexpression_type

template<class CT, class... S>
using xt::xview< CT, S >::xexpression_type = std::decay_t<CT>

Definition at line 369 of file xview.hpp.

Constructor & Destructor Documentation

◆ xview()

template<class CT, class... S>
template<class CTA, class FSL, class... SL>
xt::xview< CT, S >::xview ( CTA && e,
FSL && first_slice,
SL &&... slices )
explicitnoexcept

Constructs a view on the specified xexpression.

Users should not call directly this constructor but use the view function instead.

Parameters
ethe xexpression to adapt
first_slicethe first slice describing the view
slicesthe slices list describing the view
See also
view

Definition at line 880 of file xview.hpp.

Member Function Documentation

◆ assign_to()

template<class CT, class... S>
requires (data_interface_expression<T> and contiguous_view_concept<E, S...>)
template<class E, class T>
requires (data_interface_expression<T> and contiguous_view_concept<E, S...>)
void xt::xview< CT, S >::assign_to ( xexpression< E > & e,
bool force_resize ) const

Definition at line 1453 of file xview.hpp.

◆ backstrides()

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::backstrides ( ) const -> const inner_strides_type &requires(data_interface_expression< T >and strided_view_concept< CT, S... >)
inline

Definition at line 1281 of file xview.hpp.

◆ broadcast_shape()

template<class CT, class... S>
template<class ST>
bool xt::xview< CT, S >::broadcast_shape ( ST & shape,
bool reuse_cache = false ) const
inline

Broadcast the shape of the view 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 1385 of file xview.hpp.

◆ build_view()

template<class CT, class... S>
template<class E>
auto xt::xview< CT, S >::build_view ( E && e) const -> rebind_t< E >
inline

Definition at line 1470 of file xview.hpp.

◆ data() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::data ( ) -> pointer requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
inline

Definition at line 1304 of file xview.hpp.

◆ data() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::data ( ) const -> const_pointer requires(data_interface_expression< T > and strided_view_concept< CT, S... >)
inline

Return the pointer to the underlying buffer.

Definition at line 1296 of file xview.hpp.

◆ data_element() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::data_element ( size_type i) -> reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
inline

Definition at line 1493 of file xview.hpp.

◆ data_element() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::data_element ( size_type i) const -> const_reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
inline

Definition at line 1501 of file xview.hpp.

◆ data_offset()

template<class CT, class... S>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
template<class T>
requires (data_interface_expression<T> and strided_view_concept<CT, S...>)
std::size_t xt::xview< CT, S >::data_offset ( ) const
inlinenoexcept

Return the offset to the first element of the view in the underlying container.

Definition at line 1336 of file xview.hpp.

◆ data_xbegin() [1/2]

template<class CT, class... S>
auto xt::xview< CT, S >::data_xbegin ( ) const
inlinenoexcept

Definition at line 1432 of file xview.hpp.

◆ data_xbegin() [2/2]

template<class CT, class... S>
auto xt::xview< CT, S >::data_xbegin ( )
inlinenoexcept

Definition at line 1426 of file xview.hpp.

◆ data_xbegin_impl()

template<class CT, class... S>
template<class It>
It xt::xview< CT, S >::data_xbegin_impl ( It begin) const
inlinenoexcept

Definition at line 1413 of file xview.hpp.

◆ data_xend() [1/2]

template<class CT, class... S>
auto xt::xview< CT, S >::data_xend ( layout_type l,
size_type offset ) const
inlinenoexcept

Definition at line 1444 of file xview.hpp.

◆ data_xend() [2/2]

template<class CT, class... S>
auto xt::xview< CT, S >::data_xend ( layout_type l,
size_type offset )
inlinenoexcept

Definition at line 1438 of file xview.hpp.

◆ data_xend_impl()

template<class CT, class... S>
template<class It>
It xt::xview< CT, S >::data_xend_impl ( It begin,
layout_type l,
size_type offset ) const
inlinenoexcept

Definition at line 1420 of file xview.hpp.

◆ element() [1/2]

template<class CT, class... S>
template<class It>
auto xt::xview< CT, S >::element ( It first,
It last ) -> reference
inline

Definition at line 1069 of file xview.hpp.

◆ element() [2/2]

template<class CT, class... S>
template<class It>
auto xt::xview< CT, S >::element ( It first,
It last ) const
inline

Definition at line 1122 of file xview.hpp.

◆ expression() [1/2]

template<class CT, class... S>
auto xt::xview< CT, S >::expression ( ) const
inlinenoexcept

Returns a const reference to the underlying expression of the view.

Definition at line 1142 of file xview.hpp.

◆ expression() [2/2]

template<class CT, class... S>
auto xt::xview< CT, S >::expression ( )
inlinenoexcept

Returns a reference to the underlying expression of the view.

Definition at line 1133 of file xview.hpp.

◆ fill()

template<class CT, class... S>
template<class T>
void xt::xview< CT, S >::fill ( const T & value)
inline

Fills the view with the given value.

Parameters
valuethe value to fill the view with.

Definition at line 1012 of file xview.hpp.

◆ flat() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::flat ( size_type i) -> reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
inline

Definition at line 1509 of file xview.hpp.

◆ flat() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::flat ( size_type i) const -> const_reference requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
inline

Definition at line 1518 of file xview.hpp.

◆ has_linear_assign()

template<class CT, class... S>
template<class ST>
bool xt::xview< CT, S >::has_linear_assign ( const ST & str) const
inline

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

Returns
a boolean indicating whether a linear assign is possible

Definition at line 1397 of file xview.hpp.

◆ is_contiguous()

template<class CT, class... S>
bool xt::xview< CT, S >::is_contiguous ( ) const
inlinenoexcept

Definition at line 994 of file xview.hpp.

◆ layout()

template<class CT, class... S>
layout_type xt::xview< CT, S >::layout ( ) const
inlinenoexcept

Returns the slices of the view.

Definition at line 973 of file xview.hpp.

◆ linear_begin() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_begin ( ) -> linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1170 of file xview.hpp.

◆ linear_begin() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_begin ( ) const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1186 of file xview.hpp.

◆ linear_cbegin()

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_cbegin ( ) const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1202 of file xview.hpp.

◆ linear_cend()

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_cend ( ) const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1210 of file xview.hpp.

◆ linear_crbegin()

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_crbegin ( ) const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1250 of file xview.hpp.

◆ linear_crend()

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_crend ( ) const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1258 of file xview.hpp.

◆ linear_end() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_end ( ) -> linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1178 of file xview.hpp.

◆ linear_end() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_end ( ) const -> const_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1194 of file xview.hpp.

◆ linear_rbegin() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_rbegin ( ) -> reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1218 of file xview.hpp.

◆ linear_rbegin() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_rbegin ( ) const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1234 of file xview.hpp.

◆ linear_rend() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_rend ( ) -> reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1226 of file xview.hpp.

◆ linear_rend() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::linear_rend ( ) const -> const_reverse_linear_iterator requires(data_interface_expression< T > and strided_view_concept< CT, S... >)

Definition at line 1242 of file xview.hpp.

◆ load_simd()

template<class CT, class... S>
template<class align, class requested_type, std::size_t N, class T>
auto xt::xview< CT, S >::load_simd ( size_type i) const -> simd_return_type< requested_type > requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
inline

Definition at line 1485 of file xview.hpp.

◆ operator const_reference()

template<class CT, class... S>
template<xscalar_concept ST = self_type>
xt::xview< CT, S >::operator const_reference ( ) const
inline

Definition at line 605 of file xview.hpp.

◆ operator reference()

template<class CT, class... S>
template<xscalar_concept ST = self_type>
xt::xview< CT, S >::operator reference ( )
inline

Definition at line 599 of file xview.hpp.

◆ operator&() [1/3]

template<class CT, class... S>
auto xt::xview< CT, S >::operator& ( ) &
inline

Definition at line 1356 of file xview.hpp.

◆ operator&() [2/3]

template<class CT, class... S>
auto xt::xview< CT, S >::operator& ( ) &&
inline

Definition at line 1368 of file xview.hpp.

◆ operator&() [3/3]

template<class CT, class... S>
auto xt::xview< CT, S >::operator& ( ) const &
inline

Definition at line 1362 of file xview.hpp.

◆ operator()() [1/2]

template<class CT, class... S>
template<class... Args>
auto xt::xview< CT, S >::operator() ( Args... args) -> reference
inline

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

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

Definition at line 1032 of file xview.hpp.

◆ operator()() [2/2]

template<class CT, class... S>
template<class... Args>
auto xt::xview< CT, S >::operator() ( Args... args) const
inline

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

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

Definition at line 1085 of file xview.hpp.

◆ operator=() [1/3]

template<class CT, class... S>
template<class E>
auto xt::xview< CT, S >::operator= ( const E & e)
inline

Definition at line 941 of file xview.hpp.

◆ operator=() [2/3]

template<class CT, class... S>
template<class E>
auto xt::xview< CT, S >::operator= ( const xexpression< E > & e) -> self_type &
inline

The extended assignment operator.

Definition at line 932 of file xview.hpp.

◆ operator=() [3/3]

template<class CT, class... S>
auto xt::xview< CT, S >::operator= ( const xview< CT, S > & rhs)
inline

Definition at line 917 of file xview.hpp.

◆ shape()

template<class CT, class... S>
auto xt::xview< CT, S >::shape ( ) const
inlinenoexcept

Returns the shape of the view.

Definition at line 955 of file xview.hpp.

◆ sliced_access()

template<class CT, class... S>
template<typename std::decay_t< CT >::size_type I, class T, class... Args>
auto xt::xview< CT, S >::sliced_access ( const T & squeeze,
Args...  ) const -> size_type requires(!is_xslice< T >::value)
inline

Definition at line 1678 of file xview.hpp.

◆ slices()

template<class CT, class... S>
auto xt::xview< CT, S >::slices ( ) const
inlinenoexcept

Returns the slices of the view.

Definition at line 964 of file xview.hpp.

◆ stepper_begin() [1/2]

template<class CT, class... S>
template<class ST>
auto xt::xview< CT, S >::stepper_begin ( const ST & shape) -> stepper
inline

Definition at line 1937 of file xview.hpp.

◆ stepper_begin() [2/2]

template<class CT, class... S>
template<class ST>
auto xt::xview< CT, S >::stepper_begin ( const ST & shape) const
inline

Definition at line 1967 of file xview.hpp.

◆ stepper_end() [1/2]

template<class CT, class... S>
template<class ST>
auto xt::xview< CT, S >::stepper_end ( const ST & shape,
layout_type l ) -> stepper
inline

Definition at line 1952 of file xview.hpp.

◆ stepper_end() [2/2]

template<class CT, class... S>
template<class ST>
auto xt::xview< CT, S >::stepper_end ( const ST & shape,
layout_type l ) const
inline

Definition at line 1983 of file xview.hpp.

◆ storage() [1/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::storage ( ) -> storage_type & requires(data_interface_expression< T >)
inline

Returns the data holder of the underlying container (only if the view is on a realized container).

xt::eval will make sure that the underlying xexpression is on a realized container.

Definition at line 1154 of file xview.hpp.

◆ storage() [2/2]

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::storage ( ) const -> const storage_type & requires(data_interface_expression< T >)
inline

Definition at line 1162 of file xview.hpp.

◆ store_simd()

template<class CT, class... S>
template<class align, class simd, class T>
auto xt::xview< CT, S >::store_simd ( size_type i,
const simd & e ) -> void requires(has_simd_interface_concept< T > and strided_view_concept< CT, S... >)
inline

Definition at line 1477 of file xview.hpp.

◆ strides()

template<class CT, class... S>
template<class T>
auto xt::xview< CT, S >::strides ( ) const -> const inner_strides_type &requires(data_interface_expression< T >and strided_view_concept< CT, S... >)
inline

Return the strides for the underlying container of the view.

Definition at line 1269 of file xview.hpp.

◆ unchecked() [1/2]

template<class CT, class... S>
template<class... Args>
auto xt::xview< CT, S >::unchecked ( Args... args) -> reference
inline

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

Parameters
argsa list of indices specifying the position in the view. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the view, 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.unchecked(0, 1);
reference unchecked(Args... args)
Returns a reference to the element at the specified position in the container.
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 1062 of file xview.hpp.

◆ unchecked() [2/2]

template<class CT, class... S>
template<class... Args>
auto xt::xview< CT, S >::unchecked ( Args... args) const
inline

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

Parameters
argsa list of indices specifying the position in the view. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the view, 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.unchecked(0, 1);

Definition at line 1115 of file xview.hpp.

◆ underlying_size()

template<class CT, class... S>
auto xt::xview< CT, S >::underlying_size ( size_type dim) const
inline

Definition at line 1350 of file xview.hpp.

◆ xview_semantic< xview< CT, S... > >

template<class CT, class... S>
friend class xview_semantic< xview< CT, S... > >
friend

Definition at line 742 of file xview.hpp.

Member Data Documentation

◆ contiguous_layout

template<class CT, class... S>
bool xt::xview< CT, S >::contiguous_layout = static_layout != layout_type::dynamic
staticconstexpr

Definition at line 390 of file xview.hpp.

◆ has_trivial_strides

template<class CT, class... S>
bool xt::xview< CT, S >::has_trivial_strides
staticconstexpr
Initial value:
= is_contiguous_view
&& !std::disjunction<detail::is_xrange<S>...>::value

Definition at line 411 of file xview.hpp.

◆ is_const

template<class CT, class... S>
bool xt::xview< CT, S >::is_const = std::is_const<std::remove_reference_t<CT>>::value
staticconstexpr

Definition at line 377 of file xview.hpp.

◆ is_contiguous_view

template<class CT, class... S>
bool xt::xview< CT, S >::is_contiguous_view = contiguous_layout
staticconstexpr

Definition at line 393 of file xview.hpp.

◆ is_strided_view

template<class CT, class... S>
bool xt::xview< CT, S >::is_strided_view = detail::is_strided_view<xexpression_type, S...>::value
staticconstexpr

Definition at line 392 of file xview.hpp.

◆ rank

template<class CT, class... S>
std::size_t xt::xview< CT, S >::rank = SIZE_MAX
staticconstexpr

Definition at line 452 of file xview.hpp.

◆ static_layout

template<class CT, class... S>
layout_type xt::xview< CT, S >::static_layout = inner_types::layout
staticconstexpr

Definition at line 389 of file xview.hpp.


The documentation for this class was generated from the following files:
  • /home/runner/work/xtensor/xtensor/include/xtensor/core/xtensor_forward.hpp
  • /home/runner/work/xtensor/xtensor/include/xtensor/views/xview.hpp