Operators and related functions¶
Defined in xtensor/xmath.hpp
- template <class E>
-
auto
xt::
operator+
(E &&e)¶ Identity.
Returns an xfunction for the element-wise identity of e.
- Return
- an xfunction
- Parameters
e
: an xexpression
- template <class E>
-
auto
xt::
operator-
(E &&e)¶ Opposite.
Returns an xfunction for the element-wise opposite of e.
- Return
- an xfunction
- Parameters
e
: an xexpression
- template <class E1, class E2>
-
auto
xt::
operator+
(E1 &&e1, E2 &&e2)¶ Addition.
Returns an xfunction for the element-wise addition of e1 and e2.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
auto
xt::
operator-
(E1 &&e1, E2 &&e2)¶ Substraction.
Returns an xfunction for the element-wise substraction of e2 to e1.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
auto
xt::
operator*
(E1 &&e1, E2 &&e2)¶ Multiplication.
Returns an xfunction for the element-wise multiplication of e1 by e2.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
auto
xt::
operator/
(E1 &&e1, E2 &&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, class E2>
-
auto
xt::
operator||
(E1 &&e1, E2 &&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
Warning
doxygenfunction: Cannot find function “operator&&” in doxygen xml output for project “xtensor” from directory: ../xml
- template <class E>
-
auto
xt::
operator!
(E &&e)¶ Not.
Returns an xfunction for the element-wise not of e.
- Return
- an xfunction
- Parameters
e
: an xexpression
- template <class E1, class E2, class E3>
-
auto
xt::
where
(E1 &&e1, E2 &&e2, E3 &&e3)¶ Ternary selection.
Returns an xfunction for the element-wise ternary selection (i.e. operator ? :) of e1, e2 and e3.
- Return
- an xfunction
- Parameters
e1
: a boolean xexpressione2
: an xexpression or a scalare3
: an xexpression or a scalar
- template <class T>
-
auto
xt::
nonzero
(const T &arr)¶ return vector of indices where T is not zero
- Return
- vector of index_types where arr is not equal to zero
- Parameters
arr
: input array
- template <class T>
-
auto
xt::
where
(const T &condition)¶ return vector of indices where condition is true (equivalent to nonzero(condition))
- Return
- vector of index_types where condition is not equal to zero
- Parameters
condition
: input array
- template <class E>
-
bool
xt::
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>
-
bool
xt::
all
(E &&e)¶ Any.
Returns true if all of the values of e are truthy, false otherwise.
- Return
- a boolean
- Parameters
e
: an xexpression
- template <class E1, class E2>
-
auto
xt::
operator<
(E1 &&e1, E2 &&e2)¶ Lesser than.
Returns an xfunction for the element-wise lesser than comparison of e1 and e2.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
auto
xt::
operator<=
(E1 &&e1, E2 &&e2)¶ Lesser or equal.
Returns an xfunction for the element-wise lesser or equal comparison of e1 and e2.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
auto
xt::
operator>
(E1 &&e1, E2 &&e2)¶ Greater than.
Returns an xfunction for the element-wise greater than comparison of e1 and e2.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
auto
xt::
operator>=
(E1 &&e1, E2 &&e2)¶ Greater or equal.
Returns an xfunction for the element-wise greater or equal comparison of e1 and e2.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
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, class E2>
-
bool
xt::
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
- template <class E1, class E2>
-
auto
xt::
equal
(E1 &&e1, E2 &&e2)¶ Element-wise equality.
Returns an xfunction for the element-wise equality of e1 and e2.
- Return
- an xfunction
- Parameters
e1
: an xexpression or a scalare2
: an xexpression or a scalar
- template <class E1, class E2>
-
auto
xt::
not_equal
(E1 &&e1, E2 &&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