Author: luc
Date: Thu Dec  4 07:41:57 2008
New Revision: 723359

URL: http://svn.apache.org/viewvc?rev=723359&view=rev
Log:
improved error messages

Modified:
    
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
    
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java

Modified: 
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=723359&r1=723358&r2=723359&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
 (original)
+++ 
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
 Thu Dec  4 07:41:57 2008
@@ -174,8 +174,6 @@
     // org.apache.commons.math.linear.EigenDecompositionImpl
     { "cannot solve degree {0} equation",
       "impossible de r\u00e9soudre une \u00e9quation de degr\u00e9 {0}" },
-    { "negative element on decomposed tridiagonal of {0}x{1} matrix",
-      "\u00e9l\u00e9ment n\u00e9gatif dans la d\u00e9composition tri-diagonale 
d''une matrice {0}x{1}" },
 
     // org.apache.commons.math.linear.NonSquareMatrixException
     { "a {0}x{1} matrix was provided instead of a square matrix",
@@ -209,6 +207,12 @@
       "tableau des indices de lignes s\u00e9lectionn\u00e9es vide" },
     { "empty selected column index array",
       "tableau des indices de colonnes s\u00e9lectionn\u00e9es vide" },
+    { "{0}x{1} and {2}x{3} matrices are not multiplication compatible",
+      "les dimensions {0}x{1} et {2}x{3} sont incompatibles pour la 
multiplication matricielle" },
+    { "{0}x{1} and {2}x{3} matrices are not addition compatible",
+      "les dimensions {0}x{1} et {2}x{3} sont incompatibles pour l'addition 
matricielle" },
+    { "{0}x{1} and {2}x{3} matrices are not subtraction compatible",
+      "les dimensions {0}x{1} et {2}x{3} sont incompatibles pour la 
soustraction matricielle" },
 
    // org.apache.commons.math.random.EmpiricalDistributionImpl
    // org.apache.commons.math.random.ValueServer

Modified: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java?rev=723359&r1=723358&r2=723359&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
 (original)
+++ 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
 Thu Dec  4 07:41:57 2008
@@ -174,7 +174,12 @@
             final int rowCount    = getRowDimension();
             final int columnCount = getColumnDimension();
             if (columnCount != m.getColumnDimension() || rowCount != 
m.getRowDimension()) {
-                throw new IllegalArgumentException("matrix dimension 
mismatch");
+                throw 
MathRuntimeException.createIllegalArgumentException("{0}x{1} and {2}x{3} 
matrices are not" +
+                                                                          " 
addition compatible",
+                                                                          new 
Object[] {
+                                                                              
getRowDimension(), getColumnDimension(),
+                                                                              
m.getRowDimension(), m.getColumnDimension()
+                                                                          });
             }
             final double[][] outData = new double[rowCount][columnCount];
             for (int row = 0; row < rowCount; row++) {
@@ -199,7 +204,12 @@
         final int rowCount    = getRowDimension();
         final int columnCount = getColumnDimension();
         if (columnCount != m.getColumnDimension() || rowCount != 
m.getRowDimension()) {
-            throw new IllegalArgumentException("matrix dimension mismatch");
+            throw MathRuntimeException.createIllegalArgumentException("{0}x{1} 
and {2}x{3} matrices are not" +
+                                                                      " 
addition compatible",
+                                                                      new 
Object[] {
+                                                                          
getRowDimension(), getColumnDimension(),
+                                                                          
m.getRowDimension(), m.getColumnDimension()
+                                                                      });
         }
         final double[][] outData = new double[rowCount][columnCount];
         for (int row = 0; row < rowCount; row++) {
@@ -221,7 +231,12 @@
             final int rowCount    = getRowDimension();
             final int columnCount = getColumnDimension();
             if (columnCount != m.getColumnDimension() || rowCount != 
m.getRowDimension()) {
-                throw new IllegalArgumentException("matrix dimension 
mismatch");
+                throw 
MathRuntimeException.createIllegalArgumentException("{0}x{1} and {2}x{3} 
matrices are not" +
+                                                                          " 
subtraction compatible",
+                                                                          new 
Object[] {
+                                                                              
getRowDimension(), getColumnDimension(),
+                                                                              
m.getRowDimension(), m.getColumnDimension()
+                                                                          });
             }
             final double[][] outData = new double[rowCount][columnCount];
             for (int row = 0; row < rowCount; row++) {
@@ -246,7 +261,12 @@
         final int rowCount    = getRowDimension();
         final int columnCount = getColumnDimension();
         if (columnCount != m.getColumnDimension() || rowCount != 
m.getRowDimension()) {
-            throw new IllegalArgumentException("matrix dimension mismatch");
+            throw MathRuntimeException.createIllegalArgumentException("{0}x{1} 
and {2}x{3} matrices are not" +
+                                                                      " 
subtraction compatible",
+                                                                      new 
Object[] {
+                                                                          
getRowDimension(), getColumnDimension(),
+                                                                          
m.getRowDimension(), m.getColumnDimension()
+                                                                      });
         }
         final double[][] outData = new double[rowCount][columnCount];
         for (int row = 0; row < rowCount; row++) {
@@ -296,7 +316,12 @@
             return multiply((RealMatrixImpl) m);
         } catch (ClassCastException cce) {
             if (this.getColumnDimension() != m.getRowDimension()) {
-                throw new IllegalArgumentException("Matrices are not 
multiplication compatible.");
+                throw 
MathRuntimeException.createIllegalArgumentException("{0}x{1} and {2}x{3} 
matrices are not" +
+                                                                          " 
multiplication compatible",
+                                                                          new 
Object[] {
+                                                                              
getRowDimension(), getColumnDimension(),
+                                                                              
m.getRowDimension(), m.getColumnDimension()
+                                                                          });
             }
             final int nRows = this.getRowDimension();
             final int nCols = m.getColumnDimension();
@@ -326,7 +351,12 @@
      */
     public RealMatrixImpl multiply(RealMatrixImpl m) throws 
IllegalArgumentException {
         if (this.getColumnDimension() != m.getRowDimension()) {
-            throw new IllegalArgumentException("Matrices are not 
multiplication compatible.");
+            throw MathRuntimeException.createIllegalArgumentException("{0}x{1} 
and {2}x{3} matrices are not" +
+                                                                      " 
multiplication compatible",
+                                                                      new 
Object[] {
+                                                                          
getRowDimension(), getColumnDimension(),
+                                                                          
m.getRowDimension(), m.getColumnDimension()
+                                                                      });
         }
         final int nRows = this.getRowDimension();
         final int nCols = m.getColumnDimension();


Reply via email to