[pythran] Re: ndarray

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

On Fri, Aug 29, 2014 at 09:07:54AM -0400, Neal Becker wrote:
> If an array is dense, indexing optimizations can be applied.  It is not
> necessary to refer to the strides.

indeed.

> For example if we want to apply the ufunc 'sqr' to each element of an array, 
> if
> we know it is dense (contiguous, not strided), then we can in c++ use simple
> iteration:
> 
> for (; ...; ;):
>   *out++ = sqr (*in++);
> 
> and avoid indexing calculations.
> 
> Also, for dense arrays, we can use simd.

Pythran has the concept of contiguous_slice and supports all these
optimizations.

> But if the argument is not dense (contiguous), e.g., x[::2], then we do need 
> to
> take the strides into account, and IIRC simd can't be used.

yes.

> My interest is communications and digital signal processing.

Great! Do not hesitate to send us faulty codes / optimization bogus,
we'll do our best :-)

Other related posts: