Re: [Numpy-discussion] segfault with dot

2007-11-17 Thread Matthieu Brucher
What CPU do you have and which version of numpy did you get and where did
you get it from ?

Matthieu

2007/11/17, Jesus Torrecilla Pinero [EMAIL PROTECTED]:

 I am using Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) under Windows
 XP and converting a program from Numeric to Numpy. If I have two arrays, say
 K and T and do dot(K,T) or K*T everything goes well, but if I have a vector
 b and try dot(K,b) or K*b I get a segfault.

 I have tried to run the test in tes_numeric.py and get the same result.

 I have tried too to convert b in a matrix with two columns, the second one
 being all zeroes, and numpy makes the multiplication correctly, so I think
 the problem is just with vectors

 Does this happens with other versions or do you have any idea to fix this
 problem?

 Thanks in advance

 --
 Jesús Torrecilla Pinero
 Universidad de Extremadura
 jtorrecilla at utcsl.com
 jtorreci at unex.es
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion




-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] SegFault/double free with simple array mask operation

2007-11-17 Thread Achim Gaedke
Achim Gaedke wrote:
 David Cournapeau wrote:
   
 Could you open a ticket on the numpy trac system ? (I can confirm the bug)

 cheers,

 David
   
 
 It is Ticket #614 . The version information in trac are outdated, I 
 could not select version 1.0.3 or 1.0.4 .
   
Here is the solution for Segmentation Fault reported.
It is basicly copied from the function iter_subscript_Bool, which alredy 
does the necessary range checks.

Achim

Index: arrayobject.c
===
--- arrayobject.c   (revision 4464)
+++ arrayobject.c   (working copy)
@@ -9337,6 +9337,11 @@
 return -1;
 }
 index = ind-dimensions[0];
+if (index  self-size) {
+PyErr_SetString(PyExc_ValueError,
+too many boolean indices);
+return -1;
+}
 strides = ind-strides[0];
 dptr = ind-data;
 PyArray_ITER_RESET(self);

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] segfault with dot

2007-11-17 Thread Jesus Torrecilla Pinero
numpy-1.0.4.win32-py2.5 from sourceforge (precompiled binary)
CPU:  AMD Athlon XP 2600+
 2.09 GHz, 1.00 Gb RAM
The error report says:
AppName: pythonw.exe AppVer: 0.0.0.0 ModName: _dotblas.pyd
ModVer: 0.0.0.0 Offset: 0007ecf3


Jesús Torrecilla Pinero
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] segfault with dot

2007-11-17 Thread Matthieu Brucher
2007/11/17, Jesus Torrecilla Pinero [EMAIL PROTECTED]:

 numpy-1.0.4.win32-py2.5 from sourceforge (precompiled binary)
 CPU:  AMD Athlon XP 2600+
  2.09 GHz, 1.00 Gb RAM
 The error report says:
 AppName: pythonw.exe AppVer: 0.0.0.0  ModName: _dotblas.pyd
 ModVer: 0.0.0.0 Offset: 0007ecf3


OK, I think the problem is that you don't have the SSE2 instruction set and
IIRC, this package needs it. David Cournapeau created a package that could
solve your problem, but I don't remember the link, you can brows the archive
for it ;)

Matthieu
-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy : your experiences?

2007-11-17 Thread Stefan van der Walt
On Sat, Nov 17, 2007 at 02:07:34AM -0500, Anne Archibald wrote:
 On 16/11/2007, Rahul Garg [EMAIL PROTECTED] wrote:
 
  It would be awesome if you guys could respond to some of the following
  questions :
  a) Can you guys tell me briefly about the kind of problems you are
  tackling with numpy and scipy?
  b) Have you ever felt that numpy/scipy was slow and had to switch to
  C/C++/Fortran?
  c) Do you use any form of parallel processing? Multicores? SMPs?
  Clusters? If yes how did u utilize them?
 
  If you feel its not relevant to the list .. feel free to email me 
  personally.
  I would be very interested in talking about these issues.
 
 I think it would be interesting and on-topic to hear a few words from
 people to see what they do with numpy.
 
 a) I use python/numpy/scipy to work with astronomical observations of
 pulsars. This includes a range of tasks including: simple scripting to
 manage jobs on our computation cluster; minor calculations (like a
 better scientific calculator, though frink is sometimes better because
 it keeps track of units);

So does 'ipython -p physics':

In [1]: x = 3 m/s^2

In [2]: y = 15 s

In [3]: x*y
Out[3]: 45 m/s

Regards
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [ANN] Release of the first PyTables video

2007-11-17 Thread Steve Lianoglou
Hi,

 =
 Release of the first PyTables video
 =

 `Carabos http://www.carabos.com/`_ is very proud to announce the
 first of a series of videos dedicated to introducing the main features
 of PyTables to the public in a visual and easy to grasp manner.

I just got a chance to watch the video and wanted to thank you for  
putting that together.

I've always been meaning to check out PyTables but haven't had the  
time to figure out how to work it on to potentially replace my hacked- 
together data storage schemes, so these videos are a great help.

Looking forward to your next video!

-steve

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy : your experiences?

2007-11-17 Thread Steve Lianoglou
Hi Rahul,

 a) Can you guys tell me briefly about the kind of problems you are
 tackling with numpy and scipy?

I'm a grad student doing computational biology.  I primarily use the  
NumPy/SciPy/matplotlib triumvirate as a post processing tool to  
analyze what the heck happened after we run some learning algorithms  
we develop (or canned ones, like libsvm (for example)) to look for  
some sense in the results.

I've been working w/ analyzing interaction networks/graphs, so I also  
use NetworkX[1] quite a bit as well (it's also a nice package w/  
responsive authors).

Many of the folks (in my lab, and collaborators) like to use MATLAB,  
so I've found scipy's io.loadmat invaluable for making this a bit more  
seamless.

So, in general, for me (so far) numpy/scipy are generally used to  
integrate various datasets together and see if things look  
kosher (before runs and after runs).

 b) Have you ever felt that numpy/scipy was slow and had to switch to
 C/C++/Fortran?

Yes, for things like boosting, svm, graph mining, etc ... but that's  
no real surprise since their iterative and need to run on large  
datasets.

You should also note that there are python interfaces to these things  
out there as well, but I (thus far) haven't taken much of advantage of  
those and usually pipe out data into the expected text input formats  
and pull them back in when the algo is done.

 c) Do you use any form of parallel processing? Multicores? SMPs?
 Clusters? If yes how did u utilize them?

I'd really like to (not just for Python), but I haven't.

-steve

[1] NetworkX: https://networkx.lanl.gov/wiki

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] bug in numpy.apply_along_axis: numpy.__version__ '1.0.3.1'

2007-11-17 Thread Sean Ross-Ross

Hi, I think I have found a bug in the function apply_along_axis.

recall that the function definition if apply_along_axis(func1d, axis,  
arr, *args)


This bug occurs if func1d returns a python object without a __len__  
attribute and is not a scalar, determined by  
numpy.core.numeric.isscalar.


eg. a self contained example of the bug is:

 from numpy import array, apply_along_axis

 # works
 arr = array( [1,1] )
 apply_along_axis( lambda arr:arr[0], 0, arr )

 # however this raises a type error
 class Foo(object): pass

 arr = array( [ Foo(), Foo() ] )
 apply_along_axis( lambda arr:arr[0], 0, arr )
 
---
exceptions.TypeError Traceback (most  
recent call last)


/sw/lib/python2.4/site-packages/numpy/lib/shape_base.py in  
apply_along_axis(func1d, axis, arr, *args)

   52 holdshape = outshape
   53 outshape = list(arr.shape)
--- 54 outshape[axis] = len(res)
   55 outarr = zeros(outshape,asarray(res).dtype)
   56 outarr[tuple(i.tolist())] = res

TypeError: len() of unsized object


Thanks

~Sean___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Bug in arange dtype f was: Using arr.dtype.type to check byteorder-independed dtype fails for bool

2007-11-17 Thread Stefan van der Walt
On Tue, Nov 13, 2007 at 02:53:32PM +0100, Sebastian Haase wrote:
 On Nov 13, 2007 2:18 PM, Stefan van der Walt [EMAIL PROTECTED] wrote:
  Hi Sebastian
 
  On Tue, Nov 13, 2007 at 01:11:33PM +0100, Sebastian Haase wrote:
   Hi,
   I need to check the array dtype in a way that it is ignoring
   differences coming only from big-endian vs. little-endian.
 
  Does
 
  N.issubdtype(first_dtype, second_dtype)
 
  work?
 Hi  Stéfan,
 
 trying to anwer your question with a quick arange test, I ran into
 more confusion:
  a = N.arange(.5, dtype=f)
  `a.dtype`
 'dtype('float32')'
  a = N.arange(.5, dtype=f)
  `a.dtype`
 'dtype('float32')'
 
 Both equal positively with N.float32 now !
  N.__version__
 '1.0.1'

This should now be fixed in SVN r4465.

Regards
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Should array iterate over a set?

2007-11-17 Thread Michael McNeil Forbes
My expectation was that array would iterate over a set.  This is  
incorrect:

  array(set([1,2,3]))
array(set([1, 2, 3]), dtype=object)

Is this the intended behaviour?  A trivial work-around that does what  
I need is

  array(list(set([1,2,3])))
array([1, 2, 3])

but I was wondering if this was by design or just a forgotten  
corner.  (Maybe a vestige of the tuple special case for record arrays?)

Michael.

P.S. I just found that this was brought up by Ed Schofield on  
2006-05-03, but there were no replies in that thread.

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Should array iterate over a set?

2007-11-17 Thread Robert Kern
Michael McNeil Forbes wrote:
 My expectation was that array would iterate over a set.  This is  
 incorrect:
 
   array(set([1,2,3]))
 array(set([1, 2, 3]), dtype=object)
 
 Is this the intended behaviour?  A trivial work-around that does what  
 I need is
 
   array(list(set([1,2,3])))
 array([1, 2, 3])
 
 but I was wondering if this was by design or just a forgotten  
 corner.  (Maybe a vestige of the tuple special case for record arrays?)

We can recognize most sequences (i.e. for all i in range(len(x)), x[i] responds
correctly), but we cannot easily deal with arbitrary iterables which are not
sequences in the array() function. There are a lot of special cases and
heuristics going on in array() as it is. Instead, we have a fromiter() function
which will take an iterable and construct an array from it. It is limited to 1D
arrays, but this is by far the most common use for constructing an array from an
iterable.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion