[pythran] Re: ndarray

  • From: serge Guelton <sguelton@xxxxxxxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx
  • Date: Sun, 31 Aug 2014 07:58:25 +0200

On Sat, Aug 30, 2014 at 08:25:38PM -0700, Mehdi Amini wrote:
> Hi,
> 
> I'm unsure how we can produce efficient code for a function that would accept
> both a dense array and a strided one. It means that it should either be
> expressed in the interface (pythran export ....), or disallowed.
> 
> Mehdi

Yo all,

I think that when we register a specialization for an ndarray, we should
automatically register a version for each possible slicing. For instance
foo(int[][]) now generates:

void foo(ndarray<long,2> const&);

but it should also generate something like

void foo(numpy_gexpr<ndarray<long,2>, slice, slice> const&);
void foo(numpy_gexpr<ndarray<long,2>, contiguous_slice, slice> const&);
void foo(numpy_gexpr<ndarray<long,2>, slice, contiguous_slice> const&);
void foo(numpy_gexpr<ndarray<long,2>, contiguous_slice, contiguous_slice> 
const&);


some meta-programming fun on the way :-)

Other related posts: