xtensor
Loading...
Searching...
No Matches
Logical operators

Functions

template<class E1 , class E2 >
auto xt::operator|| (E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t< detail::logical_or, E1, E2 >
 Or.
 
template<class E1 , class E2 >
auto xt::operator&& (E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t< detail::logical_and, E1, E2 >
 And.
 
template<class E >
auto xt::operator! (E &&e) noexcept -> detail::xfunction_type_t< detail::logical_not, E >
 Not.
 
template<class E1 , class E2 , class E3 >
auto xt::where (E1 &&e1, E2 &&e2, E3 &&e3) noexcept -> detail::xfunction_type_t< detail::conditional_ternary, E1, E2, E3 >
 Ternary selection.
 
template<class T >
auto xt::nonzero (const T &arr)
 return vector of indices where T is not zero
 
template<class T >
auto xt::where (const T &condition)
 return vector of indices where condition is true (equivalent to nonzero(condition))
 
template<layout_type L = ::xt::layout_type::row_major, class T >
auto xt::argwhere (const T &arr)
 return vector of indices where arr is not zero
 
template<class E >
bool xt::any (E &&e)
 Any.
 
template<class E >
bool xt::all (E &&e)
 Any.
 
template<class E , class T >
auto xt::isin (E &&element, std::initializer_list< T > test_elements) noexcept
 isin
 
template<class E , class F , class = typename std::enable_if_t<has_iterator_interface<F>::value>>
auto xt::isin (E &&element, F &&test_elements) noexcept
 isin
 
template<class E , class I , class = typename std::enable_if_t<is_iterator<I>::value>>
auto xt::isin (E &&element, I &&test_elements_begin, I &&test_elements_end) noexcept
 isin
 
template<class E , class T >
auto xt::in1d (E &&element, std::initializer_list< T > test_elements) noexcept
 in1d
 
template<class E , class F , class = typename std::enable_if_t<has_iterator_interface<F>::value>>
auto xt::in1d (E &&element, F &&test_elements) noexcept
 in1d
 
template<class E , class I , class = typename std::enable_if_t<is_iterator<I>::value>>
auto xt::in1d (E &&element, I &&test_elements_begin, I &&test_elements_end) noexcept
 in1d
 

Detailed Description

Function Documentation

◆ all()

template<class E >
bool xt::all ( E && e)
inline

Any.

Returns true if all of the values of e are truthy, false otherwise.

Parameters
ean xexpression
Returns
a boolean

Definition at line 960 of file xoperation.hpp.

◆ any()

template<class E >
bool xt::any ( E && e)
inline

Any.

Returns true if any of the values of e is truthy, false otherwise.

Parameters
ean xexpression
Returns
a boolean

Definition at line 936 of file xoperation.hpp.

◆ argwhere()

template<layout_type L = ::xt::layout_type::row_major, class T >
auto xt::argwhere ( const T & arr)
inline

return vector of indices where arr is not zero

Template Parameters
Lthe traversal order
Parameters
arrinput array
Returns
vector of index_types where arr is not equal to zero (use xt::from_indices to convert)
See also
xt::from_indices

Definition at line 905 of file xoperation.hpp.

◆ in1d() [1/3]

template<class E , class F , class = typename std::enable_if_t<has_iterator_interface<F>::value>>
auto xt::in1d ( E && element,
F && test_elements )
inlinenoexcept

in1d

Returns a boolean array of the same shape as element that is true where an element of element is in test_elements and False otherwise.

Parameters
elementan xexpression
test_elementsan array
Returns
a boolean array

Definition at line 147 of file xset_operation.hpp.

◆ in1d() [2/3]

template<class E , class I , class = typename std::enable_if_t<is_iterator<I>::value>>
auto xt::in1d ( E && element,
I && test_elements_begin,
I && test_elements_end )
inlinenoexcept

in1d

Returns a boolean array of the same shape as element that is true where an element of element is in test_elements and False otherwise.

Parameters
elementan xexpression
test_elements_beginiterator to the beginning of an array
test_elements_enditerator to the end of an array
Returns
a boolean array

Definition at line 166 of file xset_operation.hpp.

◆ in1d() [3/3]

template<class E , class T >
auto xt::in1d ( E && element,
std::initializer_list< T > test_elements )
inlinenoexcept

in1d

Returns a boolean array of the same shape as element that is true where an element of element is in test_elements and False otherwise.

Parameters
elementan xexpression
test_elementsan array
Returns
a boolean array

Definition at line 130 of file xset_operation.hpp.

◆ isin() [1/3]

template<class E , class F , class = typename std::enable_if_t<has_iterator_interface<F>::value>>
auto xt::isin ( E && element,
F && test_elements )
inlinenoexcept

isin

Returns a boolean array of the same shape as element that is true where an element of element is in test_elements and False otherwise.

Parameters
elementan xexpression
test_elementsan array
Returns
a boolean array

Definition at line 91 of file xset_operation.hpp.

◆ isin() [2/3]

template<class E , class I , class = typename std::enable_if_t<is_iterator<I>::value>>
auto xt::isin ( E && element,
I && test_elements_begin,
I && test_elements_end )
inlinenoexcept

isin

Returns a boolean array of the same shape as element that is true where an element of element is in test_elements and False otherwise.

Parameters
elementan xexpression
test_elements_beginiterator to the beginning of an array
test_elements_enditerator to the end of an array
Returns
a boolean array

Definition at line 110 of file xset_operation.hpp.

◆ isin() [3/3]

template<class E , class T >
auto xt::isin ( E && element,
std::initializer_list< T > test_elements )
inlinenoexcept

isin

Returns a boolean array of the same shape as element that is true where an element of element is in test_elements and False otherwise.

Parameters
elementan xexpression
test_elementsan array
Returns
a boolean array

Definition at line 71 of file xset_operation.hpp.

◆ nonzero()

template<class T >
auto xt::nonzero ( const T & arr)
inline

return vector of indices where T is not zero

Parameters
arrinput array
Returns
vector of vectors, one for each dimension of arr, containing the indices of the non-zero elements in that dimension

Definition at line 856 of file xoperation.hpp.

◆ operator!()

template<class E >
auto xt::operator! ( E && e) -> detail::xfunction_type_t<detail::logical_not, E>
inlinenoexcept

Not.

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

Parameters
ean xexpression
Returns
an xfunction

Definition at line 379 of file xoperation.hpp.

◆ operator&&()

template<class E1 , class E2 >
auto xt::operator&& ( E1 && e1,
E2 && e2 ) -> detail::xfunction_type_t<detail::logical_and, E1, E2>
inlinenoexcept

And.

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

Parameters
e1an xexpression or a scalar
e2an xexpression or a scalar
Returns
an xfunction

Definition at line 364 of file xoperation.hpp.

◆ operator||()

template<class E1 , class E2 >
auto xt::operator|| ( E1 && e1,
E2 && e2 ) -> detail::xfunction_type_t<detail::logical_or, E1, E2>
inlinenoexcept

Or.

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

Parameters
e1an xexpression or a scalar
e2an xexpression or a scalar
Returns
an xfunction

Definition at line 348 of file xoperation.hpp.

◆ where() [1/2]

template<class T >
auto xt::where ( const T & condition)
inline

return vector of indices where condition is true (equivalent to nonzero(condition))

Parameters
conditioninput array
Returns
vector of index_types where condition is not equal to zero

Definition at line 889 of file xoperation.hpp.

◆ where() [2/2]

template<class E1 , class E2 , class E3 >
auto xt::where ( E1 && e1,
E2 && e2,
E3 && e3 ) -> detail::xfunction_type_t<detail::conditional_ternary, E1, E2, E3>
inlinenoexcept

Ternary selection.

Returns an xfunction for the element-wise ternary selection (i.e. operator ? :) of e1, e2 and e3.

Parameters
e1a boolean xexpression
e2an xexpression or a scalar
e3an xexpression or a scalar
Returns
an xfunction

Definition at line 777 of file xoperation.hpp.