[NumPy-Tickets] [NumPy] #2232: numpy.linalg.lstsq segfault

NumPy Trac numpy-tickets@scipy....
Thu Oct 18 14:50:36 CDT 2012


#2232: numpy.linalg.lstsq segfault
------------------------+---------------------------------------------------
 Reporter:  doompie     |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  1.6.2      
 Keywords:              |  
------------------------+---------------------------------------------------
 I'm using iteratively reweighted least squares to fit a logistic response.
 My inputs are a numpy.array([float]), a numpy.matrix([float]), and an
 integer N.

 I use numpy.linalg.lstsq to generate an initial guess, and then I need to
 convert it to a matrix. With some extra printing I have:

 def newton(response,predictors,N):
   print(response.shape)
   print(predictors.shape)
   print("Guessing beta!")
   beta = numpy.linalg.lstsq(predictors,response)[0]
   print("beta guessed, converting to matrix")
   beta = numpy.matrix(beta)
   print("converted. transposing")
   beta = beta.T
   print("beta guessed")
   ...

 the output from a run is:
 (7676,)
 (32, 7676)
 Guessing beta!
 segfault

 or sometimes

 (7676,)
 (32, 7676)
 Guessing beta!

 *** glibc detected *** python3: double free or corruption (!prev):
 0x000000000e62d440 ***
 ======= Backtrace: =========
 /lib64/libc.so.6[0x3f9227230f]
 /lib64/libc.so.6(cfree+0x4b)[0x3f9227276b]
 /home/unix/doompie/lib/python/lib/python3.2/site-
 packages/numpy/core/multiarray.cpython-32m.so[0x2b7ffc6e3cca]
 python3[0x4fa46a]

 (etc)

 This happens with a very particular set of data. For instance, there are a
 number of prior regressions that work fine:

 (7676,)
 (21, 7676)
 Guessing beta!
 beta guessed, converting to matrix
 converted. transposing
 beta guessed


 (7664,)
 (25, 7664)
 Guessing beta!
 beta guessed, converting to matrix
 converted. transposing
 beta guessed

 That being the case, I've attached the nasty data as gzipped tab-delimited
 files.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2232>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list