Operators

Arithmetic operators

template <class E>
auto xt::operator+(E &&e)

Identity.

Returns an xfunction for the element-wise identity of e.

Return
an xfunction
Parameters

template <class E>
auto xt::operator-(E &&e)

Opposite.

Returns an xfunction for the element-wise opposite of e.

Return
an xfunction
Parameters

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

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

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

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

Logical operators

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

template <class E1, class E2>
auto xt::operator&&(E1 &&e1, E2 &&e2)

And.

Returns an xfunction for the element-wise and of e1 and e2.

Return
an xfunction
Parameters

template <class E>
auto xt::operator!(E &&e)

Not.

Returns an xfunction for the element-wise not of e.

Return
an xfunction
Parameters

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

template <class E1, class E2>
auto xt::maximum(E1 &&e1, E2 &&e2)

Elementwise maximum.

Returns an xfunction for the element-wise maximum between e1 and e2.

Return
an xfunction
Parameters

template <class E1, class E2>
auto xt::minimum(E1 &&e1, E2 &&e2)

Elementwise minimum.

Returns an xfunction for the element-wise minimum between e1 and e2.

Return
an xfunction
Parameters

template <class E, class X>
auto xt::amax(E &&e, X &&axes)

Maximum element along given axis.

Returns an xreducer for the maximum of elements over given axes.

Return
an xreducer
Parameters
  • e: an xexpression
  • axes: the axes along which the maximum is found (optional)

template <class E, class X>
auto xt::amin(E &&e, X &&axes)

Minimum element along given axis.

Returns an xreducer for the minimum of elements over given axes.

Return
an xreducer
Parameters
  • e: an xexpression
  • axes: the axes along which the minimum is found (optional)

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

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

Comparison operators

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

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

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

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

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

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

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

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