[MATH-1051] Fix EigenDecomposition for certain non-symmetric matrices.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1537611 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5bbbe7709f
commit
bda25b4029
|
@ -51,6 +51,10 @@ If the output is not quite correct, check for invisible trailing spaces!
|
||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
<release version="x.y" date="TBD" description="TBD">
|
<release version="x.y" date="TBD" description="TBD">
|
||||||
|
<action dev="tn" type="fix" issue="MATH-1051">
|
||||||
|
"EigenDecomposition" may have failed to compute the decomposition for certain
|
||||||
|
non-symmetric matrices. Port of the respective bugfix in Jama-1.0.3.
|
||||||
|
</action>
|
||||||
<action dev="erans" type="fix" issue="MATH-1047">
|
<action dev="erans" type="fix" issue="MATH-1047">
|
||||||
Check for overflow in methods "pow" (class "o.a.c.m.util.ArithmeticUtils").
|
Check for overflow in methods "pow" (class "o.a.c.m.util.ArithmeticUtils").
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -364,14 +364,12 @@ class SchurTransformer {
|
||||||
q = matrixT[k + 1][k - 1];
|
q = matrixT[k + 1][k - 1];
|
||||||
r = notlast ? matrixT[k + 2][k - 1] : 0.0;
|
r = notlast ? matrixT[k + 2][k - 1] : 0.0;
|
||||||
shift.x = FastMath.abs(p) + FastMath.abs(q) + FastMath.abs(r);
|
shift.x = FastMath.abs(p) + FastMath.abs(q) + FastMath.abs(r);
|
||||||
if (!Precision.equals(shift.x, 0.0, epsilon)) {
|
if (Precision.equals(shift.x, 0.0, epsilon)) {
|
||||||
p = p / shift.x;
|
continue;
|
||||||
q = q / shift.x;
|
|
||||||
r = r / shift.x;
|
|
||||||
}
|
}
|
||||||
}
|
p = p / shift.x;
|
||||||
if (shift.x == 0.0) {
|
q = q / shift.x;
|
||||||
break;
|
r = r / shift.x;
|
||||||
}
|
}
|
||||||
double s = FastMath.sqrt(p * p + q * q + r * r);
|
double s = FastMath.sqrt(p * p + q * q + r * r);
|
||||||
if (p < 0.0) {
|
if (p < 0.0) {
|
||||||
|
|
|
@ -437,6 +437,26 @@ public class EigenDecompositionTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the porting of a bugfix in Jama-1.0.3 (from changelog):
|
||||||
|
*
|
||||||
|
* Patched hqr2 method in Jama.EigenvalueDecomposition to avoid infinite loop;
|
||||||
|
* Thanks Frederic Devernay <frederic.devernay@m4x.org>
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMath1051() {
|
||||||
|
double[][] data = {
|
||||||
|
{0,0,0,0,0},
|
||||||
|
{0,0,0,0,1},
|
||||||
|
{0,0,0,1,0},
|
||||||
|
{1,1,0,0,1},
|
||||||
|
{1,0,1,0,1}
|
||||||
|
};
|
||||||
|
|
||||||
|
RealMatrix m = MatrixUtils.createRealMatrix(data);
|
||||||
|
checkUnsymmetricMatrix(m);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void testNormalDistributionUnsymmetricMatrix() {
|
public void testNormalDistributionUnsymmetricMatrix() {
|
||||||
|
|
Loading…
Reference in New Issue