title: Computer Inverse Matrix of non-square matrix in CUDA
body: <p>I am trying to find Moore–Penrose pseudoinverse of a non-square matrix in CUDA.</p>
  
  <p>Today, I am using following code as an implementation of Moore-Penrose pseudoinverse. </p>
  
  <p><a href="https://github.com/mathnet/mathnet-numerics/blob/75c3b9fbbfd3fa2def6780179006bde7ca343b08/src/Numerics/LinearAlgebra/Complex/Matrix.cs" rel="nofollow noreferrer">https://github.com/mathnet/mathnet-numerics/blob/75c3b9fbbfd3fa2def6780179006bde7ca343b08/src/Numerics/LinearAlgebra/Complex/Matrix.cs</a>   </p>
  
  <p><strong>The problem is that the non-square matrix size I am trying to find pseudoinverse is rather big so I would like to solve it in using CUDA to harness the power of GPU.</strong> </p>
  
  <p>I am basically looking for CUDA version of this code </p>
  
  <pre><code>public static Matrix PseudoInverse(this Matrix M)
      {
          Svd&lt;double&gt; D = M.Svd(true);
          Matrix W = (Matrix)D.W;
          Vector s = (Vector)D.S;
  
  
          // The first element of W has the maximum value.
          double tolerance = Precision.EpsilonOf(2) * Math.Max(M.RowCount, M.ColumnCount) * W[0, 0];
  
          for (int i = 0; i &lt; s.Count; i++)
          {
              if (s[i] &lt; tolerance)
                  s[i] = 0;
              else
                  s[i] = 1 / s[i];
          }
          W.SetDiagonal(s);
  
          // (U * W * VT)T is equivalent with V * WT * UT
          return (Matrix)(D.U * W * D.VT).Transpose();
  
      }
  </code></pre>
  
  <ul>
  <li><strong>Does anybody has any pointers on Moore–Penrose pseudoinverse implementation in CUDA.</strong></li>
  </ul>
  
  <p>Any help will be greatly appreciated. </p>
  
  <p>P.S. I would like to know what other ways might be there to solve Moore–Penrose pseudoinverse of a non-square matrix using GPU that's deployable. </p>