[Numpy-discussion] "Segmentation fault (core dumped)" as result of matrix multiplication

Marius Nijhuis mariusnijhuis@gmail....
Tue May 6 07:15:29 CDT 2008


I encountered the error "Segmentation fault (core dumped)" during a rather
standard multiplication, without excessive memory us.  This looks likes a
bug to me?
I am using Python 2.5, Numpy 1.0.4 under Ubuntu 7.10.

Here is what I am doing: i have two arrays, points1 and points2.


The problem only happens if n or m (or both) are 1. The arrays are then
still 2-dimensional. k is usually in the order of 60.

The code:


At the third line, python crashes back to terminal with the text
"Segmentation fault (core dumped)"
Tracing further the error happens at line 106 of numpy/core/defmatrix.py
If I understand correctly, the   __mul__   method of p1Mat calls
N.dot(self, asmatrix(other))
and the problem occurs in    asmatrix(other)  , i.e. before actual
multiplication is done.

To be more precise, at some point the code calls __array_finalize__ twice,
nested, and the error happens on the second return from it.  I am not 100%
sure what is done here, but it looks as if the  asmatrix command I gave
myself is somehow conflicting with the asmatrix command given by __mul__

I have replaced my code with:


and this works fine.

I hope this information is useful to someone?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080506/4ce7118d/attachment.html 

More information about the Numpy-discussion mailing list