Operators and related functions¶
Defined in xtensor/xmath.hpp
and xtensor/xoperation.hpp
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator+” with arguments ((E&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class E1, class E2> auto operator+(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::plus, E1, E2>
- template<class E> auto operator+(E &&e) noexcept -> detail::xfunction_type_t<detail::identity, E>
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator-” with arguments ((E&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- difference_type operator-(const self_type &rhs) const
- difference_type operator-(const self_type &rhs) const noexcept
- difference_type operator-(xfunctor_iterator rhs) const
- template<class E1, class E2> auto operator-(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::minus, E1, E2>
- template<class E> auto operator-(E &&e) noexcept -> detail::xfunction_type_t<detail::negate, E>
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator+” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class E1, class E2> auto operator+(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::plus, E1, E2>
- template<class E> auto operator+(E &&e) noexcept -> detail::xfunction_type_t<detail::identity, E>
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator-” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- difference_type operator-(const self_type &rhs) const
- difference_type operator-(const self_type &rhs) const noexcept
- difference_type operator-(xfunctor_iterator rhs) const
- template<class E1, class E2> auto operator-(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::minus, E1, E2>
- template<class E> auto operator-(E &&e) noexcept -> detail::xfunction_type_t<detail::negate, E>
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator*” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- decltype(auto) operator*() const
- reference operator*() const
- reference operator*() const noexcept
- template<class E1, class E2> auto operator*(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::multiplies, E1, E2>
- value_type operator*() const
-
template<class
E1
, classE2
>
autoxt
::
operator/
(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::divides, E1, E2>¶ Division.
Returns an xfunction for the element-wise division of e1 by e2.
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E1
, classE2
>
autoxt
::
operator||
(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::logical_or, E1, E2>¶ Or.
Returns an xfunction for the element-wise or of e1 and e2.
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E1
, classE2
>
autoxt
::
operator&&
(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::logical_and, E1, E2>¶ And.
Returns an xfunction for the element-wise and of e1 and e2.
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E
>
autoxt
::
operator!
(E &&e) noexcept -> detail::xfunction_type_t<detail::logical_not, E>¶ Not.
Returns an xfunction for the element-wise not of e.
- Return
an xfunction
- Parameters
e
: an xexpression
Warning
doxygenfunction: Unable to resolve multiple matches for function “where” with arguments ((E1&&, E2&&, E3&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class E1, class E2, class E3> auto where(E1 &&e1, E2 &&e2, E3 &&e3) noexcept -> detail::xfunction_type_t<detail::conditional_ternary, E1, E2, E3>
- template<class T> auto where(const T &condition)
-
template<class
E
>
boolxt
::
any
(E &&e)¶ Any.
Returns true if any of the values of e is truthy, false otherwise.
- Return
a boolean
- Parameters
e
: an xexpression
-
template<class
E
>
boolxt
::
all
(E &&e)¶ Any.
Returns true if all of the values of e are truthy, false otherwise.
- Return
a boolean
- Parameters
e
: an xexpression
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- bool operator<(const self_type &rhs) const
- template<bool is_const, class CT> bool operator<(const xdummy_iterator<is_const, CT> &lhs, const xdummy_iterator<is_const, CT> &rhs) noexcept
- template<class D> bool operator<(const xbuffer_adaptor_base<D> &lhs, const xbuffer_adaptor_base<D> &rhs)
- template<class E1, class E2> auto operator<(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::less, E1, E2>
- template<class F, class ...CT> bool operator<(const xfunction_iterator<F, CT...> &it1, const xfunction_iterator<F, CT...> &it2)
- template<class F, class IT> bool operator<(const xfunctor_iterator<F, IT> &lhs, const xfunctor_iterator<F, IT> &rhs)
- template<class It, class BIt> bool operator<(const xbounded_iterator<It, BIt> &lhs, const xbounded_iterator<It, BIt> &rhs)
- template<class St, class S, layout_type L> bool operator<(const xiterator<St, S, L> &lhs, const xiterator<St, S, L> &rhs)
- template<class T, class A> bool operator<(const uvector<T, A> &lhs, const uvector<T, A> &rhs)
- template<class T, std::size_t N, class A, bool Init> bool operator<(const svector<T, N, A, Init> &lhs, const svector<T, N, A, Init> &rhs)
- template<class T, std::size_t N> bool operator<(const const_array<T, N> &lhs, const const_array<T, N> &rhs)
- template<class VE, class FE> bool operator<(const xoptional_assembly_storage<VE, FE> &lhs, const xoptional_assembly_storage<VE, FE> &rhs)
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<=” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class D> bool operator<=(const xbuffer_adaptor_base<D> &lhs, const xbuffer_adaptor_base<D> &rhs)
- template<class E1, class E2> auto operator<=(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::less_equal, E1, E2>
- template<class T, class A> bool operator<=(const uvector<T, A> &lhs, const uvector<T, A> &rhs)
- template<class T, std::size_t N, class A, bool Init> bool operator<=(const svector<T, N, A, Init> &lhs, const svector<T, N, A, Init> &rhs)
- template<class T, std::size_t N> bool operator<=(const const_array<T, N> &lhs, const const_array<T, N> &rhs)
- template<class VE, class FE> bool operator<=(const xoptional_assembly_storage<VE, FE> &lhs, const xoptional_assembly_storage<VE, FE> &rhs)
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator>” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class D> bool operator>(const xbuffer_adaptor_base<D> &lhs, const xbuffer_adaptor_base<D> &rhs)
- template<class E1, class E2> auto operator>(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::greater, E1, E2>
- template<class T, class A> bool operator>(const uvector<T, A> &lhs, const uvector<T, A> &rhs)
- template<class T, std::size_t N, class A, bool Init> bool operator>(const svector<T, N, A, Init> &lhs, const svector<T, N, A, Init> &rhs)
- template<class T, std::size_t N> bool operator>(const const_array<T, N> &lhs, const const_array<T, N> &rhs)
- template<class VE, class FE> bool operator>(const xoptional_assembly_storage<VE, FE> &lhs, const xoptional_assembly_storage<VE, FE> &rhs)
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator>=” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class D> bool operator>=(const xbuffer_adaptor_base<D> &lhs, const xbuffer_adaptor_base<D> &rhs)
- template<class E1, class E2> auto operator>=(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::greater_equal, E1, E2>
- template<class T, class A> bool operator>=(const uvector<T, A> &lhs, const uvector<T, A> &rhs)
- template<class T, std::size_t N, class A, bool Init> bool operator>=(const svector<T, N, A, Init> &lhs, const svector<T, N, A, Init> &rhs)
- template<class T, std::size_t N> bool operator>=(const const_array<T, N> &lhs, const const_array<T, N> &rhs)
- template<class VE, class FE> bool operator>=(const xoptional_assembly_storage<VE, FE> &lhs, const xoptional_assembly_storage<VE, FE> &rhs)
-
template<class
E1
, classE2
>
std::enable_if_t<xoptional_comparable<E1, E2>::value, bool>xt
::
operator==
(const xexpression<E1> &e1, const xexpression<E2> &e2)¶ Equality.
Returns true if e1 and e2 have the same shape and hold the same values. Unlike other comparison operators, this does not return an xfunction.
- Return
a boolean
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E1
, classE2
>
boolxt
::
operator!=
(const xexpression<E1> &e1, const xexpression<E2> &e2)¶ Inequality.
Returns true if e1 and e2 have different shapes or hold the different values. Unlike other comparison operators, this does not return an xfunction.
- Return
a boolean
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
Warning
doxygenfunction: Unable to resolve multiple matches for function “equal” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- bool equal(const self_type &rhs) const
- bool equal(const self_type &rhs) const noexcept
- bool equal(const xfunctor_iterator &rhs) const
- bool equal(const xiterator &rhs) const
- template<class E1, class E2> auto equal(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::equal_to, E1, E2>
-
template<class
E1
, classE2
>
autoxt
::
not_equal
(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::not_equal_to, E1, E2>¶ Element-wise inequality.
Returns an xfunction for the element-wise inequality of e1 and e2.
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E1
, classE2
>
autoxt
::
less
(E1 &&e1, E2 &&e2) noexcept -> decltype(std::forward<E1>(e1) < std::forward<E2>(e2))¶ Lesser than.
Returns an xfunction for the element-wise lesser than comparison of e1 and e2. This function is equivalent to operator<(E1&&, E2&&).
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E1
, classE2
>
autoxt
::
less_equal
(E1 &&e1, E2 &&e2) noexcept -> decltype(std::forward<E1>(e1) <= std::forward<E2>(e2))¶ Lesser or equal.
Returns an xfunction for the element-wise lesser or equal comparison of e1 and e2. This function is equivalent to operator<=(E1&&, E2&&).
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E1
, classE2
>
autoxt
::
greater
(E1 &&e1, E2 &&e2) noexcept -> decltype(std::forward<E1>(e1) > std::forward<E2>(e2))¶ Greater than.
Returns an xfunction for the element-wise greater than comparison of e1 and e2. This function is equivalent to operator>(E1&&, E2&&).
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E1
, classE2
>
autoxt
::
greater_equal
(E1 &&e1, E2 &&e2) noexcept -> decltype(std::forward<E1>(e1) >= std::forward<E2>(e2))¶ Greater or equal.
Returns an xfunction for the element-wise greater or equal comparison of e1 and e2. This function is equivalent to operator>=(E1&&, E2&&).
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator&” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class E1, class E2> auto operator&(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::bitwise_and, E1, E2>
- xtl::xclosure_pointer<const self_type&> operator&() const &
- xtl::xclosure_pointer<self_type&> operator&() &
- xtl::xclosure_pointer<self_type> operator&() &&
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator|” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- template<class ...OA> auto operator|(const rangemaker<OA...> &rng, const std::ptrdiff_t &t)
- template<class ...OA> auto operator|(const rangemaker<OA...> &rng, const xt::placeholders::xtuph&)
- template<class E1, class E2> auto operator|(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::bitwise_or, E1, E2>
- template<template<class...> class A, class ...AX, class X, xtl::check_concept<is_evaluation_strategy<AX>..., is_evaluation_strategy<X>> = 0> auto operator|(const A<AX...> &args, const A<X> &rhs)
-
template<class
E1
, classE2
>
autoxt
::
operator^
(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::bitwise_xor, E1, E2>¶ Bitwise xor.
Returns an xfunction for the element-wise bitwise xor of e1 and e2.
- Return
an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
-
template<class
E
>
autoxt
::
operator~
(E &&e) noexcept -> detail::xfunction_type_t<detail::bitwise_not, E>¶ Bitwise not.
Returns an xfunction for the element-wise bitwise not of e.
- Return
an xfunction
- Parameters
e
: an xexpression
-
template<class
E1
, classE2
>
autoxt
::
left_shift
(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::left_shift, E1, E2>¶ Bitwise left shift.
Returns an xfunction for the element-wise bitwise left shift of e1 by e2.
- Return
an xfunction
- Parameters
e1
: an xexpressione2
: an xexpression
-
template<class
E1
, classE2
>
autoxt
::
right_shift
(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<detail::right_shift, E1, E2>¶ Bitwise left shift.
Returns an xfunction for the element-wise bitwise left shift of e1 by e2.
- Return
an xfunction
- Parameters
e1
: an xexpressione2
: an xexpression
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<<” with arguments ((E1&&, E2&&)) in doxygen xml output for project “xtensor” from directory: ../xml. Potential matches:
- std::ostream &operator<<(std::ostream &out, const edge_items &n)
- std::ostream &operator<<(std::ostream &out, const line_width &n)
- std::ostream &operator<<(std::ostream &out, const precision &n)
- std::ostream &operator<<(std::ostream &out, const threshold &n)
- template<class E1, class E2> auto operator<<(E1 &&e1, E2 &&e2) noexcept -> detail::shift_return_type_t<detail::left_shift, E1, E2>
- template<class E> std::ostream &operator<<(std::ostream &out, const xexpression<E> &e)
-
template<class
E1
, classE2
>
autoxt
::
operator>>
(E1 &&e1, E2 &&e2) -> detail::shift_return_type_t<detail::right_shift, E1, E2>¶ Bitwise right shift.
Returns an xfunction for the element-wise bitwise right shift of e1 by e2.
- Return
an xfunction
- See
- Parameters
e1
: an xexpressione2
: an xexpression