Index related functions
Defined in xtensor/xoperation.hpp
-
template<class T>
inline auto xt::where(const T &condition) return vector of indices where condition is true (equivalent to nonzero(condition))
- Parameters:
condition – input array
- Returns:
vector of index_types where condition is not equal to zero
-
template<class T>
inline auto xt::nonzero(const T &arr) return vector of indices where T is not zero
- Parameters:
arr – input array
- Returns:
vector of vectors, one for each dimension of arr, containing the indices of the non-zero elements in that dimension
-
template<layout_type L = ::xt::layout_type::row_major, class T>
inline auto xt::argwhere(const T &arr) return vector of indices where arr is not zero
See also
- Template Parameters:
L – the traversal order
- Parameters:
arr – input array
- Returns:
vector of index_types where arr is not equal to zero (use
xt::from_indices
to convert)
-
template<class T>
inline auto xt::from_indices(const std::vector<T> &idx) Converts
std::vector<index_type>
(returned e.g.from
xt::argwhere
) toxtensor
.- Parameters:
idx – vector of indices
- Returns:
xt::xtensor<typename index_type::value_type, 2>
(e.g.xt::xtensor<size_t, 2>
)