title: Why does interp1d throw LinAlgError("SVD did not converge")?
body: <p>I have a sequence of 2 dimensional points (so: (x,y) coordinates) and I want to fit a cubic spline through it. So I split the sequence in two sequences <code>xs</code>, <code>ys</code> with the following properties:</p>
  
  <ul>
  <li><code>len(xs) = len(ys) &gt; 4</code></li>
  <li><code>xs</code> is strictly increasing</li>
  </ul>
  
  <p>So there should be a cubic spline through those points. But I still get an error:</p>
  
  <pre><code>#!/usr/bin/env python
  
  import numpy
  import scipy
  from scipy.interpolate import interp1d
  import sys
  
  print("Python: %s" % sys.version)
  print("numpy: %s" % numpy.__version__)
  print("scipy: %s " % scipy.__version__)
  print("numpy config:")
  numpy.show_config()
  
  xs = [0, 31, 39, 48, 58, 75, 91, 108, 127, 141, 158, 175, 194, 208, 224, 241, 258, 291, 310, 343, 379, 427, 444, 459, 493, 526, 560, 580, 626, 659, 693, 726, 759, 793, 826, 859, 893, 926, 958, 993, 1025, 1059, 1093, 1125, 1159, 1193, 1224, 1257, 1278, 1310, 1343, 1379, 1410, 1443, 1478, 1512, 1558, 1662, 1815, 1823, 1831, 1845, 1860, 1876]
  ys = [0.7072243346007605, 0.6996197718631179, 0.6844106463878327, 0.6730038022813688, 0.6577946768060836, 0.6159695817490495, 0.5665399239543726, 0.5019011406844106, 0.43346007604562736, 0.3840304182509506, 0.3041825095057034, 0.2623574144486692, 0.23574144486692014, 0.20532319391634982, 0.155893536121673, 0.11406844106463879, 0.07984790874524715, 0.026615969581749048, 0.0076045627376425855, 0.0, 0.0, 0.0038022813688212928, 0.022813688212927757, 0.053231939163498096, 0.12927756653992395, 0.17870722433460076, 0.22433460076045628, 0.24334600760456274, 0.30798479087452474, 0.33840304182509506, 0.376425855513308, 0.3840304182509506, 0.376425855513308, 0.3574144486692015, 0.3041825095057034, 0.2509505703422053, 0.21292775665399238, 0.1520912547528517, 0.12167300380228137, 0.09885931558935361, 0.09125475285171103, 0.09125475285171103, 0.11787072243346007, 0.1596958174904943, 0.20152091254752852, 0.24714828897338403, 0.28517110266159695, 0.3155893536121673, 0.33840304182509506, 0.3688212927756654, 0.39543726235741444, 0.44106463878326996, 0.4828897338403042, 0.5057034220532319, 0.5247148288973384, 0.5285171102661597, 0.532319391634981, 0.5361216730038023, 0.5475285171102662, 0.5627376425855514, 0.5779467680608364, 0.5893536121673004, 0.6007604562737643, 0.6083650190114068]
  
  print("xs length: %i" % len(xs))
  print("ys length: %i" % len(ys))
  
  print("Is xs strictly increasing? %r" % all(x &lt; y for x, y in zip(xs, xs[1:])))
  
  xs = numpy.array(xs)
  fx = interp1d(xs, ys, kind='cubic')
  </code></pre>
  
  <p>with the output:</p>
  
  <pre><code>./test.py             
  Python: 2.7.5+ (default, Feb 27 2014, 19:37:08) 
  [GCC 4.8.1]
  numpy: 1.8.1
  scipy: 0.14.0 
  numpy config:
  lapack_info:
    NOT AVAILABLE
  lapack_opt_info:
    NOT AVAILABLE
  blas_info:
    NOT AVAILABLE
  atlas_threads_info:
    NOT AVAILABLE
  blas_src_info:
    NOT AVAILABLE
  atlas_blas_info:
    NOT AVAILABLE
  lapack_src_info:
    NOT AVAILABLE
  openblas_info:
    NOT AVAILABLE
  atlas_blas_threads_info:
    NOT AVAILABLE
  blas_mkl_info:
    NOT AVAILABLE
  blas_opt_info:
    NOT AVAILABLE
  atlas_info:
    NOT AVAILABLE
  lapack_mkl_info:
    NOT AVAILABLE
  mkl_info:
    NOT AVAILABLE
  xs length: 64
  ys length: 64
  Is xs strictly increasing? True
  Traceback (most recent call last):
    File "./test.py", line 23, in &lt;module&gt;
      fx = interp1d(xs, ys, kind='cubic')
    File "/usr/local/lib/python2.7/dist-packages/scipy/interpolate/interpolate.py", line 412, in __init__
      self._spline = splmake(x, y, order=order)
    File "/usr/local/lib/python2.7/dist-packages/scipy/interpolate/interpolate.py", line 2110, in splmake
      coefs = func(xk, yk, order, conds, B)
    File "/usr/local/lib/python2.7/dist-packages/scipy/interpolate/interpolate.py", line 1800, in _find_smoothest
      u, s, vh = np.dual.svd(B)
    File "/usr/local/lib/python2.7/dist-packages/scipy/linalg/decomp_svd.py", line 103, in svd
      raise LinAlgError("SVD did not converge")
  numpy.linalg.linalg.LinAlgError: SVD did not converge
  </code></pre>
  
  <p>The question is: Why does <code>interp1d</code> throw <code>LinAlgError(“SVD did not converge”)</code> and how can I fix it?</p>
  
  <h2>My system</h2>
  
  <p>I have <code>numpy</code> version 1.8.1, <code>scipy</code> version <code>0.14.0</code>, <code>Python 2.7.5+</code> on a Linux Mint 16 Petra.</p>