Buffer types only allowed as function local variables

Showing 1-3 of 3 messages
Buffer types only allowed as function local variables Rekveld 12/28/09 9:49 AM
Hi,

I was getting 'Buffer types only allowed as function local variables'
errors when I tried to declare my array in the class, rather than in
the method.
I found this question and reply for the same problem:
<http://codespeak.net/pipermail/cython-dev/2009-April/005214.html>

but the last workaround that was mentioned I do not understand well
enough.

Is there sombody who can write the cython code that would do the
following so that I can understand it ?
I think I understand what it means, but I don't know how to do it in
Cython.

(start quote)

 I'm afraid the only solution right now is
to store it as numpy.ndarray and access the data field (i.e.
self.data.data), casted to numpy.float_t*. You must then make sure
you
work with a contiguous array:

     if not data.flags['C_CONTIGUOUS']:
         data = data.copy()
     self.data = data

(end quote)

how do I cast self.data.data to soemthing and how do I use it as I
would use an array ?

any insights welcome,

Joost.

Re: Buffer types only allowed as function local variables M. Yurko 1/15/10 2:46 PM
Hello All,

I would like to second Rekveld's request. I've run into the same issue
and can't wuite understand what Dag was trying to say for his
workaround suggestion.

Thanks,
Mike

Buffer types only allowed as function local variables Michael Yurko 1/20/10 5:25 PM
I've figured out what Dag meant in his original post. I've attached a quick example in case anyone else is having the same issue.

--
Mike Yurko