[
https://issues.apache.org/jira/browse/MATH-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770474#action_12770474
]
Bruce A Johnson commented on MATH-297:
--------------------------------------
Thanks.
The problem seems to be a divide by zero error with the variable diP1 in the
following code, but this is probably as far as I'll get in debugging it:
{noformat}
private void stationaryQuotientDifferenceWithShift(final double[] d, final
double[] l,
final double lambda) {
final int nM1 = d.length - 1;
double si = -lambda;
for (int i = 0, sixI = 0; i < nM1; ++i, sixI += 6) {
final double di = d[i];
final double li = l[i];
final double diP1 = di + si;
final double liP1 = li * di / diP1;
work[sixI] = si;
work[sixI + 1] = diP1;
work[sixI + 2] = liP1;
si = li * liP1 * si - lambda;
}
work[6 * nM1 + 1] = d[nM1] + si;
work[6 * nM1] = si;
}
{noformat}
> Eigenvector computation incorrectly returning vectors of NaNs
> -------------------------------------------------------------
>
> Key: MATH-297
> URL: https://issues.apache.org/jira/browse/MATH-297
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Phil Steitz
> Fix For: 2.1
>
>
> As reported by Axel Kramer on commons-dev, the following test case succeeds,
> but should fail:
> {code}
> public void testEigenDecomposition() {
> double[][] m = { { 0.0, 1.0, -1.0 }, { 1.0, 1.0, 0.0 }, { -1.0,0.0, 1.0 }
> };
> RealMatrix rm = new Array2DRowRealMatrix(m);
> assertEquals(rm.toString(),
> "Array2DRowRealMatrix{{0.0,1.0,-1.0},{1.0,1.0,0.0},{-1.0,0.0,1.0}}");
> EigenDecompositionImpl ed = new EigenDecompositionImpl(rm,
> MathUtils.SAFE_MIN);
> RealVector rv0 = ed.getEigenvector(0);
> assertEquals(rv0.toString(), "{(NaN); (NaN); (NaN)}");
> }
> {code}
> ed.getRealEigenvalues() returns the correct eigenvalues (2, 1, -1), but all
> three eigenvectors contain only NaNs.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.