commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Ireson <>
Subject [math] QRDecomposition on singular values
Date Wed, 12 Nov 2014 12:05:49 GMT
Hi all,

I am way out of my comfort zone here, but hit and issue when using QRDecomposition and hacked
a solution which I believe is valid “improvement” but would like to have more knowledgeable

In the current implementation of QRDecomposition if the matrix is singular (determined by
the isNonSingular method returning false) then the solve method will throw a SingularMatrixException.

However as far as I can ascertain it is legitimate to solve the matrix by replacing the calculations
involving the diagonal which would result in a large number (or Infinity if the diagonal is
zero) with zero if the diagonal < threshold.

According to <>
"When matrix a is singular, it will not have a solution, but replacing 1/wi with 0 will provide
the closest x that minimizes [the linear equation |ax -y|]”

Anyway I hacked the code along these lines so that i could get a solution to my problem and
wondered if this was a better solution than the current approach.

Rather than getting the solve method to throw the SingularMatrixException, the user can check
if the matrix is singular and determine if they still wish to proceed.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message