|
xtensor
|
Multidimensional function operating on indices. More...
#include <xgenerator.hpp>
Public Types | |
| using | self_type = xgenerator<F, R, S> |
| using | functor_type = typename std::remove_reference<F>::type |
| using | accessible_base = xconst_accessible<self_type> |
| using | extension_base = extension::xgenerator_base_t<F, R, S> |
| using | expression_tag = typename extension_base::expression_tag |
| using | inner_types = xcontainer_inner_types<self_type> |
| using | value_type = R |
| using | reference = typename inner_types::reference |
| using | const_reference = typename inner_types::const_reference |
| using | pointer = value_type* |
| using | const_pointer = const value_type* |
| using | size_type = typename inner_types::size_type |
| using | difference_type = std::ptrdiff_t |
| using | iterable_base = xconst_iterable<self_type> |
| using | inner_shape_type = typename iterable_base::inner_shape_type |
| using | shape_type = inner_shape_type |
| using | stepper = typename iterable_base::stepper |
| using | const_stepper = typename iterable_base::const_stepper |
| using | bool_load_type = xt::bool_load_type<R> |
| template<class OR, class OF> | |
| using | rebind_t = xgenerator<OF, OR, S> |
| Public Types inherited from xt::xexpression< xgenerator< F, R, S > > | |
| using | derived_type |
| Public Types inherited from xt::xconst_iterable< xgenerator< F, R, S > > | |
| 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 Types inherited from xt::xconst_accessible< xgenerator< F, R, S > > | |
| using | derived_type |
| using | inner_types |
| using | reference |
| using | const_reference |
| using | size_type |
Public Member Functions | |
| size_type | shape (size_type index) const |
| Returns the i-th dimension of the expression. | |
Constructor | |
| template<class Func> | |
| xgenerator (Func &&f, const S &shape) noexcept | |
| Constructs an xgenerator applying the specified function over the given shape. | |
Size and shape | |
| const inner_shape_type & | shape () const noexcept |
| Returns the shape of the xgenerator. | |
| layout_type | layout () const noexcept |
| bool | is_contiguous () const noexcept |
Data | |
| template<class... Args> | |
| const_reference | operator() (Args... args) const |
| Returns the evaluated element at the specified position in the function. | |
| template<class... Args> | |
| const_reference | unchecked (Args... args) const |
| Returns a constant reference to the element at the specified position in the expression. | |
| template<class It> | |
| const_reference | element (It first, It last) const |
| Returns a constant reference to the element at the specified position in the function. | |
| Public Member Functions inherited from xt::xexpression< xgenerator< F, R, S > > | |
| derived_type & | derived_cast () &noexcept |
| Returns a reference to the actual derived type of the xexpression. | |
| Public Member Functions inherited from xt::xconst_iterable< xgenerator< F, R, S > > | |
| 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. | |
| Public Member Functions inherited from xt::xconst_accessible< xgenerator< F, R, 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 layout_type | static_layout = layout_type::dynamic |
| static constexpr bool | contiguous_layout = false |
Broadcasting | |
| template<class O> | |
| bool | broadcast_shape (O &shape, bool reuse_cache=false) const |
| Broadcast the shape of the function to the specified parameter. | |
| template<class O> | |
| bool | has_linear_assign (const O &) const noexcept |
| Checks whether the xgenerator can be linearly assigned to an expression with the specified strides. | |
| template<class O> | |
| const_stepper | stepper_begin (const O &shape) const noexcept |
| template<class O> | |
| const_stepper | stepper_end (const O &shape, layout_type) const noexcept |
| template<class E, class FE = F> requires (assignable_to_expression<E, FE>) | |
| void | assign_to (xexpression< E > &e) const noexcept |
| const functor_type & | functor () const noexcept |
| template<class OR, class OF> | |
| rebind_t< OR, OF > | build_generator (OF &&func) const |
| template<class O = xt::dynamic_shape<typename shape_type::value_type>> | |
| auto | reshape (O &&shape) const & |
| Reshapes the generator and keeps old elements. | |
| template<class O = xt::dynamic_shape<typename shape_type::value_type>> | |
| auto | reshape (O &&shape) && |
| template<class T> | |
| auto | reshape (std::initializer_list< T > shape) const & |
| template<class T> | |
| auto | reshape (std::initializer_list< T > shape) && |
Additional Inherited Members | |
| Protected Member Functions inherited from xt::xsharable_expression< xgenerator< F, R, S > > | |
| xsharable_expression & | operator= (const xsharable_expression &)=default |
| Protected Member Functions inherited from xt::xexpression< xgenerator< F, R, S > > | |
| xexpression & | operator= (const xexpression &)=default |
| const inner_shape_type & | get_shape () const |
| Protected Member Functions inherited from xt::xconst_accessible< xgenerator< F, R, S > > | |
| xconst_accessible & | operator= (const xconst_accessible &)=default |
Multidimensional function operating on indices.
The xgenerator class implements a multidimensional function, generating a value from the supplied indices.
| F | the function type |
| R | the return type of the function |
| S | the shape type of the generator |
Definition at line 106 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::accessible_base = xconst_accessible<self_type> |
Definition at line 116 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::bool_load_type = xt::bool_load_type<R> |
Definition at line 136 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::const_pointer = const value_type* |
Definition at line 125 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::const_reference = typename inner_types::const_reference |
Definition at line 123 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::const_stepper = typename iterable_base::const_stepper |
Definition at line 134 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::difference_type = std::ptrdiff_t |
Definition at line 127 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::expression_tag = typename extension_base::expression_tag |
Definition at line 118 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::extension_base = extension::xgenerator_base_t<F, R, S> |
Definition at line 117 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::functor_type = typename std::remove_reference<F>::type |
Definition at line 114 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::inner_shape_type = typename iterable_base::inner_shape_type |
Definition at line 130 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::inner_types = xcontainer_inner_types<self_type> |
Definition at line 120 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::iterable_base = xconst_iterable<self_type> |
Definition at line 129 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::pointer = value_type* |
Definition at line 124 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::rebind_t = xgenerator<OF, OR, S> |
Definition at line 175 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::reference = typename inner_types::reference |
Definition at line 122 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::self_type = xgenerator<F, R, S> |
Definition at line 113 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::shape_type = inner_shape_type |
Definition at line 131 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::size_type = typename inner_types::size_type |
Definition at line 126 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::stepper = typename iterable_base::stepper |
Definition at line 133 of file xgenerator.hpp.
| using xt::xgenerator< F, R, S >::value_type = R |
Definition at line 121 of file xgenerator.hpp.
|
inlinenoexcept |
Constructs an xgenerator applying the specified function over the given shape.
| f | the function to apply |
| shape | the shape of the xgenerator |
Definition at line 229 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 376 of file xgenerator.hpp.
|
inline |
Broadcast the shape of the function to the specified parameter.
| shape | the result shape |
| reuse_cache | parameter for internal optimization |
Definition at line 339 of file xgenerator.hpp.
|
inline |
Definition at line 391 of file xgenerator.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the function.
| first | iterator starting the sequence of indices |
| last | iterator 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 318 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 384 of file xgenerator.hpp.
|
inlinenoexcept |
Checks whether the xgenerator can be linearly assigned to an expression with the specified strides.
Definition at line 351 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 257 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 251 of file xgenerator.hpp.
|
inline |
Returns the evaluated element at the specified position in the function.
| args | a list of indices specifying the position in the function. Indices must be unsigned integers, the number of indices should be equal or greater than the number of dimensions of the function. |
Definition at line 276 of file xgenerator.hpp.
|
inline |
Definition at line 415 of file xgenerator.hpp.
|
inline |
Reshapes the generator and keeps old elements.
The shape argument can have one of its value equal to -1, in this case the value is inferred from the number of elements in the generator and the remaining values in the shape.
| shape | the new shape (has to have same number of elements as the original generator) |
Definition at line 408 of file xgenerator.hpp.
|
inline |
Definition at line 432 of file xgenerator.hpp.
|
inline |
Definition at line 425 of file xgenerator.hpp.
|
inlinenoexcept |
Returns the shape of the xgenerator.
Definition at line 245 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 360 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 368 of file xgenerator.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the expression.
| args | a list of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices must be equal to the number of dimensions of the expression, else the behavior is undefined. |
Definition at line 304 of file xgenerator.hpp.
|
staticconstexpr |
Definition at line 139 of file xgenerator.hpp.
|
staticconstexpr |
Definition at line 138 of file xgenerator.hpp.