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