[Numpy-discussion] c-api return two arrays

2011-07-29 Thread Yoshi Rokuko
hey, i have an algorithm that computes two matrices like that: A(i,k) = (x(i,k) + y(i,k))/norm B(i,k) = (x(i,k) - y(i,k))/norm it would be convenient to have the method like that: A, B = mod.meth(C, prob=.95) is ith possible to return two arrays? best regards

Re: [Numpy-discussion] c-api return two arrays

2011-07-29 Thread Yoshi Rokuko
+ Peter ---+ On Fri, Jul 29, 2011 at 9:52 AM, Yoshi Rokuko yo...@rokuko.net wrote: hey, i have an algorithm that computes two matrices like that: A(i,k) = (x(i,k) + y(i,k))/norm B(i,k) = (x(i,k) - y(i,k))/norm it would

Re: [Numpy-discussion] c-api return two arrays

2011-07-29 Thread Yoshi Rokuko
+-- Pauli Virtanen ---+ Fri, 29 Jul 2011 10:52:12 +0200, Yoshi Rokuko wrote: [clip] A, B = mod.meth(C, prob=.95) is it possible to return two arrays? The way to do this in Python is to build a tuple with Py_BuildValue(OO, A, B) and return

Re: [Numpy-discussion] New arrays in 1.6 not always C-contiguous

2011-07-07 Thread Yoshi Rokuko
thank you for pointing that out! so how do you change your numpy related c code now, would you like to share? best regards, yoshi ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] New arrays in 1.6 not always C-contiguous

2011-07-07 Thread Yoshi Rokuko
+ Mark Wiebe ---+ One way to deal with this is to use PyArray_FromAny with the NPY_C_CONTIGUOUS flag to ensure you have a C-aligned array. If you need to write to the array, you should also use the NPY_UPDATEIFCOPY flag. Here's how

Re: [Numpy-discussion] numpy c api general array handling

2011-06-09 Thread Yoshi Rokuko
+ Mark Wiebe ---+ I believe what you may want is PyArray_ContiguousFromAny instead of PyArray_ContiguousFromObject. are you sure that there is a difference? i think its just the new name for the same thing right? best regards, yoshi

[Numpy-discussion] numpy c api general array handling

2011-06-08 Thread Yoshi Rokuko
hey, i'm writing my first python module in c using numpy/arrayobject.h and i have some problems with different platforms (both linux but really different setup) so i suspect my array handling is not cor- rect. i'm used to c arrays and want to access large numpy arrays from within my c module