On Mon, Mar 30, 2009 at 1:45 PM, Tiago Pereira <[email protected]> wrote:

>
> I see. And it seems that float* is also more flexible for n-d arrays.

Yes. That's maybe the strongest argument for float*, actually.

> But, another dumb C question, if you have an array as float*, can you
> use it (in C) as array[i][j] or you need to refer to it as array[i+ncols*j]?

Yes. Just create the corresponding array to get the address:

float **m;
... allocate m for nrows pointers...

for i in range(nrows):
    m[i] = array + i * ncols

cheers,

David
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to