[SciPy-User] lstsq error under Windows?

bruce.labitt at autoliv.com bruce.labitt at autoliv.com
Tue May 4 16:27:16 EDT 2010


scipy-user-bounces at scipy.org wrote on 05/04/2010 03:48:55 PM:

> I have found an issue with scipy.linalg.lstsq, I think.  The following 
> code works in Ubuntu 10.04 x86-64, but not in WinXP-32.  I think it 
should 
> work in WinXP.  Here is a minimum example:
> 
> """==== program testlstsq.py ======================"""
> from scipy.linalg import eig, lstsq
> from numpy import angle, zeros, pi, arcsin
> 
> A = zeros((4,1), dtype='complex')
> B = zeros((4,1), dtype='complex')
> 
> A[0,0] = -0.535412460549-2.65798938848e-17j
> A[1,0] = -0.369432866546-0.131765700574j
> A[2,0] = -0.222906796932-0.263237285725j
> A[3,0] = -0.069087096386-0.38609560454j
> 
> B[0,0] = -0.369432866546-0.131765700574j
> B[1,0] = -0.222906796932-0.263237285725j
> B[2,0] = -0.069087096386-0.38609560454j
> B[3,0] =  0.0882283631514-0.528093039953j
> 
> try:
>     print 'Got here'
>     phi = lstsq(A,B)
>     print 'Finished lstsq'
> except:
>     print 'Exception Occurred'
> else:
>     for a in range(len(phi)):
>         print 'phi[',a,']=',phi[a]
> 
>     w = -angle( eig(phi[0])[0][:] )
>     d = 0.5
>     aa = arcsin( w / (2.0*pi) )*180./pi     # in degrees
>     print 'aa unsorted =', aa
> """ ==== end of testlstsq.py =========================="""
> 
> If this is run under ipython, or python on Ubuntu, the answer is:
> 
> In [3]: run testlstsq.py
> Got here
> Finished lstsq
> phi[ 0 ]= [[ 0.88271111+0.38811028j]]
> phi[ 1 ]= [-0.04649206-0.01274722j]
> phi[ 2 ]= 1
> phi[ 3 ]= [ 0.84459073]
> aoa unsorted = [-3.780145]
> 
> If testlstsq.py is run under WinXP-32 one gets the following result:
> > python testlstsq.py
> Got here
>  ** On entry to ZGELSS parameter number 12 had an illegal value
> 
> I think that ZGELSS is in LAPACK.  After that, I am in over my head. Can 

> someone help with this?
> 
> Under Windows I am running:
> WinXP-x86-32
> Python(x,y)2.6.2.0 --> Python 2.6.2
> numpy 1.3.0
> scipy 0.7.1
> ipython 0.10
> 
> For Linux, Ubuntu 10.04 x86-64
> Python 2.6.5
> numpy 1.30
> scipy 0.7.0-2
> ipython 0.10-1
> 
> Thanks for any and all help!
> -Bruce
> 
> 

Per Josef's observation that scipy.linalg.lstsq and numpy.lstsq behaved 
the same for him, I tried changing my code to

- from scipy.linalg import eig, lstsq
+ from scipy.linalg import eig
+ from numpy.linalg import lstsq

and reran the code and got -
>pythonw -u "testlstsq.py"
Got here
Finished lstsq
phi[ 0 ]= [[ 0.88271111+0.38811028j]]
phi[ 1 ]= [-0.04649206-0.01274722j]
phi[ 2 ]= 1
phi[ 3 ]= [ 0.84459073]
aoa unsorted = [-3.780145]
>Exit code: 0

So scipy.linalg.lstsq version 0.7.1 under WinXP-32 faults using the CME 
and
numpy.linalg.lstsq version 1.3.0 does not.

It looks like I have an answer for now, and scipy dev's might have a 
mini-testbench to test against.

Thanks for the help!
-Bruce

******************************
Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail.  Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
******************************


More information about the SciPy-User mailing list