|
xtensor
|
View of an xexpression from vector of indices. More...
#include <xindex_view.hpp>
Public Types | |
| using | self_type = xindex_view<CT, I> |
| using | xexpression_type = std::decay_t<CT> |
| using | semantic_base = xview_semantic<self_type> |
| using | extension_base = extension::xindex_view_base_t<CT, I> |
| using | expression_tag = typename extension_base::expression_tag |
| using | value_type = typename xexpression_type::value_type |
| using | reference = inner_reference_t<CT> |
| using | const_reference = typename xexpression_type::const_reference |
| using | pointer = typename xexpression_type::pointer |
| using | const_pointer = typename xexpression_type::const_pointer |
| using | size_type = typename xexpression_type::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 = inner_shape_type |
| using | indices_type = I |
| using | stepper = typename iterable_base::stepper |
| using | const_stepper = typename iterable_base::const_stepper |
| using | temporary_type = typename xcontainer_inner_types<self_type>::temporary_type |
| using | base_index_type = xindex_type_t<shape_type> |
| using | bool_load_type = typename xexpression_type::bool_load_type |
| template<class E> | |
| using | rebind_t = xindex_view<E, I> |
| Public Types inherited from xt::xview_semantic< xindex_view< CT, I > > | |
| using | base_type |
| using | derived_type |
| using | temporary_type |
| Public Types inherited from xt::xsemantic_base< xindex_view< CT, I > > | |
| using | base_type |
| using | derived_type |
| using | temporary_type |
| Public Types inherited from xt::xiterable< xindex_view< CT, I > > | |
| using | derived_type |
| using | base_type |
| using | inner_shape_type |
| using | stepper |
| using | const_stepper |
| using | linear_iterator |
| using | reverse_linear_iterator |
| using | layout_iterator |
| using | const_layout_iterator |
| using | reverse_layout_iterator |
| using | const_reverse_layout_iterator |
| using | broadcast_iterator |
| using | const_broadcast_iterator |
| using | reverse_broadcast_iterator |
| using | const_reverse_broadcast_iterator |
| using | iterator |
| using | const_iterator |
| using | reverse_iterator |
| using | const_reverse_iterator |
| Public Types inherited from xt::xconst_iterable< xindex_view< CT, I > > | |
| using | derived_type |
| using | iterable_types |
| using | inner_shape_type |
| using | stepper |
| using | const_stepper |
| using | layout_iterator |
| using | const_layout_iterator |
| using | reverse_layout_iterator |
| using | const_reverse_layout_iterator |
| using | linear_iterator |
| using | const_linear_iterator |
| using | reverse_linear_iterator |
| using | const_reverse_linear_iterator |
| using | broadcast_iterator |
| using | const_broadcast_iterator |
| using | reverse_broadcast_iterator |
| using | const_reverse_broadcast_iterator |
| using | iterator |
| using | const_iterator |
| using | reverse_iterator |
| using | const_reverse_iterator |
Public Member Functions | |
Constructor | |
| template<class CTA, class I2> | |
| xindex_view (CTA &&e, I2 &&indices) noexcept | |
| Constructs an xindex_view, selecting the indices specified by indices. | |
Size and shape | |
| size_type | size () const noexcept |
| Returns the size of the xindex_view. | |
| size_type | dimension () const noexcept |
| Returns the number of dimensions of the xindex_view. | |
| const inner_shape_type & | shape () const noexcept |
| Returns the shape of the xindex_view. | |
| size_type | shape (size_type index) const |
| Returns the i-th dimension of the expression. | |
| layout_type | layout () const noexcept |
| bool | is_contiguous () const noexcept |
Data | |
| template<class T> | |
| void | fill (const T &value) |
| Fills the view with the given value. | |
| reference | operator() (size_type idx=size_type(0)) |
| Returns a reference to the element at the specified position in the xindex_view. | |
| template<class... Args> | |
| reference | operator() (size_type idx0, size_type idx1, Args... args) |
| reference | unchecked (size_type idx) |
| Returns a reference to the element at the specified position in the xindex_view. | |
| template<class S> | |
| disable_integral_t< S, reference > | operator[] (const S &index) |
| Returns a reference to the element at the specified position in the container. | |
| template<class OI> | |
| reference | operator[] (std::initializer_list< OI > index) |
| reference | operator[] (size_type i) |
| template<class It> | |
| reference | element (It first, It last) |
| Returns a reference to the element at the specified position in the xindex_view. | |
| const_reference | operator() (size_type idx=size_type(0)) const |
| Returns a constant reference to the element at the specified position in the xindex_view. | |
| template<class... Args> | |
| const_reference | operator() (size_type idx0, size_type idx1, Args... args) const |
| const_reference | unchecked (size_type idx) const |
| Returns a constant reference to the element at the specified position in the xindex_view. | |
| template<class S> | |
| disable_integral_t< S, const_reference > | operator[] (const S &index) const |
| Returns a constant reference to the element at the specified position in the container. | |
| template<class OI> | |
| const_reference | operator[] (std::initializer_list< OI > index) const |
| const_reference | operator[] (size_type i) const |
| template<class It> | |
| const_reference | element (It first, It last) const |
| Returns a reference to the element at the specified position in the xindex_view. | |
| xexpression_type & | expression () noexcept |
| Returns a reference to the underlying expression of the view. | |
| const xexpression_type & | expression () const noexcept |
| Returns a constant reference to the underlying expression of the view. | |
Broadcasting | |
| template<class O> | |
| bool | broadcast_shape (O &shape, bool reuse_cache=false) const |
| Broadcast the shape of the xindex_view to the specified parameter. | |
| template<class O> | |
| bool | has_linear_assign (const O &) const noexcept |
| Checks whether the xindex_view 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) |
| template<class ST> | |
| const_stepper | stepper_begin (const ST &shape) const |
| template<class ST> | |
| const_stepper | stepper_end (const ST &shape, layout_type) const |
| template<class E> | |
| rebind_t< E > | build_index_view (E &&e) const |
| Public Member Functions inherited from xt::xview_semantic< xindex_view< CT, I > > | |
| 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< xindex_view< CT, I > > | |
| 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::xiterable< xindex_view< CT, I > > | |
| const_layout_iterator< L > | begin () const noexcept |
| Returns a constant iterator to the first element of the expression. | |
| const_broadcast_iterator< S, L > | begin (const S &shape) const noexcept |
| Returns a constant iterator to the first element of the expression. | |
| const_layout_iterator< L > | end () const noexcept |
| Returns a constant iterator to the element following the last element of the expression. | |
| 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. | |
| const_reverse_layout_iterator< L > | rbegin () const noexcept |
| Returns a constant iterator to the first element of the reversed expression. | |
| const_reverse_broadcast_iterator< S, L > | rbegin (const S &shape) const noexcept |
| Returns a constant iterator to the first element of the reversed expression. | |
| const_reverse_layout_iterator< L > | rend () const noexcept |
| Returns a constant iterator to the element following the last element of the reversed expression. | |
| 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. | |
| Public Member Functions inherited from xt::xconst_iterable< xindex_view< CT, I > > | |
| const_layout_iterator< L > | begin () const noexcept |
| Returns a constant iterator to the first element of the expression. | |
| const_layout_iterator< L > | end () const noexcept |
| Returns a constant iterator to the element following the last element of the expression. | |
| const_layout_iterator< L > | cbegin () const noexcept |
| Returns a constant iterator to the first element of the expression. | |
| const_layout_iterator< L > | cend () const noexcept |
| Returns a constant iterator to the element following the last element of the expression. | |
| const_reverse_layout_iterator< L > | rbegin () const noexcept |
| Returns a constant iterator to the first element of the reversed expression. | |
| const_reverse_layout_iterator< L > | rend () const noexcept |
| Returns a constant iterator to the element following the last element of the reversed expression. | |
| const_reverse_layout_iterator< L > | crbegin () const noexcept |
| Returns a constant iterator to the first element of the reversed expression. | |
| const_reverse_layout_iterator< L > | crend () 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 = layout_type::dynamic |
| static constexpr bool | contiguous_layout = false |
Friends | |
| class | xview_semantic< xindex_view< CT, I > > |
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) |
Additional Inherited Members | |
| Protected Member Functions inherited from xt::xview_semantic< xindex_view< CT, I > > | |
| xview_semantic & | operator= (const xview_semantic &)=default |
| Protected Member Functions inherited from xt::xsemantic_base< xindex_view< CT, I > > | |
| xsemantic_base & | operator= (const xsemantic_base &)=default |
| const inner_shape_type & | get_shape () const |
View of an xexpression from vector of indices.
The xindex_view class implements a flat (1D) view into a multidimensional xexpression yielding the values at the indices of the index array. xindex_view is not meant to be used directly, but only with the index_view and filter helper functions.
| CT | the closure type of the xexpression type underlying this view |
| I | the index array type of the view |
Definition at line 90 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::base_index_type = xindex_type_t<shape_type> |
Definition at line 121 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::bool_load_type = typename xexpression_type::bool_load_type |
Definition at line 123 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::const_pointer = typename xexpression_type::const_pointer |
Definition at line 107 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::const_reference = typename xexpression_type::const_reference |
Definition at line 105 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::const_stepper = typename iterable_base::const_stepper |
Definition at line 118 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::difference_type = typename xexpression_type::difference_type |
Definition at line 109 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::expression_tag = typename extension_base::expression_tag |
Definition at line 101 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::extension_base = extension::xindex_view_base_t<CT, I> |
Definition at line 100 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::indices_type = I |
Definition at line 115 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::inner_shape_type = typename iterable_base::inner_shape_type |
Definition at line 112 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::iterable_base = xiterable<self_type> |
Definition at line 111 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::pointer = typename xexpression_type::pointer |
Definition at line 106 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::rebind_t = xindex_view<E, I> |
Definition at line 193 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::reference = inner_reference_t<CT> |
Definition at line 104 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::self_type = xindex_view<CT, I> |
Definition at line 96 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::semantic_base = xview_semantic<self_type> |
Definition at line 98 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::shape_type = inner_shape_type |
Definition at line 113 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::size_type = typename xexpression_type::size_type |
Definition at line 108 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::stepper = typename iterable_base::stepper |
Definition at line 117 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::temporary_type = typename xcontainer_inner_types<self_type>::temporary_type |
Definition at line 120 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::value_type = typename xexpression_type::value_type |
Definition at line 103 of file xindex_view.hpp.
| using xt::xindex_view< CT, I >::xexpression_type = std::decay_t<CT> |
Definition at line 97 of file xindex_view.hpp.
|
inlinenoexcept |
Constructs an xindex_view, selecting the indices specified by indices.
The resulting xexpression has a 1D shape with a length of n for n indices.
| e | the underlying xexpression for this view |
| indices | the indices to select |
Definition at line 287 of file xindex_view.hpp.
|
inline |
Broadcast the shape of the xindex_view to the specified parameter.
| shape | the result shape |
| reuse_cache | parameter for internal optimization |
Definition at line 562 of file xindex_view.hpp.
|
inline |
Definition at line 619 of file xindex_view.hpp.
|
inlinenoexcept |
Returns the number of dimensions of the xindex_view.
Definition at line 343 of file xindex_view.hpp.
|
inline |
Returns a reference to the element at the specified position in the xindex_view.
| first | iterator starting the sequence of indices |
| last | iterator ending the sequence of indices (not used, only for compatibility with xexpression operator()) The number of indices in the sequence should be equal to or greater 1. |
Definition at line 512 of file xindex_view.hpp.
|
inline |
Returns a reference to the element at the specified position in the xindex_view.
| first | iterator starting the sequence of indices |
| last | iterator ending the sequence of indices (not used, only for compatibility with xexpression operator()) The number of indices in the sequence should be equal to or greater 1. |
Definition at line 525 of file xindex_view.hpp.
|
inlinenoexcept |
Returns a constant reference to the underlying expression of the view.
Definition at line 543 of file xindex_view.hpp.
|
inlinenoexcept |
Returns a reference to the underlying expression of the view.
Definition at line 534 of file xindex_view.hpp.
|
inline |
Fills the view with the given value.
| value | the value to fill the view with. |
Definition at line 391 of file xindex_view.hpp.
|
inlinenoexcept |
Checks whether the xindex_view can be linearly assigned to an expression with the specified strides.
Definition at line 574 of file xindex_view.hpp.
|
inlinenoexcept |
Definition at line 373 of file xindex_view.hpp.
|
inlinenoexcept |
Definition at line 367 of file xindex_view.hpp.
|
inline |
Definition at line 409 of file xindex_view.hpp.
|
inline |
Definition at line 437 of file xindex_view.hpp.
|
inline |
Returns a reference to the element at the specified position in the xindex_view.
| idx | index specifying the position in the index_view. More indices may be provided, only the last one will be used. |
Definition at line 402 of file xindex_view.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the xindex_view.
| idx | index specifying the position in the index_view. More indices may be provided, only the last one will be used. |
Definition at line 430 of file xindex_view.hpp.
|
inline |
Definition at line 314 of file xindex_view.hpp.
|
inline |
The extended assignment operator.
Definition at line 305 of file xindex_view.hpp.
|
inline |
Returns a reference to the element at the specified position in the container.
| index | a sequence of indices specifying the position in the container. Indices must be unsigned integers, the number of indices in the list should be equal or greater than the number of dimensions of the container. |
Definition at line 460 of file xindex_view.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the container.
| index | a sequence of indices specifying the position in the container. Indices must be unsigned integers, the number of indices in the list should be equal or greater than the number of dimensions of the container. |
Definition at line 486 of file xindex_view.hpp.
|
inline |
Definition at line 473 of file xindex_view.hpp.
|
inline |
Definition at line 499 of file xindex_view.hpp.
|
inline |
Definition at line 467 of file xindex_view.hpp.
|
inline |
Definition at line 493 of file xindex_view.hpp.
|
inlinenoexcept |
Returns the shape of the xindex_view.
Definition at line 352 of file xindex_view.hpp.
|
inline |
Returns the i-th dimension of the expression.
Definition at line 361 of file xindex_view.hpp.
|
inlinenoexcept |
Returns the size of the xindex_view.
Definition at line 334 of file xindex_view.hpp.
|
inline |
Definition at line 587 of file xindex_view.hpp.
|
inline |
Definition at line 603 of file xindex_view.hpp.
|
inline |
Definition at line 595 of file xindex_view.hpp.
|
inline |
Definition at line 611 of file xindex_view.hpp.
|
inline |
Returns a reference to the element at the specified position in the xindex_view.
| idx | index specifying the position in the index_view. |
Definition at line 419 of file xindex_view.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the xindex_view.
| idx | index specifying the position in the index_view. |
Definition at line 447 of file xindex_view.hpp.
|
friend |
Definition at line 204 of file xindex_view.hpp.
|
staticconstexpr |
Definition at line 126 of file xindex_view.hpp.
|
staticconstexpr |
Definition at line 125 of file xindex_view.hpp.