xtensor Logo
latest

INSTALLATION

  • Installation
  • Changelog

USAGE

  • Getting started
  • Expressions and lazy evaluation
  • Arrays and tensors
  • Scalars and 0-D expressions
  • Adapting 1-D containers
  • Operators and functions
  • Views
  • Indices
  • Expression builders
  • Missing values
  • Histogram
  • Random
  • Tensor Rank
  • File input and output
  • Build and configuration
  • Common pitfalls

QUICK REFERENCE

  • Basics
  • Builders
  • Operators
  • Mathematical functions
  • Reductions
  • Views
  • Iterators
  • Manipulation
  • Chunked arrays

API REFERENCE

  • Expressions and semantic
  • Containers and views
  • Iterators
  • Functions and generators
  • IO Operations
  • Mathematical functions
    • Operators and related functions
    • Index related functions
    • Basic functions
    • Exponential functions
    • Power functions
    • Trigonometric functions
    • Hyperbolic functions
    • Error and gamma functions
    • Nearest integer floating point operations
    • Classification functions
    • Reducing functions
    • Accumulating functions
    • NaN functions
  • xshape

DEVELOPER ZONE

  • Compiler workarounds
  • Build and configuration
  • Internals of xtensor
  • Extending xtensor
  • Releasing xtensor

MISCELLANEOUS

  • From NumPy to xtensor
  • Notable differences with numpy
  • Closure semantics
  • Related projects
  • Designing language bindings with xtensor
xtensor
  • Mathematical functions
  • Index related functions
  • Edit on GitHub

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

xt::from_indices

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) to xtensor.

Parameters

idx – vector of indices

Returns

xt::xtensor<typename index_type::value_type, 2> (e.g. xt::xtensor<size_t, 2>)

Previous Next

© Copyright 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht. Revision 545dd7aa.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
Versions
latest
stable
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds