xtensor
|
Multidimensional function operating on xtensor expressions. More...
#include <xfunction.hpp>
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. | |
template<class... Args> | |
const_reference | at (Args... args) const |
template<class... Args> | |
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. | |
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. | |
template<class... Args> | |
bool | in_bounds (Args... args) const |
Returns true only if the the specified position is a valid entry in the expression. | |
template<class... Args> | |
const_reference | periodic (Args... args) const |
template<class... Args> | |
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). | |
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. | |
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. | |
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 | |
Protected Member Functions inherited from xt::xsharable_expression< xfunction< F, CT... > > | |
xsharable_expression (const xsharable_expression &)=default | |
xsharable_expression (xsharable_expression &&)=default | |
xsharable_expression & | operator= (const xsharable_expression &)=default |
xsharable_expression & | operator= (xsharable_expression &&)=default |
Protected Member Functions inherited from xt::xexpression< D > | |
xexpression (const xexpression &)=default | |
xexpression & | operator= (const xexpression &)=default |
xexpression (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 217 of file xfunction.hpp.
using xt::xfunction< F, CT >::accessible_base = xconst_accessible<self_type> |
Definition at line 225 of file xfunction.hpp.
using xt::xfunction< F, CT >::bool_load_type = detail::xfunction_bool_load_type_t<CT...> |
Definition at line 244 of file xfunction.hpp.
using xt::xfunction< F, CT >::broadcast_iterator = typename iterable_base::template broadcast_iterator<S, L> |
Definition at line 269 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_broadcast_iterator = typename iterable_base::template const_broadcast_iterator<S, L> |
Definition at line 271 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_iterator = typename iterable_base::const_iterator |
Definition at line 283 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_layout_iterator = typename iterable_base::template const_layout_iterator<L> |
Definition at line 262 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_linear_iterator = xfunction_iterator<F, CT...> |
Definition at line 277 of file xfunction.hpp.
Definition at line 237 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reference = typename inner_types::const_reference |
Definition at line 235 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 275 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reverse_iterator = typename iterable_base::const_reverse_iterator |
Definition at line 285 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 266 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_reverse_linear_iterator = std::reverse_iterator<const_linear_iterator> |
Definition at line 279 of file xfunction.hpp.
using xt::xfunction< F, CT >::const_stepper = typename iterable_base::const_stepper |
Definition at line 254 of file xfunction.hpp.
using xt::xfunction< F, CT >::difference_type = common_difference_type_t<std::decay_t<CT>...> |
Definition at line 239 of file xfunction.hpp.
using xt::xfunction< F, CT >::expression_tag = typename extension_base::expression_tag |
Definition at line 227 of file xfunction.hpp.
using xt::xfunction< F, CT >::extension_base = extension::xfunction_base_t<F, CT...> |
Definition at line 226 of file xfunction.hpp.
Definition at line 229 of file xfunction.hpp.
using xt::xfunction< F, CT >::inner_shape_type = typename iterable_base::inner_shape_type |
Definition at line 250 of file xfunction.hpp.
using xt::xfunction< F, CT >::inner_types = xcontainer_inner_types<self_type> |
Definition at line 232 of file xfunction.hpp.
using xt::xfunction< F, CT >::iterable_base = xconst_iterable<xfunction<F, CT...>> |
Definition at line 249 of file xfunction.hpp.
using xt::xfunction< F, CT >::iterator = typename iterable_base::iterator |
Definition at line 282 of file xfunction.hpp.
using xt::xfunction< F, CT >::layout_iterator = typename iterable_base::template layout_iterator<L> |
Definition at line 260 of file xfunction.hpp.
using xt::xfunction< F, CT >::linear_iterator = const_linear_iterator |
Definition at line 278 of file xfunction.hpp.
Definition at line 228 of file xfunction.hpp.
Definition at line 236 of file xfunction.hpp.
using xt::xfunction< F, CT >::reference = typename inner_types::reference |
Definition at line 234 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_broadcast_iterator = typename iterable_base::template reverse_broadcast_iterator<S, L> |
Definition at line 273 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_iterator = typename iterable_base::reverse_iterator |
Definition at line 284 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_layout_iterator = typename iterable_base::template reverse_layout_iterator<L> |
Definition at line 264 of file xfunction.hpp.
using xt::xfunction< F, CT >::reverse_linear_iterator = std::reverse_iterator<linear_iterator> |
Definition at line 280 of file xfunction.hpp.
Definition at line 224 of file xfunction.hpp.
Definition at line 251 of file xfunction.hpp.
using xt::xfunction< F, CT >::simd_return_type = xt_simd::simd_return_type<value_type, requested_type> |
Definition at line 247 of file xfunction.hpp.
using xt::xfunction< F, CT >::simd_value_type = xt_simd::simd_type<value_type> |
Definition at line 241 of file xfunction.hpp.
using xt::xfunction< F, CT >::size_type = typename inner_types::size_type |
Definition at line 238 of file xfunction.hpp.
using xt::xfunction< F, CT >::stepper = typename iterable_base::stepper |
Definition at line 253 of file xfunction.hpp.
Definition at line 230 of file xfunction.hpp.
using xt::xfunction< F, CT >::value_type = typename inner_types::value_type |
Definition at line 233 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 541 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 554 of file xfunction.hpp.
|
inline |
Definition at line 875 of file xfunction.hpp.
Definition at line 855 of file xfunction.hpp.
|
inline |
Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking.
args | a list of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices should be equal to the number of dimensions of the expression. |
std::out_of_range | if the number of argument is greater than the number of dimensions or if indices are out of bounds. |
Definition at line 175 of file xaccessible.hpp.
|
inline |
Returns a constant reference to last the element of the expression.
Definition at line 59 of file xaccessible.hpp.
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 720 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 917 of file xfunction.hpp.
|
inline |
Definition at line 835 of file xfunction.hpp.
|
inline |
Definition at line 902 of file xfunction.hpp.
Returns the number of dimensions of the function.
Definition at line 570 of file xfunction.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 701 of file xfunction.hpp.
|
inline |
Definition at line 893 of file xfunction.hpp.
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 659 of file xfunction.hpp.
|
inline |
Returns a constant reference to first the element of the expression.
Definition at line 58 of file xaccessible.hpp.
Definition at line 861 of file xfunction.hpp.
Checks whether the xfunction can be linearly assigned to an expression with the specified strides.
Definition at line 745 of file xfunction.hpp.
|
inline |
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. |
Definition at line 56 of file xaccessible.hpp.
Definition at line 615 of file xfunction.hpp.
|
inlinenoexcept |
Returns the layout_type of the xfunction.
Definition at line 609 of file xfunction.hpp.
Definition at line 757 of file xfunction.hpp.
Definition at line 769 of file xfunction.hpp.
Definition at line 779 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 801 of file xfunction.hpp.
Definition at line 807 of file xfunction.hpp.
Definition at line 763 of file xfunction.hpp.
Definition at line 789 of file xfunction.hpp.
Definition at line 795 of file xfunction.hpp.
|
inline |
Definition at line 849 of file xfunction.hpp.
|
inline |
Definition at line 842 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 642 of file xfunction.hpp.
|
inline |
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).
args | a list of indices specifying the position in the expression. Indices must be integers, the number of indices should be equal to the number of dimensions of the expression. |
Definition at line 217 of file xaccessible.hpp.
Returns the shape of the xfunction.
Definition at line 590 of file xfunction.hpp.
|
inline |
Returns the i-th dimension of the expression.
Definition at line 41 of file xaccessible.hpp.
|
inlinenoexcept |
Returns the size of the expression.
Definition at line 39 of file xaccessible.hpp.
Definition at line 814 of file xfunction.hpp.
|
inlinenoexcept |
Definition at line 825 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 685 of file xfunction.hpp.
|
inline |
Definition at line 885 of file xfunction.hpp.
Definition at line 400 of file xfunction.hpp.
Definition at line 400 of file xfunction.hpp.
Definition at line 400 of file xfunction.hpp.
Definition at line 400 of file xfunction.hpp.
|
staticconstexpr |
Definition at line 257 of file xfunction.hpp.
|
staticconstexpr |
Definition at line 256 of file xfunction.hpp.