jscience
  1. jscience
  2. JSCIENCE-56

Matrix.pseudoInverse() gives wrong results

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: Version 6.0
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      56

      Description

      Hi,

      the method pseudoInverse() in the abstact class Matrix (and therefore also in
      the class DenseMatrix) is incorrect. Cosider the following example:

      DenseMatrix<Rational> mat,result;
      mat=DenseMatrix.valueOf(
      new Rational[][] {{Rational.ONE,Rational.ZERO},
      {Rational.ZERO,Rational.ZERO}}
      );
      result=DenseMatrix.valueOf(mat.pseudoInverse());

      The correct result in this example should the matrix itself.
      But the method throw a ArithmeticException: Dividend is zero

      The reason is, that in pseudoInverse() you call
      thisTranspose.times(this)).inverse()
      but the matrix isn't invertible.

      Suggestion:
      see http://en.wikipedia.org/wiki/Pseudoinverse
      "Finding the pseudoinverse of a matrix"
      Maybe you could generalize the class LUDecomposition, so that it works for
      rectangular matrices, to get the matrices B and C described in the wikipedia page.

      Best regards
      J.Lorenz

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            dautelle
            Reporter:
            lorenzj
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: