Re: [Numpy-discussion] Optimization suggestion sought

2010-12-26 Thread Justin Peel
On Sun, Dec 26, 2010 at 7:34 AM, wrote: > On Sun, Dec 26, 2010 at 3:51 AM, Enzo Michelangeli wrote: >> For a pivoted algorithm, I have to perform an operation that in fully >> vectorized form can be expressed as: >> >>    pivot = tableau[locat,:]/tableau[locat,cand] >>    tableau -= tableau[:,ca

Re: [Numpy-discussion] How to call import_array() properly?

2010-12-26 Thread Bruce Sherwood
I made a mistake: the Mac behaves the same way when I repeat the experiment. I guess I simply have to define init_numpy() to be of type int for Python 3 on both machines. Nevertheless, if you see a more elegant coding, I'd be interested. Thanks. Bruce Sherwood On Sun, Dec 26, 2010 at 3:26 PM, Bru

[Numpy-discussion] How to call import_array() properly?

2010-12-26 Thread Bruce Sherwood
In my Python code I have import cvisual cvisual.init_numpy() and in my C++ code I have void init_numpy() { import_array(); } import_array() in numpy/core/include/numpy/_multiarray_api.h is a macro: #if PY_VERSION_HEX >= 0x0300 #define NUMPY_IMPORT_ARRAY_RETVAL NULL #else #define NUMPY_

Re: [Numpy-discussion] Optimization suggestion sought

2010-12-26 Thread josef . pktd
On Sun, Dec 26, 2010 at 3:51 AM, Enzo Michelangeli wrote: > For a pivoted algorithm, I have to perform an operation that in fully > vectorized form can be expressed as: > >    pivot = tableau[locat,:]/tableau[locat,cand] >    tableau -= tableau[:,cand:cand+1]*pivot >    tableau[locat,:] = pivot >

[Numpy-discussion] Optimization suggestion sought

2010-12-26 Thread Enzo Michelangeli
For a pivoted algorithm, I have to perform an operation that in fully vectorized form can be expressed as: pivot = tableau[locat,:]/tableau[locat,cand] tableau -= tableau[:,cand:cand+1]*pivot tableau[locat,:] = pivot tableau is a rather large bidimensional array, and I'd like to avoid