[pythran] Re: ndarray

  • From: Pierrick Brunet <pierrick.brunet@xxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx
  • Date: Sun, 31 Aug 2014 13:54:37 +0200

The problem with you syntax is that you can't have : continuous dim => non continuous dim => continuous dim. For this reason, I prefer serge syntax which will require nothing from user point of view (except more compilation time).


For information, "ndarray<long,2>, contiguous_slice, slice" is auto generated, user syntax is still "long[][]"

On 31/08/2014 13:34, Neal Becker wrote:
perhaps export could add some syntax to indicate #contiguous dimensions?

Rather than
ndarray<long,2>, contiguous_slice, slice

I do like the other ndarray syntax of <type, #dim, #contiguous dim>


On Sun, Aug 31, 2014 at 1:58 AM, serge Guelton <sguelton@xxxxxxxxxxxxx <mailto:sguelton@xxxxxxxxxxxxx>> wrote:

    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 :-)




--
/Those who don't understand recursion are doomed to repeat it/

Other related posts: