[pythran] Re: ndarray

  • From: serge Guelton <sguelton@xxxxxxxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx
  • Date: Fri, 29 Aug 2014 14:57:56 +0200

On Fri, Aug 29, 2014 at 08:38:11AM -0400, Neal Becker wrote:
> I noticed pythran using ndarray c++ class, and wondered if it was similar to
> https://github.com/ndarray/ndarray
> which I have been making heavy use of for my python c++ needs.
> It seems not.


> https://github.com/ndarray/ndarray uses 3 template parameters
> <T,N,M>
> where T is type
> N is #dim
> M is #contiguous dimensions
> which allows optimization based on contiguity.  Would pythran be able to
> optimize based on contiguousness?  For example:
> #export sum(int[])
> def sum (x):
> would pythran be able to detect whether the argument is contiguous and 
> dispatch
> accordingly?

I am not sure of what you mean by contiguous dimensions.

In Pythran an ndarray always wraps a flat pointer. When taking slices,
it does not create an intermediate array, but a view that stores the
slices/strides and so on.

I am unsure my answer is clear...

BTW, what's your background / what are you using Pythran for?

Other related posts: