You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indexing a 2D array with slices seems to work; indexing with integers seems to work; but indexing one dimension with a slice and the other dimension with an integer calls Jack.
MRE:
$ cat expt1.py
import numpy as np
#pythran export foo(float[:, :], slice, int)
def foo(x, sl, i):
assert i < x.shape[0]
assert i < x.shape[1]
return x[sl, i].copy()
$ pythran --version
0.17.0
$ pythran expt1.py -UNDEBUG
/tmp/tmp6a99679s.cpp: In instantiation of 'struct {anonymous}::__pythran_expt1::foo::type<{anonymous}::pythonic::types::ndarray<double, {anonymous}::pythonic::types::pshape<long int, long int> >, {anonymous}::pythonic::types::slice, long int>':
/tmp/tmp6a99679s.cpp:74:135: required from here
/tmp/tmp6a99679s.cpp:50:49: error: no match for 'operator[]' (operand types are '{anonymous}::pythonic::types::ndarray<double, {anonymous}::pythonic::types::pshape<long int, long int> >' and 'std::tuple<{anonymous}::pythonic::types::slice, long int>')
50 | typedef decltype(std::declval<__type3>()[std::declval<__type8>()]) __type9;
| ~~~~~~~~~~~~~~~~~~~~~~~^
In file included from /home/br/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/pythran/pythonic/types/ndarray.hpp:4,
from /home/br/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/pythran/pythonic/types/tuple.hpp:8,
from /home/br/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/pythran/pythonic/builtins/bool_.hpp:6,
from /home/br/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/pythran/pythonic/types/NoneType.hpp:6,
from /home/br/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/pythran/pythonic/types/slice.hpp:5,
from /home/br/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/pythran/pythonic/core.hpp:47,
from /tmp/tmp6a99679s.cpp:1:
/home/br/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/pythran/pythonic/include/types/ndarray.hpp:433:5: note: candidate: 'template<class S> typename std::enable_if<{anonymous}::pythonic::types::is_slice<Sp>::value, {anonymous}::pythonic::types::numpy_gexpr<const {anonymous}::pythonic::types::ndarray<T, pS>&, typename {anonymous}::pythonic::types::normalized<Sp>::type> >::type {anonymous}::pythonic::types::ndarray<T, pS>::operator[](const S&) const & [with T = double; pS = {anonymous}::pythonic::types::pshape<long int, long int>]'
433 | operator[](S const &s) const &;
| ^~~~~~~~
... snip ...
/tmp/tmp6a99679s.cpp:58:82: note: template argument deduction/substitution failed:
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics
WARNING Compilation error, trying hard to find its origin...
Compilation error, trying hard to find its origin...
WARNING Nope, I'm going to flood you with C++ errors!
Nope, I'm going to flood you with C++ errors!
CRITICAL Cover me Jack. Jack? Jaaaaack!!!!
E: error: command '/home/br/miniforge3/envs/scipy-dev/bin/x86_64-conda-linux-gnu-c++' failed with exit code 1
The text was updated successfully, but these errors were encountered:
Yeah I think we still don't support that - I'll have a look though. Meanwhile you can use explicit loop, that's less pleasant to the eye but performance why, it'll probably be even better (sadly)
Indexing a 2D array with slices seems to work; indexing with integers seems to work; but indexing one dimension with a slice and the other dimension with an integer calls Jack.
MRE:
The text was updated successfully, but these errors were encountered: