>>> As others already said, using a Numpy array or an array.array object
>>> would
>>> be more efficient (and even easier - the C code gets a pointer to an
>>> array
>>> of integers, as usual).
>>
>> I looked for this in the C API docs but couldn't find anything on how
>> to make an array.array pyt
En Sun, 28 Dec 2008 01:47:08 -0200, Daniel Fetchinson
escribió:
As others already said, using a Numpy array or an array.array object
would
be more efficient (and even easier - the C code gets a pointer to an
array
of integers, as usual).
I looked for this in the C API docs but couldn't
On Dec 28, 12:45 am, "Daniel Fetchinson"
wrote:
> I'm trying to write an extension module in C which contains a single
> function with the following prototype:
>
> void func( int N, int * arg1, int * arg2, int * ret );
>
> Here arg1 and arg2 are length N arrays, and the function computes ret
> whi
>>> You MUST check EVERY function call for errors!
>>
>> Yes, I know :)
>>
>
> Believe me, if you don't, there is a risk of crashing the program. And
> they're a lot harder to find and fix.
Sure, what I meant by the smiley is just that it was a quick and dirty
example, not real code. In a real cod
>> This is the function I have, the corresponding python function will
>> take two equal length lists of integers and the C function will
>> compute their sum and return the result as a python tuple.
>>
>>
>> static PyObject *func( PyObject * self, PyObject * args )
>> {
>> int j, N;
>> int
En Sun, 28 Dec 2008 00:40:52 -0200, Daniel Fetchinson
escribió:
You MUST check EVERY function call for errors!
Yes, I know :)
Believe me, if you don't, there is a risk of crashing the program. And
they're a lot harder to find and fix.
And check the argument's type (how do you know i
I agree that array.array is more efficient than a list but the input
for my function will come from PIL and PIL returns a list. So I have a
list to begin with which will be passed to the C function.
>>> With recent versions of PIL, numpy can create an array from an Image very
>>> qui
>> This is the function I have, the corresponding python function will
>> take two equal length lists of integers and the C function will
>> compute their sum and return the result as a python tuple.
>>
>>
>> static PyObject *func( PyObject * self, PyObject * args )
>> {
>> int j, N;
>> int
Daniel Fetchinson wrote:
I agree that array.array is more efficient than a list but the input
for my function will come from PIL and PIL returns a list. So I have a
list to begin with which will be passed to the C function.
With recent versions of PIL, numpy can create an array from an Image ver
En Sat, 27 Dec 2008 22:54:52 -0200, Daniel Fetchinson
escribió:
This is the function I have, the corresponding python function will
take two equal length lists of integers and the C function will
compute their sum and return the result as a python tuple.
static PyObject *func( PyObject * se
On 12/27/08, Robert Kern wrote:
> Daniel Fetchinson wrote:
>
>> I agree that array.array is more efficient than a list but the input
>> for my function will come from PIL and PIL returns a list. So I have a
>> list to begin with which will be passed to the C function.
>
> With recent versions of P
On Dec 27, 6:06 pm, Scott David Daniels wrote:
> Daniel Fetchinson wrote:
> > I have a list to begin with which will be passed to the C function.
>
> > I assume converting the list to an array.array and passing that to the C
>
> > function doesn't make any difference in terms of speed since t
>> I agree that array.array is more efficient than a list but the input
>> for my function will come from PIL and PIL returns a list. So I have a
>> list to begin with which will be passed to the C function.
>
> With recent versions of PIL, numpy can create an array from an Image very
> quickly, po
Daniel Fetchinson wrote:
I agree that array.array is more efficient than a list but the input
for my function will come from PIL and PIL returns a list. So I have a
list to begin with which will be passed to the C function.
With recent versions of PIL, numpy can create an array from an Image v
Daniel Fetchinson wrote:
I have a list to begin with which will be passed to the C function.
> I assume converting the list to an array.array and passing that to the C
function doesn't make any difference in terms of speed since the
operation itself will be done in the C function anyway.
>> I have considered using ctypes but for my needs using the C API
>> directly seems more reasonable. array.array and numpy.array doesn't
>> fit my needs since I need to do long and complicated operations on the
>> two (pretty large) integer arrays that would be too slow using
>> array.array and nu
Daniel Fetchinson wrote:
I have considered using ctypes but for my needs using the C API
directly seems more reasonable. array.array and numpy.array doesn't
fit my needs since I need to do long and complicated operations on the
two (pretty large) integer arrays that would be too slow using
array.
>> I'm trying to write an extension module in C which contains a single
>> function with the following prototype:
>> void func( int N, int * arg1, int * arg2, int * ret );
>> Here arg1 and arg2 are length N arrays, and the function computes ret
>> which is also an N length array. From python I'
Daniel Fetchinson wrote:
I'm trying to write an extension module in C which contains a single
function with the following prototype:
void func( int N, int * arg1, int * arg2, int * ret );
Here arg1 and arg2 are length N arrays, and the function computes ret
which is also an N length array. Fr
I'm trying to write an extension module in C which contains a single
function with the following prototype:
void func( int N, int * arg1, int * arg2, int * ret );
Here arg1 and arg2 are length N arrays, and the function computes ret
which is also an N length array. From python I'd like to call th
20 matches
Mail list logo