# [SciPy-user] segfault in scipy.optimize.leastsq

Nils Wagner nwagner at iam.uni-stuttgart.de
Thu Aug 3 09:14:20 CDT 2006

```Dr. Hans Georg Krauthaeuser wrote:
> basvandijk at home.nl wrote:
>
>> Hello,
>>
>> When running the following example from http://www.tau.ac.il/~kineret/amit/scipy_tutorial I get an segmentationfault in leastsq:
>>
>> --------------------------
>> from scipy import *
>> from numpy import *
>>
>> x = arange(0,6e-2,6e-2/30)
>> A,k,theta = 10, 1.0/3e-2, pi/6s
>> y_true = A*sin(2*pi*k*x+theta)
>> y_meas = y_true + 2*randn(len(x))
>>
>> def residuals(p, y, x):
>>     A,k,theta = p
>>     err = y-A*sin(2*pi*k*x+theta)
>>     return err
>>
>> def peval(x, p):
>>     return p[0]*sin(2*pi*p[1]*x+p[2])
>>
>> p0 = [8, 1/2.3e-2, pi/3]
>> print array(p0)
>>
>> from scipy.optimize import leastsq
>> plsq = leastsq(residuals, p0, args=(y_meas, x))
>> print plsq[0]
>>
>> print array([A, k, theta])
>> --------------------------
>>
>> Note that C:\Python24\Lib\site-packages\scipy\optimize\tests\test_optimize.py also gives an error.
>>
>> I'm running Python 2.4.3, Scipy 0.5.0 and numpy 1.0b1.
>>
>> What can be the problem?
>>
>> Greetings,
>>
>> Bas van Dijk
>>
> Sounds familar to me. I had a similar problem with older scipy and numpy
> versions. For me it worked after using ATLAS without SSE support. But
> that was an ATHLON and not an Pentium 2.
>
> You can find the old thred here:
>
> Hans Georg
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>

Interesting. There seems to be more SSE related problems. How do I
disable SSE support ?

Nils

```