Multidimensional function operating on xtensor expressions. More...
#include <xfunction.hpp>
Public Types | |
using | self_type = xfunction<F, CT...> |
using | accessible_base = xconst_accessible<self_type> |
using | extension_base = extension::xfunction_base_t<F, CT...> |
using | expression_tag = typename extension_base::expression_tag |
using | only_scalar = all_xscalar<CT...> |
using | functor_type = typename std::remove_reference<F>::type |
using | tuple_type = std::tuple<CT...> |
using | inner_types = xcontainer_inner_types<self_type> |
using | value_type = typename inner_types::value_type |
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 = common_difference_type_t<std::decay_t<CT>...> |
using | simd_value_type = xt_simd::simd_type<value_type> |
using | bool_load_type = detail::xfunction_bool_load_type_t<CT...> |
template<class requested_type> | |
using | simd_return_type = xt_simd::simd_return_type<value_type, requested_type> |
using | iterable_base = xconst_iterable<xfunction<F, CT...>> |
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 |
template<layout_type L> | |
using | layout_iterator = typename iterable_base::template layout_iterator<L> |
template<layout_type L> | |
using | const_layout_iterator = typename iterable_base::template const_layout_iterator<L> |
template<layout_type L> | |
using | reverse_layout_iterator = typename iterable_base::template reverse_layout_iterator<L> |
template<layout_type L> | |
using | const_reverse_layout_iterator = typename iterable_base::template const_reverse_layout_iterator<L> |
template<class S, layout_type L> | |
using | broadcast_iterator = typename iterable_base::template broadcast_iterator<S, L> |
template<class S, layout_type L> | |
using | const_broadcast_iterator = typename iterable_base::template const_broadcast_iterator<S, L> |
template<class S, layout_type L> | |
using | reverse_broadcast_iterator = typename iterable_base::template reverse_broadcast_iterator<S, L> |
template<class S, layout_type L> | |
using | const_reverse_broadcast_iterator = typename iterable_base::template const_reverse_broadcast_iterator<S, L> |
using | const_linear_iterator = xfunction_iterator<F, CT...> |
using | linear_iterator = const_linear_iterator |
using | const_reverse_linear_iterator = std::reverse_iterator<const_linear_iterator> |
using | reverse_linear_iterator = std::reverse_iterator<linear_iterator> |
using | iterator = typename iterable_base::iterator |
using | const_iterator = typename iterable_base::const_iterator |
using | reverse_iterator = typename iterable_base::reverse_iterator |
using | const_reverse_iterator = typename iterable_base::const_reverse_iterator |
![]() | |
using | derived_type |
Public Member Functions | |
xfunction (const xfunction &)=default | |
xfunction & | operator= (const xfunction &)=default |
xfunction (xfunction &&)=default | |
xfunction & | operator= (xfunction &&)=default |
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 S> | |
const_stepper | stepper_begin (const S &shape) const noexcept |
template<class S> | |
const_stepper | stepper_end (const S &shape, layout_type l) const noexcept |
template<class align, class requested_type = value_type, std::size_t N = xt_simd::simd_traits<requested_type>::size> | |
simd_return_type< requested_type > | load_simd (size_type i) const |
size_type | size () const noexcept |
Returns the size of the expression. | |
size_type | shape (size_type index) const |
Returns the i-th dimension of the expression. | |
const_reference | at (Args... args) const |
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 |
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. | |
bool | in_bounds (Args... args) const |
Returns true only if the the specified position is a valid entry in the expression. | |
const_reference | periodic (Args... args) const |
const_layout_iterator< L > | begin () const noexcept |
const_broadcast_iterator< S, L > | begin (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 > | 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 |
const_layout_iterator< L > | end () const noexcept |
const_broadcast_iterator< S, L > | end (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 |
Constructor | |
template<class Func, class... CTA, class U = std::enable_if_t<!std::is_base_of<std::decay_t<Func>, self_type>::value>> | |
xfunction (Func &&f, CTA &&... e) noexcept | |
Constructs an xfunction applying the specified function to the given arguments. | |
template<class FA, class... CTA> | |
xfunction (xfunction< FA, CTA... > xf) noexcept | |
Constructs an xfunction applying the specified function given by another xfunction with its arguments. | |
Data | |
const_reference | flat (size_type i) const |
Returns a constant reference to the element at the specified position of the underlying contiguous storage of the function. | |
template<class... Args> | |
auto | operator() (Args... args) const -> const_reference |
Returns a constant reference to the 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. | |
![]() | |
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. | |
Static Public Attributes | |
static constexpr layout_type | static_layout = compute_layout(std::decay_t<CT>::static_layout...) |
static constexpr bool | contiguous_layout = static_layout != layout_type::dynamic |
Friends | |
class | xfunction_iterator< F, CT... > |
class | xfunction_stepper< F, CT... > |
class | xconst_iterable< self_type > |
class | xconst_accessible< self_type > |
Size and shape | |
size_type | dimension () const noexcept |
Returns the number of dimensions of the function. | |
const inner_shape_type & | shape () const |
Returns the shape of the xfunction. | |
layout_type | layout () const noexcept |
Returns the layout_type of the xfunction. | |
bool | is_contiguous () const noexcept |
Broadcasting | |
template<class S> | |
bool | broadcast_shape (S &shape, bool reuse_cache=false) const |
Broadcast the shape of the function to the specified parameter. | |
template<class S> | |
bool | has_linear_assign (const S &strides) const noexcept |
Checks whether the xfunction can be linearly assigned to an expression with the specified strides. | |
const_linear_iterator | linear_begin () const noexcept |
const_linear_iterator | linear_end () const noexcept |
const_linear_iterator | linear_cbegin () const noexcept |
const_linear_iterator | linear_cend () const noexcept |
const_reverse_linear_iterator | linear_rbegin () const noexcept |
const_reverse_linear_iterator | linear_rend () const noexcept |
const_reverse_linear_iterator | linear_crbegin () const noexcept |
const_reverse_linear_iterator | linear_crend () const noexcept |
const_reference | data_element (size_type i) const |
template<class UT = self_type, class = typename std::enable_if<UT::only_scalar::value>::type> | |
operator value_type () const | |
const tuple_type & | arguments () const noexcept |
const functor_type & | functor () const noexcept |
template<class S> | |
auto | stepper_begin (const S &shape) const noexcept -> const_stepper |
template<class S> | |
auto | stepper_end (const S &shape, layout_type l) const noexcept -> const_stepper |
template<class align, class requested_type, std::size_t N> | |
auto | load_simd (size_type i) const -> simd_return_type< requested_type > |
template<std::size_t... I, class... Args> | |
auto | access_impl (std::index_sequence< I... >, Args... args) const -> const_reference |
template<std::size_t... I, class... Args> | |
auto | unchecked_impl (std::index_sequence< I... >, Args... args) const -> const_reference |
template<std::size_t... I, class It> | |
auto | element_access_impl (std::index_sequence< I... >, It first, It last) const -> const_reference |
template<std::size_t... I> | |
auto | data_element_impl (std::index_sequence< I... >, size_type i) const -> const_reference |
template<class Func, std::size_t... I> | |
auto | build_stepper (Func &&f, std::index_sequence< I... >) const noexcept -> const_stepper |
Additional Inherited Members | |
![]() | |
xsharable_expression (const xsharable_expression &)=default | |
xsharable_expression (xsharable_expression &&)=default | |
xsharable_expression & | operator= (const xsharable_expression &)=default |
xsharable_expression & | operator= (xsharable_expression &&)=default |
![]() | |
xexpression (const xexpression &)=default | |
xexpression (xexpression &&)=default | |
xexpression & | operator= (const xexpression &)=default |
xexpression & | operator= (xexpression &&)=default |
Multidimensional function operating on xtensor expressions.
The xfunction class implements a multidimensional function operating on xtensor expressions.
F | the function type |
CT | the closure types for arguments of the function |
Definition at line 205 of file xfunction.hpp.
using xt::xfunction< F, CT >::accessible_base = xconst_accessible<self_type> |
Definition at line 213 of file xfunction.hpp.
using xt::xfunction< F, CT >::bool_load_type = detail::xfunction_bool_load_type_t<CT...> |
Definition at line 232 of file xfunction.hpp.
using xt::xfunction< F, CT >::broadcast_iterator = typename iterable_base::template broadcast_iterator<S, L> |
Definition at line 257 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_broadcast_iterator = typename iterable_base::template const_broadcast_iterator<S, L> |
Definition at line 259 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_iterator = typename iterable_base::const_iterator |
Definition at line 271 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_layout_iterator = typename iterable_base::template const_layout_iterator<L> |
Definition at line 250 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_linear_iterator = xfunction_iterator<F, CT...> |
Definition at line 265 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_pointer = const value_type* |
Definition at line 225 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reference = typename inner_types::const_reference |
Definition at line 223 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reverse_broadcast_iterator = typename iterable_base::template const_reverse_broadcast_iterator<S, L> |
Definition at line 263 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reverse_iterator = typename iterable_base::const_reverse_iterator |
Definition at line 273 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reverse_layout_iterator = typename iterable_base::template const_reverse_layout_iterator<L> |
Definition at line 254 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reverse_linear_iterator = std::reverse_iterator<const_linear_iterator> |
Definition at line 267 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_stepper = typename iterable_base::const_stepper |
Definition at line 242 of file xfunction.hpp.
using xt::xfunction< F, CT >::difference_type = common_difference_type_t<std::decay_t<CT>...> |
Definition at line 227 of file xfunction.hpp.
using xt::xfunction< F, CT >::expression_tag = typename extension_base::expression_tag |
Definition at line 215 of file xfunction.hpp.
using xt::xfunction< F, CT >::extension_base = extension::xfunction_base_t<F, CT...> |
Definition at line 214 of file xfunction.hpp.
using xt::xfunction< F, CT >::functor_type = typename std::remove_reference<F>::type |
Definition at line 217 of file xfunction.hpp.
using xt::xfunction< F, CT >::inner_shape_type = typename iterable_base::inner_shape_type |
Definition at line 238 of file xfunction.hpp.
using xt::xfunction< F, CT >::inner_types = xcontainer_inner_types<self_type> |
Definition at line 220 of file xfunction.hpp.
using xt::xfunction< F, CT >::iterable_base = xconst_iterable<xfunction<F, CT...>> |
Definition at line 237 of file xfunction.hpp.
using xt::xfunction< F, CT >::iterator = typename iterable_base::iterator |
Definition at line 270 of file xfunction.hpp.
using xt::xfunction< F, CT >::layout_iterator = typename iterable_base::template layout_iterator<L> |
Definition at line 248 of file xfunction.hpp.
using xt::xfunction< F, CT >::linear_iterator = const_linear_iterator |
Definition at line 266 of file xfunction.hpp.
using xt::xfunction< F, CT >::only_scalar = all_xscalar<CT...> |
Definition at line 216 of file xfunction.hpp.
using xt::xfunction< F, CT >::pointer = value_type* |
Definition at line 224 of file xfunction.hpp.
using xt::xfunction< F, CT >::reference = typename inner_types::reference |
Definition at line 222 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_broadcast_iterator = typename iterable_base::template reverse_broadcast_iterator<S, L> |
Definition at line 261 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_iterator = typename iterable_base::reverse_iterator |
Definition at line 272 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_layout_iterator = typename iterable_base::template reverse_layout_iterator<L> |
Definition at line 252 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_linear_iterator = std::reverse_iterator<linear_iterator> |
Definition at line 268 of file xfunction.hpp.
using xt::xfunction< F, CT >::self_type = xfunction<F, CT...> |
Definition at line 212 of file xfunction.hpp.
using xt::xfunction< F, CT >::shape_type = inner_shape_type |
Definition at line 239 of file xfunction.hpp.
using xt::xfunction< F, CT >::simd_return_type = xt_simd::simd_return_type<value_type, requested_type> |
Definition at line 235 of file xfunction.hpp.
using xt::xfunction< F, CT >::simd_value_type = xt_simd::simd_type<value_type> |
Definition at line 229 of file xfunction.hpp.
using xt::xfunction< F, CT >::size_type = typename inner_types::size_type |
Definition at line 226 of file xfunction.hpp.
using xt::xfunction< F, CT >::stepper = typename iterable_base::stepper |
Definition at line 241 of file xfunction.hpp.
using xt::xfunction< F, CT >::tuple_type = std::tuple<CT...> |
Definition at line 218 of file xfunction.hpp.
using xt::xfunction< F, CT >::value_type = typename inner_types::value_type |
Definition at line 221 of file xfunction.hpp.
|
inlinenoexcept |
Constructs an xfunction applying the specified function to the given arguments.
f | the function to apply |
e | the xexpression arguments |
Definition at line 529 of file xfunction.hpp.
|
inlinenoexcept |
Constructs an xfunction applying the specified function given by another xfunction with its arguments.
xf | the xfunction to apply |
Definition at line 542 of file xfunction.hpp.
|
inline |
Definition at line 860 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 840 of file xfunction.hpp.
|
inline |
Broadcast the shape of the function to the specified parameter.
shape | the result shape |
reuse_cache | boolean for reusing a previously computed shape |
Definition at line 705 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 902 of file xfunction.hpp.
|
inline |
Definition at line 820 of file xfunction.hpp.
|
inline |
Definition at line 887 of file xfunction.hpp.
|
inlinenoexcept |
Returns the number of dimensions of the function.
Definition at line 558 of file xfunction.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 686 of file xfunction.hpp.
|
inline |
Definition at line 878 of file xfunction.hpp.
|
inline |
Returns a constant reference to the element at the specified position of the underlying contiguous storage of the function.
index | index to underlying flat storage. |
Definition at line 644 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 846 of file xfunction.hpp.
|
inlinenoexcept |
Checks whether the xfunction can be linearly assigned to an expression with the specified strides.
Definition at line 730 of file xfunction.hpp.
bool xt::xconst_accessible< self_type >::in_bounds | ( | Args... | args | ) | const |
Returns true
only if the the specified position is a valid entry in the expression.
args | a list of indices specifying the position in the expression. |
|
inlinenoexcept |
Definition at line 600 of file xfunction.hpp.
|
inlinenoexcept |
Returns the layout_type of the xfunction.
Definition at line 594 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 742 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 754 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 764 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 786 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 792 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 748 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 774 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 780 of file xfunction.hpp.
|
inline |
Definition at line 834 of file xfunction.hpp.
|
inline |
Definition at line 827 of file xfunction.hpp.
|
inline |
Returns a constant reference to the 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 627 of file xfunction.hpp.
|
inline |
Returns the shape of the xfunction.
Definition at line 578 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 799 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 810 of file xfunction.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 670 of file xfunction.hpp.
|
inline |
Definition at line 870 of file xfunction.hpp.
|
friend |
Definition at line 388 of file xfunction.hpp.
|
friend |
Definition at line 388 of file xfunction.hpp.
|
friend |
Definition at line 388 of file xfunction.hpp.
|
friend |
Definition at line 388 of file xfunction.hpp.
|
staticconstexpr |
Definition at line 245 of file xfunction.hpp.
|
staticconstexpr |
Definition at line 244 of file xfunction.hpp.