pythran/pythonic/types/ndarray.hpp
// indexing through an array of indices -- a view
indexing through an array of indices -- a view
indexing through an array of indices -- a view
typename std::enable_if<is_numexpr_arg<F>::value &&
                              !is_array_index<F>::value &&
                              !std::is_same<bool, typename F::dtype>::value,
                          ndarray<T, N>>::type ndarray<T, N>::
  operator[](F const &filter) const
  {
    static_assert(F::value == 1,
                  "advanced indexing only supporint with 1D index");
    array<long, N> shape = this->shape();
    shape[0] = filter.flat_size();
    ndarray<T, N> out(shape, none_type());
    std::transform(
        filter.begin(), filter.end(), out.begin(),
        [this](typename F::dtype index) { return operator[](index); });
    return out;
  }
typename std :: enable_if < is_numexpr_arg < F > :: value && ! is_array_index < F > :: value && ! std :: is_same < bool , typename F :: dtype > :: value , ndarray < T , N > > :: type ndarray < T , N > :: operator [] ( F const & filter ) const { static_assert ( F :: value == 1 , " " ) ; array < long , N > shape = this -> shape ( ) ; shape [ 0 ] = filter . flat_size ( ) ; ndarray < T , N > out ( shape , none_type ( ) ) ; std :: transform ( filter . begin ( ) , filter . end ( ) , out . begin ( ) , [ this ] ( typename F :: dtype index ) { return operator [ ] ( index ) ; } ) ; return out ; }
indexing through an array of indices -- a view
indexing through an array of indices -- a view