[Numpy-discussion] Pointers to arrays in C

2008-06-03 Thread Jose Martin
Hi, I read a file with array data (one per line), and send the arrays to a module in C. In the C module, I need to store pointers to the arrays, so I don't have to make a copy for each array it receives from python. I found that if I reuse the same variable name to create the array, the

[Numpy-discussion] object-arrays and isnan

2008-06-03 Thread ahalda
Hi I'm trying to make a python class to be used in object arrays (specifically, an mpfr type for multiprecision). Numpy lets me create member functions like 'cos' which get called elemenwise when I call cos(a) on an object array a. However, this doesn't work for some functions, like isnan.

Re: [Numpy-discussion] Pointers to arrays in C

2008-06-03 Thread Lisandro Dalcin
I believe in your current setup there is no better way. But you should seriously consider changing the way of using array data. Storing bare pointers in the C side and not holding a reference to the object providing the data in the C side is really error prone. On 6/3/08, Jose Martin [EMAIL

Re: [Numpy-discussion] Pointers to arrays in C

2008-06-03 Thread Christopher Barker
Lisandro Dalcin wrote: I believe in your current setup there is no better way. But you should seriously consider changing the way of using array data. Storing bare pointers in the C side and not holding a reference to the object providing the data in the C side is really error prone. exactly.

Re: [Numpy-discussion] Installation info

2008-06-03 Thread Robert Kern
On Tue, Jun 3, 2008 at 3:21 AM, Hanni Ali [EMAIL PROTECTED] wrote: Hi David, I compiled numpy with MSVC 9.0 (vs 2008), I am just using the inbuilt LA libs to minimise complexity. Although I have hacked it such that I can compile and all but one of the regression tests passed:

Re: [Numpy-discussion] Pointers to arrays in C

2008-06-03 Thread Jose Martin
Thanks for the fast responses! data. Storing bare pointers in the C side and not holding a reference to the object providing the data in the C side is really error prone. It's true, I don't do it because I have to process a large number of arrays, and each has thousands of elements; so I

[Numpy-discussion] linked variables?

2008-06-03 Thread Payton Gardner
Its probably something simple I don't understand but... I've written a dummy function which takes an array m. I'd like it to return a changed array m_i, and not change the initial array m. I call it with mm = dummy(m); 3 from numpy import *; 4 def dummy(m): 5 m_o =

Re: [Numpy-discussion] linked variables?

2008-06-03 Thread Matthieu Brucher
Hi, m is a variable. m_o refers to m. m_i refers to m_o which is m. dummy refers to m. dummy2 and dummy3 refer to m_o which is m. So when you modify m_i, you are modifying the variable refered by m_i, m and also m_o, dummy, dummy2 and dummy3. It's always the same object, with different names.

Re: [Numpy-discussion] linked variables?

2008-06-03 Thread Robert Kern
On Tue, Jun 3, 2008 at 4:19 PM, Payton Gardner [EMAIL PROTECTED] wrote: Its probably something simple I don't understand but... I've written a dummy function which takes an array m. I'd like it to return a changed array m_i, and not change the initial array m. I call it with mm = dummy(m);

[Numpy-discussion] 1.1.0 OSX Installer Fails Under 10.5.3?

2008-06-03 Thread J. Stark
I have just tried to run the 1.1.0 OSX installer on a MacBookAir running 10.5.3 and the installer fails with You cannot install numpy 1.1.0 on this volume. numpy requires System Python 2.5 to install. The system python version reports as jaroslav$ python Python 2.5.1 (r251:54863, Apr 15 2008,

Re: [Numpy-discussion] linked variables?

2008-06-03 Thread Pierre GM
Payton, In your example, use m_o = m.copy() or m_o = m + 0 or m_o = numpy.array(m, copy=True) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] 1.1.0 OSX Installer Fails Under 10.5.3?

2008-06-03 Thread Tommy Grav
Where is your python located I have installed numpy 1.1.0 using the binary installer successfully on 10.5.3 but I am using ActiveState python. I think the problem might be that the installer looks in /Library/Frameworks/Python.framework/ for python, while the standard python is located somewhere

Re: [Numpy-discussion] linked variables?

2008-06-03 Thread Anne Archibald
2008/6/3 Robert Kern [EMAIL PROTECTED]: Python does not copy data when you assign something to a new variable. Python simply points the new name to the same object. If you modify the object using the new name, all of the other names pointing to that object will see the changes. If you want a

Re: [Numpy-discussion] Installation info

2008-06-03 Thread David Cournapeau
Robert Kern wrote: The presence of these functions should have been detected by the configuration process of numpy. HAVE_FREXPF and HAVE_LDEXPF would have been #define'd if we had detected them correctly. It is possible that our configuration process for this does not work correctly with VS

Re: [Numpy-discussion] Installation info

2008-06-03 Thread Robert Kern
On Tue, Jun 3, 2008 at 9:49 PM, David Cournapeau [EMAIL PROTECTED] wrote: Robert Kern wrote: The presence of these functions should have been detected by the configuration process of numpy. HAVE_FREXPF and HAVE_LDEXPF would have been #define'd if we had detected them correctly. It is possible

Re: [Numpy-discussion] Installation info

2008-06-03 Thread Charles R Harris
On Tue, Jun 3, 2008 at 8:49 PM, David Cournapeau [EMAIL PROTECTED] wrote: Robert Kern wrote: The presence of these functions should have been detected by the configuration process of numpy. HAVE_FREXPF and HAVE_LDEXPF would have been #define'd if we had detected them correctly. It is

Re: [Numpy-discussion] 1.1.0 OSX Installer Fails Under 10.5.3?

2008-06-03 Thread Christopher Burns
Jaroslav, The installer works with the MacPython from python.org, not Apple's python (the one that ships with Leopard). The MacPython is installed in the /Library/Frameworks... It should work if your python is here: cburns$ python -c import sys; print sys.prefix

[Numpy-discussion] How does Boolean indexing work?

2008-06-03 Thread Anne Archibald
Hi, I thought it might be useful to summarize the different ways to use numpy's indexing, slice and fancy. The document so far is here: http://www.scipy.org/Cookbook/Indexing While writing it I ran into some puzzling issues. The first of them is, how is Boolean indexing supposed to work when

Re: [Numpy-discussion] NumpyTest problem

2008-06-03 Thread Christopher Burns
Pierre, I believe if you rename your TimingTests they'll work. Nose looks for functions starting with test, and runs those. So your 'utility' functions like testta, testtb... should not begin with test, but the function calling them, timingTest, should. Probably want to use more meaningful

[Numpy-discussion] get range of numpy type

2008-06-03 Thread Christopher Burns
Is there a way to get the range of a numpy type? I'd like to clamp a parameter to be within the range of a numpy type, np.uint8, np.uint32... Something like: if x max_value_of(np.uint8): x = max_value_of(np.uint8) -- Christopher Burns Computational Infrastructure for Research Labs 10