title: Function which returns the least-squares solution to a linear matrix equation
body: <p>I have been trying to rewrite the code from Python to Swift but I'm stuck on the function which should return the least-squares solution to a linear matrix equation. Does anyone know a library written in Swift which has an equivalent method to the <strong><a href="http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.linalg.lstsq.html" rel="nofollow noreferrer"><code>numpy.linalg.lstsq</code></a></strong>? I'd be grateful for your help.</p>
  
  <p>Python code:</p>
  
  <pre><code>a = numpy.array([[p2.x-p1.x,p2.y-p1.y],[p4.x-p3.x,p4.y-p3.y],[p4.x-p2.x,p4.y-p2.y],[p3.x-p1.x,p3.y-p1.y]])
  b = numpy.array([number1,number2,number3,number4])
  res = numpy.linalg.lstsq(a,b) 
  result = [float(res[0][0]),float(res[0][1])]
  return result
  </code></pre>
  
  <p>Swift code so far:</p>
  
  <pre><code>var matrix1 = [[p2.x-p1.x, p2.y-p1.y],[p4.x-p3.x, p4.y-p3.y], [p4.x-p2.x, p4.y-p2.y], [p3.x-p1.x, p3.y-p1.y]]
  var matrix2 = [number1, number2, number3, number4]
  </code></pre>