You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Luc Maisonobe (JIRA)" <ji...@apache.org> on 2009/10/25 23:26:59 UTC
[jira] Created: (MATH-308) ArrayIndexOutOfBoundException in
EigenDecompositionImpl
ArrayIndexOutOfBoundException in EigenDecompositionImpl
-------------------------------------------------------
Key: MATH-308
URL: https://issues.apache.org/jira/browse/MATH-308
Project: Commons Math
Issue Type: Bug
Affects Versions: 2.0
Environment: linux
Reporter: Luc Maisonobe
Assignee: Luc Maisonobe
The following test triggers an ArrayIndexOutOfBoundException:
{code:java}
public void testMath308() {
double[] mainTridiagonal = {
22.330154644539597, 46.65485522478641, 17.393672330044705, 54.46687435351116, 80.17800767709437
};
double[] secondaryTridiagonal = {
13.04450406501361, -5.977590941539671, 2.9040909856707517, 7.1570352792841225
};
// the reference values have been computed using routine DSTEMR
// from the fortran library LAPACK version 3.2.1
double[] refEigenValues = {
14.138204224043099, 18.847969733754262, 52.536278520113882, 53.456697699894512, 82.044413207204002
};
RealVector[] refEigenVectors = {
new ArrayRealVector(new double[] { 0.584677060845929, -0.367177264979103, -0.721453187784497, 0.052971054621812, -0.005740715188257 }),
new ArrayRealVector(new double[] { 0.713933751051495, -0.190582113553930, 0.671410443368332, -0.056056055955050, 0.006541576993581 }),
new ArrayRealVector(new double[] { 0.222368839324646, 0.514921891363332, -0.021377019336614, 0.801196801016305, -0.207446991247740 }),
new ArrayRealVector(new double[] { 0.314647769490148, 0.750806415553905, -0.167700312025760, -0.537092972407375, 0.143854968127780 }),
new ArrayRealVector(new double[] { -0.000462690386766, -0.002118073109055, 0.011530080757413, 0.252322434584915, 0.967572088232592 })
};
// the following line triggers the exception
EigenDecomposition decomposition =
new EigenDecompositionImpl(mainTridiagonal, secondaryTridiagonal, MathUtils.SAFE_MIN);
double[] eigenValues = decomposition.getRealEigenvalues();
for (int i = 0; i < refEigenValues.length; ++i) {
assertEquals(refEigenValues[i], eigenValues[i], 1.0e-6);
if (refEigenVectors[i].dotProduct(decomposition.getEigenvector(i)) < 0) {
assertEquals(0, refEigenVectors[i].add(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
} else {
assertEquals(0, refEigenVectors[i].subtract(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
}
}
}
{code}
Running the previous method as a Junit test triggers the exception when the EigenDecompositionImpl instance is built. The first few lines of the stack trace are:
{noformat}
java.lang.ArrayIndexOutOfBoundsException: -1
at org.apache.commons.math.linear.EigenDecompositionImpl.computeShiftIncrement(EigenDecompositionImpl.java:1545)
at org.apache.commons.math.linear.EigenDecompositionImpl.goodStep(EigenDecompositionImpl.java:1072)
at org.apache.commons.math.linear.EigenDecompositionImpl.processGeneralBlock(EigenDecompositionImpl.java:894)
at org.apache.commons.math.linear.EigenDecompositionImpl.findEigenvalues(EigenDecompositionImpl.java:658)
at org.apache.commons.math.linear.EigenDecompositionImpl.decompose(EigenDecompositionImpl.java:246)
at org.apache.commons.math.linear.EigenDecompositionImpl.<init>(EigenDecompositionImpl.java:205)
at org.apache.commons.math.linear.EigenDecompositionImplTest.testMath308(EigenDecompositionImplTest.java:136)
{noformat}
I'm currently investigating this bug. It is not a simple index translation error between the original fortran (Lapack) and commons-math implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MATH-308) ArrayIndexOutOfBoundException in
EigenDecompositionImpl
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-308?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz updated MATH-308:
-----------------------------
Fix Version/s: 2.1
> ArrayIndexOutOfBoundException in EigenDecompositionImpl
> -------------------------------------------------------
>
> Key: MATH-308
> URL: https://issues.apache.org/jira/browse/MATH-308
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: linux
> Reporter: Luc Maisonobe
> Assignee: Luc Maisonobe
> Fix For: 2.1
>
>
> The following test triggers an ArrayIndexOutOfBoundException:
> {code:java}
> public void testMath308() {
> double[] mainTridiagonal = {
> 22.330154644539597, 46.65485522478641, 17.393672330044705, 54.46687435351116, 80.17800767709437
> };
> double[] secondaryTridiagonal = {
> 13.04450406501361, -5.977590941539671, 2.9040909856707517, 7.1570352792841225
> };
> // the reference values have been computed using routine DSTEMR
> // from the fortran library LAPACK version 3.2.1
> double[] refEigenValues = {
> 14.138204224043099, 18.847969733754262, 52.536278520113882, 53.456697699894512, 82.044413207204002
> };
> RealVector[] refEigenVectors = {
> new ArrayRealVector(new double[] { 0.584677060845929, -0.367177264979103, -0.721453187784497, 0.052971054621812, -0.005740715188257 }),
> new ArrayRealVector(new double[] { 0.713933751051495, -0.190582113553930, 0.671410443368332, -0.056056055955050, 0.006541576993581 }),
> new ArrayRealVector(new double[] { 0.222368839324646, 0.514921891363332, -0.021377019336614, 0.801196801016305, -0.207446991247740 }),
> new ArrayRealVector(new double[] { 0.314647769490148, 0.750806415553905, -0.167700312025760, -0.537092972407375, 0.143854968127780 }),
> new ArrayRealVector(new double[] { -0.000462690386766, -0.002118073109055, 0.011530080757413, 0.252322434584915, 0.967572088232592 })
> };
> // the following line triggers the exception
> EigenDecomposition decomposition =
> new EigenDecompositionImpl(mainTridiagonal, secondaryTridiagonal, MathUtils.SAFE_MIN);
> double[] eigenValues = decomposition.getRealEigenvalues();
> for (int i = 0; i < refEigenValues.length; ++i) {
> assertEquals(refEigenValues[i], eigenValues[i], 1.0e-6);
> if (refEigenVectors[i].dotProduct(decomposition.getEigenvector(i)) < 0) {
> assertEquals(0, refEigenVectors[i].add(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
> } else {
> assertEquals(0, refEigenVectors[i].subtract(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
> }
> }
> }
> {code}
> Running the previous method as a Junit test triggers the exception when the EigenDecompositionImpl instance is built. The first few lines of the stack trace are:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: -1
> at org.apache.commons.math.linear.EigenDecompositionImpl.computeShiftIncrement(EigenDecompositionImpl.java:1545)
> at org.apache.commons.math.linear.EigenDecompositionImpl.goodStep(EigenDecompositionImpl.java:1072)
> at org.apache.commons.math.linear.EigenDecompositionImpl.processGeneralBlock(EigenDecompositionImpl.java:894)
> at org.apache.commons.math.linear.EigenDecompositionImpl.findEigenvalues(EigenDecompositionImpl.java:658)
> at org.apache.commons.math.linear.EigenDecompositionImpl.decompose(EigenDecompositionImpl.java:246)
> at org.apache.commons.math.linear.EigenDecompositionImpl.<init>(EigenDecompositionImpl.java:205)
> at org.apache.commons.math.linear.EigenDecompositionImplTest.testMath308(EigenDecompositionImplTest.java:136)
> {noformat}
> I'm currently investigating this bug. It is not a simple index translation error between the original fortran (Lapack) and commons-math implementation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (MATH-308) ArrayIndexOutOfBoundException in
EigenDecompositionImpl
Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-308?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luc Maisonobe resolved MATH-308.
--------------------------------
Resolution: Fixed
fixed in subversion repository as of r832577
Many thanks to Dimitri who debugged this with a careful step by step comparison between the original lapack fortran and our translation in Java.
> ArrayIndexOutOfBoundException in EigenDecompositionImpl
> -------------------------------------------------------
>
> Key: MATH-308
> URL: https://issues.apache.org/jira/browse/MATH-308
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: linux
> Reporter: Luc Maisonobe
> Assignee: Luc Maisonobe
>
> The following test triggers an ArrayIndexOutOfBoundException:
> {code:java}
> public void testMath308() {
> double[] mainTridiagonal = {
> 22.330154644539597, 46.65485522478641, 17.393672330044705, 54.46687435351116, 80.17800767709437
> };
> double[] secondaryTridiagonal = {
> 13.04450406501361, -5.977590941539671, 2.9040909856707517, 7.1570352792841225
> };
> // the reference values have been computed using routine DSTEMR
> // from the fortran library LAPACK version 3.2.1
> double[] refEigenValues = {
> 14.138204224043099, 18.847969733754262, 52.536278520113882, 53.456697699894512, 82.044413207204002
> };
> RealVector[] refEigenVectors = {
> new ArrayRealVector(new double[] { 0.584677060845929, -0.367177264979103, -0.721453187784497, 0.052971054621812, -0.005740715188257 }),
> new ArrayRealVector(new double[] { 0.713933751051495, -0.190582113553930, 0.671410443368332, -0.056056055955050, 0.006541576993581 }),
> new ArrayRealVector(new double[] { 0.222368839324646, 0.514921891363332, -0.021377019336614, 0.801196801016305, -0.207446991247740 }),
> new ArrayRealVector(new double[] { 0.314647769490148, 0.750806415553905, -0.167700312025760, -0.537092972407375, 0.143854968127780 }),
> new ArrayRealVector(new double[] { -0.000462690386766, -0.002118073109055, 0.011530080757413, 0.252322434584915, 0.967572088232592 })
> };
> // the following line triggers the exception
> EigenDecomposition decomposition =
> new EigenDecompositionImpl(mainTridiagonal, secondaryTridiagonal, MathUtils.SAFE_MIN);
> double[] eigenValues = decomposition.getRealEigenvalues();
> for (int i = 0; i < refEigenValues.length; ++i) {
> assertEquals(refEigenValues[i], eigenValues[i], 1.0e-6);
> if (refEigenVectors[i].dotProduct(decomposition.getEigenvector(i)) < 0) {
> assertEquals(0, refEigenVectors[i].add(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
> } else {
> assertEquals(0, refEigenVectors[i].subtract(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
> }
> }
> }
> {code}
> Running the previous method as a Junit test triggers the exception when the EigenDecompositionImpl instance is built. The first few lines of the stack trace are:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: -1
> at org.apache.commons.math.linear.EigenDecompositionImpl.computeShiftIncrement(EigenDecompositionImpl.java:1545)
> at org.apache.commons.math.linear.EigenDecompositionImpl.goodStep(EigenDecompositionImpl.java:1072)
> at org.apache.commons.math.linear.EigenDecompositionImpl.processGeneralBlock(EigenDecompositionImpl.java:894)
> at org.apache.commons.math.linear.EigenDecompositionImpl.findEigenvalues(EigenDecompositionImpl.java:658)
> at org.apache.commons.math.linear.EigenDecompositionImpl.decompose(EigenDecompositionImpl.java:246)
> at org.apache.commons.math.linear.EigenDecompositionImpl.<init>(EigenDecompositionImpl.java:205)
> at org.apache.commons.math.linear.EigenDecompositionImplTest.testMath308(EigenDecompositionImplTest.java:136)
> {noformat}
> I'm currently investigating this bug. It is not a simple index translation error between the original fortran (Lapack) and commons-math implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (MATH-308) ArrayIndexOutOfBoundException in
EigenDecompositionImpl
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-308?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz closed MATH-308.
----------------------------
> ArrayIndexOutOfBoundException in EigenDecompositionImpl
> -------------------------------------------------------
>
> Key: MATH-308
> URL: https://issues.apache.org/jira/browse/MATH-308
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: linux
> Reporter: Luc Maisonobe
> Assignee: Luc Maisonobe
> Fix For: 2.1
>
>
> The following test triggers an ArrayIndexOutOfBoundException:
> {code:java}
> public void testMath308() {
> double[] mainTridiagonal = {
> 22.330154644539597, 46.65485522478641, 17.393672330044705, 54.46687435351116, 80.17800767709437
> };
> double[] secondaryTridiagonal = {
> 13.04450406501361, -5.977590941539671, 2.9040909856707517, 7.1570352792841225
> };
> // the reference values have been computed using routine DSTEMR
> // from the fortran library LAPACK version 3.2.1
> double[] refEigenValues = {
> 14.138204224043099, 18.847969733754262, 52.536278520113882, 53.456697699894512, 82.044413207204002
> };
> RealVector[] refEigenVectors = {
> new ArrayRealVector(new double[] { 0.584677060845929, -0.367177264979103, -0.721453187784497, 0.052971054621812, -0.005740715188257 }),
> new ArrayRealVector(new double[] { 0.713933751051495, -0.190582113553930, 0.671410443368332, -0.056056055955050, 0.006541576993581 }),
> new ArrayRealVector(new double[] { 0.222368839324646, 0.514921891363332, -0.021377019336614, 0.801196801016305, -0.207446991247740 }),
> new ArrayRealVector(new double[] { 0.314647769490148, 0.750806415553905, -0.167700312025760, -0.537092972407375, 0.143854968127780 }),
> new ArrayRealVector(new double[] { -0.000462690386766, -0.002118073109055, 0.011530080757413, 0.252322434584915, 0.967572088232592 })
> };
> // the following line triggers the exception
> EigenDecomposition decomposition =
> new EigenDecompositionImpl(mainTridiagonal, secondaryTridiagonal, MathUtils.SAFE_MIN);
> double[] eigenValues = decomposition.getRealEigenvalues();
> for (int i = 0; i < refEigenValues.length; ++i) {
> assertEquals(refEigenValues[i], eigenValues[i], 1.0e-6);
> if (refEigenVectors[i].dotProduct(decomposition.getEigenvector(i)) < 0) {
> assertEquals(0, refEigenVectors[i].add(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
> } else {
> assertEquals(0, refEigenVectors[i].subtract(decomposition.getEigenvector(i)).getNorm(), 1.0e-6);
> }
> }
> }
> {code}
> Running the previous method as a Junit test triggers the exception when the EigenDecompositionImpl instance is built. The first few lines of the stack trace are:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: -1
> at org.apache.commons.math.linear.EigenDecompositionImpl.computeShiftIncrement(EigenDecompositionImpl.java:1545)
> at org.apache.commons.math.linear.EigenDecompositionImpl.goodStep(EigenDecompositionImpl.java:1072)
> at org.apache.commons.math.linear.EigenDecompositionImpl.processGeneralBlock(EigenDecompositionImpl.java:894)
> at org.apache.commons.math.linear.EigenDecompositionImpl.findEigenvalues(EigenDecompositionImpl.java:658)
> at org.apache.commons.math.linear.EigenDecompositionImpl.decompose(EigenDecompositionImpl.java:246)
> at org.apache.commons.math.linear.EigenDecompositionImpl.<init>(EigenDecompositionImpl.java:205)
> at org.apache.commons.math.linear.EigenDecompositionImplTest.testMath308(EigenDecompositionImplTest.java:136)
> {noformat}
> I'm currently investigating this bug. It is not a simple index translation error between the original fortran (Lapack) and commons-math implementation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira