diff --git a/src/java/org/apache/commons/math/MessagesResources_fr.java b/src/java/org/apache/commons/math/MessagesResources_fr.java index f6f176895..48e03209d 100644 --- a/src/java/org/apache/commons/math/MessagesResources_fr.java +++ b/src/java/org/apache/commons/math/MessagesResources_fr.java @@ -174,8 +174,6 @@ public class MessagesResources_fr // 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 @@ public class MessagesResources_fr "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 diff --git a/src/java/org/apache/commons/math/linear/RealMatrixImpl.java b/src/java/org/apache/commons/math/linear/RealMatrixImpl.java index d149f415a..53c3b3a30 100644 --- a/src/java/org/apache/commons/math/linear/RealMatrixImpl.java +++ b/src/java/org/apache/commons/math/linear/RealMatrixImpl.java @@ -174,7 +174,12 @@ public class RealMatrixImpl implements RealMatrix, Serializable { 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 @@ public class RealMatrixImpl implements RealMatrix, Serializable { 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 @@ public class RealMatrixImpl implements RealMatrix, Serializable { 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 @@ public class RealMatrixImpl implements RealMatrix, Serializable { 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 @@ public class RealMatrixImpl implements RealMatrix, Serializable { 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 class RealMatrixImpl implements RealMatrix, Serializable { */ 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();