title: Understanding scipy's least square function with IRLS
body: <p>I'm having a bit of trouble understanding how this function works.</p>
  
  <pre><code>a, b = scipy.linalg.lstsq(X, w*signal)[0]
  </code></pre>
  
  <p>I know that signal is the array representing the signal and currently <code>w</code> is just <code>[1,1,1,1,1...]</code></p>
  
  <p>How should I manipulate <code>X</code> or <code>w</code> to imitate weighted least squares or iteratively reweighted least squared?</p>