commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1166674 - in /commons/proper/math/trunk/src/main: java/org/apache/commons/math/exception/util/ java/org/apache/commons/math/linear/ resources/META-INF/localization/
Date Thu, 08 Sep 2011 13:13:17 GMT
Author: erans
Date: Thu Sep  8 13:13:16 2011
New Revision: 1166674

URL: http://svn.apache.org/viewvc?rev=1166674&view=rev
Log:
More detailed message for "NonPositiveDefiniteMatrixException".

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteMatrixException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RectangularCholeskyDecompositionImpl.java
    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java?rev=1166674&r1=1166673&r2=1166674&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
Thu Sep  8 13:13:16 2011
@@ -186,7 +186,7 @@ public enum LocalizedFormats implements 
     BETA("beta"), /* keep */
     NOT_POSITIVE_COLUMNDIMENSION("invalid column dimension: {0} (must be positive)"),
     NOT_POSITIVE_DEFINITE_MATRIX("not positive definite matrix"),
-    NON_POSITIVE_DEFINITE_MATRIX("not positive definite matrix: diagonal element at ({0},{0})
is smaller than {1}"), /* keep */
+    NON_POSITIVE_DEFINITE_MATRIX("not positive definite matrix: diagonal element at ({1},{1})
is smaller than {2} ({0})"), /* keep */
     NON_POSITIVE_DEFINITE_LINEAR_OPERATOR("non positive definite linear operator"), /* keep
*/
     NON_SELF_ADJOINT_LINEAR_OPERATOR("non self-adjoint linear operator"), /* keep */
     NON_SQUARE_LINEAR_OPERATOR("non square ({0}x{1}) linear operator"), /* keep */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java?rev=1166674&r1=1166673&r2=1166674&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
Thu Sep  8 13:13:16 2011
@@ -126,7 +126,7 @@ public class CholeskyDecompositionImpl i
 
             // check diagonal element
             if (ltI[i] < absolutePositivityThreshold) {
-                throw new NonPositiveDefiniteMatrixException(i, absolutePositivityThreshold);
+                throw new NonPositiveDefiniteMatrixException(ltI[i], i, absolutePositivityThreshold);
             }
 
             ltI[i] = FastMath.sqrt(ltI[i]);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteMatrixException.java?rev=1166674&r1=1166673&r2=1166674&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteMatrixException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteMatrixException.java
Thu Sep  8 13:13:16 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalNumberException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
@@ -25,7 +25,7 @@ import org.apache.commons.math.exception
  * @since 3.0
  * @version $Id$
  */
-public class NonPositiveDefiniteMatrixException extends MathIllegalArgumentException {
+public class NonPositiveDefiniteMatrixException extends MathIllegalNumberException {
     /** Serializable version Id. */
     private static final long serialVersionUID = 1641613838113738061L;
     /** Index (diagonal element). */
@@ -36,12 +36,14 @@ public class NonPositiveDefiniteMatrixEx
     /**
      * Construct an exception.
      *
+     * @param wrong Value that fails the positivity check.
      * @param index Row (and column) index.
      * @param threshold Absolute positivity threshold.
      */
-    public NonPositiveDefiniteMatrixException(int index,
+    public NonPositiveDefiniteMatrixException(double wrong,
+                                              int index,
                                               double threshold) {
-        super(LocalizedFormats.NON_POSITIVE_DEFINITE_MATRIX, index, threshold);
+        super(LocalizedFormats.NON_POSITIVE_DEFINITE_MATRIX, wrong, index, threshold);
         this.index = index;
         this.threshold = threshold;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RectangularCholeskyDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RectangularCholeskyDecompositionImpl.java?rev=1166674&r1=1166673&r2=1166674&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RectangularCholeskyDecompositionImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RectangularCholeskyDecompositionImpl.java
Thu Sep  8 13:13:16 2011
@@ -87,7 +87,7 @@ public class RectangularCholeskyDecompos
             if (c[ir][ir] < small) {
 
                 if (r == 0) {
-                    throw new NonPositiveDefiniteMatrixException(ir, small);
+                    throw new NonPositiveDefiniteMatrixException(c[ir][ir], ir, small);
                 }
 
                 // check remaining diagonal elements
@@ -95,7 +95,7 @@ public class RectangularCholeskyDecompos
                     if (c[index[i]][index[i]] < -small) {
                         // there is at least one sufficiently negative diagonal element,
                         // the symmetric positive semidefinite matrix is wrong
-                        throw new NonPositiveDefiniteMatrixException(i, small);
+                        throw new NonPositiveDefiniteMatrixException(c[index[i]][index[i]],
i, small);
                     }
                 }
 

Modified: commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties?rev=1166674&r1=1166673&r2=1166674&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
(original)
+++ commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
Thu Sep  8 13:13:16 2011
@@ -156,7 +156,7 @@ ALPHA = alpha
 BETA = beta
 NOT_POSITIVE_COLUMNDIMENSION = nombre de colonnes invalide : {0} (doit \u00eatre positif)
 NOT_POSITIVE_DEFINITE_MATRIX = matrice non d\u00e9finie positive
-NON_POSITIVE_DEFINITE_MATRIX = matrice non d\u00e9finie positive: l''\u00e9l\u00e9ment diagonal
({0},{0}) est sup\u00e9rieur \u0061 {1}
+NON_POSITIVE_DEFINITE_MATRIX = matrice non d\u00e9finie positive: l''\u00e9l\u00e9ment diagonal
({1},{1}) est inf\u00e9rieur \u0061 {2} ({0})
 NON_SELF_ADJOINT_LINEAR_OPERATOR = : |x'' A y - y'' A x| > {0} quand x est {1} et y est
{2}
 NON_POSITIVE_DEFINITE_LINEAR_OPERATOR = op\u00e9rateur lin\u00e9aire non d\u00e9fini positif
 NON_SELF_ADJOINT_LINEAR_OPERATOR = op\u00e9rateur lin\u00e9aire non auto-adjoint



Mime
View raw message