xtensor
|
Multidimensional function operating on indices. More...
#include <xgenerator.hpp>
Public Member Functions | |
template<class... Args> | |
const_reference | operator() (Args... args) const |
template<class... Args> | |
const_reference | unchecked (Args... args) const |
template<class It > | |
const_reference | element (It first, It last) const |
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 OR , class OF > | |
rebind_t< OR, OF > | build_generator (OF &&func) const |
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> | |
auto | operator() (Args... args) const -> const_reference |
Returns the evaluated element at the specified position in the function. | |
template<class... Args> | |
auto | unchecked (Args... args) const -> const_reference |
Returns a constant reference to the element at the specified position in the expression. | |
template<class It > | |
auto | element (It first, It last) const -> const_reference |
Returns a constant reference to the element at the specified position in the function. | |
Public Member Functions inherited from xt::xexpression< D > | |
derived_type & | derived_cast () &noexcept |
Returns a reference to the actual derived type of the xexpression. | |
const derived_type & | derived_cast () const &noexcept |
Returns a constant reference to the actual derived type of the xexpression. | |
derived_type | derived_cast () &&noexcept |
Returns a constant 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 |
const_broadcast_iterator< S, L > | begin (const S &shape) const noexcept |
const_layout_iterator< L > | end () const noexcept |
const_broadcast_iterator< S, L > | end (const S &shape) const noexcept |
const_layout_iterator< L > | cbegin () const noexcept |
const_broadcast_iterator< S, L > | cbegin (const S &shape) const noexcept |
const_layout_iterator< L > | cend () const noexcept |
const_broadcast_iterator< S, L > | cend (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | rbegin () const noexcept |
const_reverse_broadcast_iterator< S, L > | rbegin (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | rend () const noexcept |
const_reverse_broadcast_iterator< S, L > | rend (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | crbegin () const noexcept |
const_reverse_broadcast_iterator< S, L > | crbegin (const S &shape) const noexcept |
const_reverse_layout_iterator< L > | crend () const noexcept |
const_reverse_broadcast_iterator< S, L > | crend (const S &shape) const noexcept |
auto | begin () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the first element of the expression. | |
auto | end () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | cbegin () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the first element of the expression. | |
auto | cend () const noexcept -> const_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | begin (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the expression. | |
auto | end (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | cbegin (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the expression. | |
auto | cend (const S &shape) const noexcept -> const_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the expression. | |
auto | rbegin () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | rend () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | crbegin () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | crend () const noexcept -> const_reverse_layout_iterator< L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | rbegin (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | rend (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | crbegin (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the first element of the reversed expression. | |
auto | crend (const S &shape) const noexcept -> const_reverse_broadcast_iterator< S, L > |
Returns a constant iterator to the element following the last element of the reversed expression. | |
auto | get_cbegin (bool end_index) const noexcept -> const_layout_iterator< L > |
auto | get_cbegin (const S &shape, bool end_index) const noexcept -> const_broadcast_iterator< S, L > |
auto | get_cend (bool end_index) const noexcept -> const_layout_iterator< L > |
auto | get_cend (const S &shape, bool end_index) const noexcept -> const_broadcast_iterator< S, L > |
auto | get_stepper_begin (const S &shape) const noexcept -> const_stepper |
auto | get_stepper_end (const S &shape, layout_type l) const noexcept -> const_stepper |
Public Member Functions inherited from xt::xconst_accessible< xgenerator< F, R, S > > | |
size_type | size () const noexcept |
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 |
auto | at (Args... args) const -> const_reference |
Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking. | |
disable_integral_t< S, const_reference > | operator[] (const S &index) const |
const_reference | operator[] (std::initializer_list< I > index) const |
const_reference | operator[] (size_type i) const |
auto | operator[] (const S &index) const -> disable_integral_t< S, const_reference > |
Returns a constant reference to the element at the specified position in the expression. | |
auto | operator[] (std::initializer_list< I > index) const -> const_reference |
const_reference | periodic (Args... args) const |
auto | periodic (Args... args) const -> const_reference |
Returns a constant reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and 'overflowing' indices are changed). | |
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 E , class FE = F, class = std::enable_if_t<has_assign_to<E, FE>::value>> | |
void | assign_to (xexpression< E > &e) const noexcept |
const functor_type & | functor () const noexcept |
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) && |
template<class O > | |
auto | stepper_begin (const O &shape) const noexcept -> const_stepper |
template<class O > | |
auto | stepper_end (const O &shape, layout_type) const noexcept -> const_stepper |
template<class OR , class OF > | |
auto | build_generator (OF &&func) const -> rebind_t< OR, OF > |
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.
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.
Definition at line 123 of file xgenerator.hpp.
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.
Definition at line 118 of file xgenerator.hpp.
Definition at line 117 of file xgenerator.hpp.
Definition at line 114 of file xgenerator.hpp.
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.
Definition at line 124 of file xgenerator.hpp.
using xt::xgenerator< F, R, S >::rebind_t = xgenerator<OF, OR, S> |
Definition at line 174 of file xgenerator.hpp.
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.
Definition at line 126 of file xgenerator.hpp.
Definition at line 133 of file xgenerator.hpp.
Definition at line 121 of file xgenerator.hpp.
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 228 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 375 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 338 of file xgenerator.hpp.
Definition at line 389 of file xgenerator.hpp.
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 317 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 382 of file xgenerator.hpp.
Checks whether the xgenerator can be linearly assigned to an expression with the specified strides.
Definition at line 350 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 256 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 250 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 275 of file xgenerator.hpp.
Definition at line 413 of file xgenerator.hpp.
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 406 of file xgenerator.hpp.
|
inline |
Definition at line 430 of file xgenerator.hpp.
|
inline |
Definition at line 423 of file xgenerator.hpp.
|
inlinenoexcept |
Returns the shape of the xgenerator.
Definition at line 244 of file xgenerator.hpp.
|
inline |
Returns the i-th dimension of the expression.
Definition at line 41 of file xaccessible.hpp.
|
inlinenoexcept |
Definition at line 359 of file xgenerator.hpp.
|
inlinenoexcept |
Definition at line 367 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 303 of file xgenerator.hpp.
Definition at line 139 of file xgenerator.hpp.
|
staticconstexpr |
Definition at line 138 of file xgenerator.hpp.