Dag,

Thanks for the clarifications.  I think this would be a really great
addition.  I often find myself needing fast-than-numpy arrays and this
seems like it would open the door to make that easier.  Also, being
able to freely move between the different types of arrays (numpy, pil,
pointers, etc.) would be great.

One more question?  At times I have used SLT vector template in Cython
and it works really well of you want a fast dynamically sized array
type.  Do you think it would be possible to have cython arrays be
interchangible with these as well?  I don't see why it wouldn't work
through the c++ "ponter" member that vector has.  That would be a
killer feature.

Cheers,

Brian



>> * What will this make possible that is currently not possible?
>
> 1) Efficient slices
>
> 2) Leave the road open for memory bus friendlier arithmetic (re: Hoyt
> Koepke's project proposal)
>
> 3) Automatic contiguous copies in/out if a function is coded to work on
> contiguous memory
>
> Why can't this be done currently?
>
>  * Cython contains no in-compiler support for NumPy, and so cannot know
> how to create new underlying ndarray objects.
>
>  * All optimizations need to hard-code semantics at compile-time. With
> single-element indexing it seemed fair to assume the usual semantics of
> zero-based indexing etc., but with slices tings get worse (which kind of
> object is returned) and with arithmetic downright impossible (what does *
> do again?)
>
> That's not to say there's not other options:
> 1) We could hard-code support for NumPy only, and only allow ndarray and
> not subclasses thereof.
>
> 2) We could invent some new protocol/syntax for defining compile-time
> semantics for all relevant operations.
>
>> * What will this make easier that is currently really difficult?
>
> Well, nothing is really difficult. But passing, say, a PIL image into C
> code and back again for processing (with, say, a contiguous C array) isn't
> completely straightforward, but would be with this proposal.
>
> Dag Sverre
>
>
>
>
> _______________________________________________
> Cython-dev mailing list
> Cython-dev@codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to