You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2009/02/21 21:01:17 UTC
svn commit: r746578 [2/3] - in /commons/proper/math/trunk/src:
experimental/org/apache/commons/math/linear/ java/org/apache/commons/math/
java/org/apache/commons/math/analysis/integration/
java/org/apache/commons/math/analysis/minimization/ java/org/ap...
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java Sat Feb 21 20:01:14 2009
@@ -244,9 +244,9 @@
ParsePosition parsePosition = new ParsePosition(0);
Fraction result = parse(source, parsePosition);
if (parsePosition.getIndex() == 0) {
- throw MathRuntimeException.createParseException("unparseable fraction number: \"{0}\"",
- new Object[] { source },
- parsePosition.getErrorIndex());
+ throw MathRuntimeException.createParseException(
+ parsePosition.getErrorIndex(),
+ "unparseable fraction number: \"{0}\"", source);
}
return result;
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java Sat Feb 21 20:01:14 2009
@@ -35,7 +35,7 @@
* if false it is related to EulerAngles
*/
public CardanEulerSingularityException(boolean isCardan) {
- super(isCardan ? "Cardan angles singularity" : "Euler angles singularity", null);
+ super(isCardan ? "Cardan angles singularity" : "Euler angles singularity");
}
/** Serializable version identifier */
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/NotARotationMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/NotARotationMatrixException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/NotARotationMatrixException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/NotARotationMatrixException.java Sat Feb 21 20:01:14 2009
@@ -36,7 +36,7 @@
* @param specifier format specifier (to be translated)
* @param parts to insert in the format (no translation)
*/
- public NotARotationMatrixException(String specifier, Object[] parts) {
+ public NotARotationMatrixException(String specifier, Object ... parts) {
super(specifier, parts);
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Rotation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Rotation.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Rotation.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Rotation.java Sat Feb 21 20:01:14 2009
@@ -156,8 +156,7 @@
double norm = axis.getNorm();
if (norm == 0) {
- throw MathRuntimeException.createArithmeticException("zero norm for rotation axis",
- null);
+ throw MathRuntimeException.createArithmeticException("zero norm for rotation axis");
}
double halfAngle = -0.5 * angle;
@@ -206,12 +205,9 @@
// dimension check
if ((m.length != 3) || (m[0].length != 3) ||
(m[1].length != 3) || (m[2].length != 3)) {
- throw new NotARotationMatrixException("a {0}x{1} matrix" +
- " cannot be a rotation matrix",
- new Object[] {
- Integer.toString(m.length),
- Integer.toString(m[0].length)
- });
+ throw new NotARotationMatrixException(
+ "a {0}x{1} matrix cannot be a rotation matrix",
+ m.length, m[0].length);
}
// compute a "close" orthogonal matrix
@@ -222,11 +218,9 @@
ort[1][0] * (ort[0][1] * ort[2][2] - ort[2][1] * ort[0][2]) +
ort[2][0] * (ort[0][1] * ort[1][2] - ort[1][1] * ort[0][2]);
if (det < 0.0) {
- throw new NotARotationMatrixException("the closest orthogonal matrix" +
- " has a negative determinant {0}",
- new Object[] {
- Double.toString(det)
- });
+ throw new NotARotationMatrixException(
+ "the closest orthogonal matrix has a negative determinant {0}",
+ det);
}
// There are different ways to compute the quaternions elements
@@ -1022,11 +1016,9 @@
}
// the algorithm did not converge after 10 iterations
- throw new NotARotationMatrixException("unable to orthogonalize matrix" +
- " in {0} iterations",
- new Object[] {
- Integer.toString(i - 1)
- });
+ throw new NotARotationMatrixException(
+ "unable to orthogonalize matrix in {0} iterations",
+ i - 1);
}
/** Compute the <i>distance</i> between two rotations.
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3D.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3D.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3D.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3D.java Sat Feb 21 20:01:14 2009
@@ -267,8 +267,7 @@
public Vector3D normalize() {
double s = getNorm();
if (s == 0) {
- throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector",
- null);
+ throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");
}
return scalarMultiply(1 / s);
}
@@ -292,7 +291,7 @@
double threshold = 0.6 * getNorm();
if (threshold == 0) {
- throw MathRuntimeException.createArithmeticException("zero norm", null);
+ throw MathRuntimeException.createArithmeticException("zero norm");
}
if ((x >= -threshold) && (x <= threshold)) {
@@ -322,7 +321,7 @@
double normProduct = v1.getNorm() * v2.getNorm();
if (normProduct == 0) {
- throw MathRuntimeException.createArithmeticException("zero norm", null);
+ throw MathRuntimeException.createArithmeticException("zero norm");
}
double dot = dotProduct(v1, v2);
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3DFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3DFormat.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3DFormat.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/geometry/Vector3DFormat.java Sat Feb 21 20:01:14 2009
@@ -255,9 +255,9 @@
ParsePosition parsePosition = new ParsePosition(0);
Vector3D result = parse(source, parsePosition);
if (parsePosition.getIndex() == 0) {
- throw MathRuntimeException.createParseException("unparseable 3D vector: \"{0}\"",
- new Object[] { source },
- parsePosition.getErrorIndex());
+ throw MathRuntimeException.createParseException(
+ parsePosition.getErrorIndex(),
+ "unparseable 3D vector: \"{0}\"", source);
}
return result;
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java Sat Feb 21 20:01:14 2009
@@ -61,14 +61,14 @@
protected AbstractRealMatrix(final int rowDimension, final int columnDimension)
throws IllegalArgumentException {
if (rowDimension <= 0 ) {
- throw MathRuntimeException.createIllegalArgumentException("invalid row dimension {0}" +
- " (must be positive)",
- new Object[] { rowDimension });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "invalid row dimension {0} (must be positive)",
+ rowDimension);
}
if (columnDimension <= 0) {
- throw MathRuntimeException.createIllegalArgumentException("invalid column dimension {0}" +
- " (must be positive)",
- new Object[] { columnDimension });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "invalid column dimension {0} (must be positive)",
+ columnDimension);
}
lu = null;
}
@@ -327,10 +327,8 @@
if ((destination.length < rowsCount) || (destination[0].length < columnsCount)) {
throw MathRuntimeException.createIllegalArgumentException(
"dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- destination.length, destination[0].length,
- rowsCount, columnsCount
- });
+ destination.length, destination[0].length,
+ rowsCount, columnsCount);
}
// copy entries
@@ -372,10 +370,8 @@
(destination[0].length < selectedColumns.length)) {
throw MathRuntimeException.createIllegalArgumentException(
"dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- destination.length, destination[0].length,
- selectedRows.length, selectedColumns.length
- });
+ destination.length, destination[0].length,
+ selectedRows.length, selectedColumns.length);
}
// copy entries
@@ -394,22 +390,19 @@
final int nRows = subMatrix.length;
if (nRows == 0) {
- throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row",
- null);
+ throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
- throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column",
- null);
+ throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
}
for (int r = 1; r < nRows; ++r) {
if (subMatrix[r].length != nCols) {
- throw MathRuntimeException.createIllegalArgumentException("some rows have length {0} while others have length {1}",
- new Object[] {
- nCols, subMatrix[r].length
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "some rows have length {0} while others have length {1}",
+ nCols, subMatrix[r].length);
}
}
@@ -451,12 +444,9 @@
final int nCols = getColumnDimension();
if ((matrix.getRowDimension() != 1) ||
(matrix.getColumnDimension() != nCols)) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- matrix.getRowDimension(),
- matrix.getColumnDimension(),
- 1, nCols
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);
}
for (int i = 0; i < nCols; ++i) {
setEntry(row, i, matrix.getEntry(0, i));
@@ -487,12 +477,9 @@
final int nRows = getRowDimension();
if ((matrix.getRowDimension() != nRows) ||
(matrix.getColumnDimension() != 1)) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- matrix.getRowDimension(),
- matrix.getColumnDimension(),
- nRows, 1
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);
}
for (int i = 0; i < nRows; ++i) {
setEntry(i, column, matrix.getEntry(i, 0));
@@ -513,11 +500,9 @@
checkRowIndex(row);
final int nCols = getColumnDimension();
if (vector.getDimension() != nCols) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- 1, vector.getDimension(),
- 1, nCols
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ 1, vector.getDimension(), 1, nCols);
}
for (int i = 0; i < nCols; ++i) {
setEntry(row, i, vector.getEntry(i));
@@ -538,11 +523,9 @@
checkColumnIndex(column);
final int nRows = getRowDimension();
if (vector.getDimension() != nRows) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- vector.getDimension(), 1,
- nRows, 1
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ vector.getDimension(), 1, nRows, 1);
}
for (int i = 0; i < nRows; ++i) {
setEntry(i, column, vector.getEntry(i));
@@ -572,11 +555,9 @@
checkRowIndex(row);
final int nCols = getColumnDimension();
if (array.length != nCols) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- 1, array.length,
- 1, nCols
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ 1, array.length, 1, nCols);
}
for (int i = 0; i < nCols; ++i) {
setEntry(row, i, array[i]);
@@ -606,11 +587,9 @@
checkColumnIndex(column);
final int nRows = getRowDimension();
if (array.length != nRows) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- array.length, 1,
- nRows, 1
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ array.length, 1, nRows, 1);
}
for (int i = 0; i < nRows; ++i) {
setEntry(i, column, array[i]);
@@ -715,11 +694,9 @@
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
if (v.length != nCols) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.length, nCols
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, nCols);
}
final double[] out = new double[nRows];
@@ -744,11 +721,9 @@
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
if (v.getDimension() != nCols) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.getDimension(), nCols
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.getDimension(), nCols);
}
final double[] out = new double[nRows];
@@ -771,11 +746,9 @@
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
if (v.length != nRows) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.length, nRows
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, nRows);
}
final double[] out = new double[nCols];
@@ -801,11 +774,9 @@
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
if (v.getDimension() != nRows) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.getDimension(), nRows
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.getDimension(), nRows);
}
final double[] out = new double[nCols];
@@ -1119,7 +1090,7 @@
protected void checkRowIndex(final int row) {
if (row < 0 || row >= getRowDimension()) {
throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]",
- new Object[] { row, 0, getRowDimension() - 1});
+ row, 0, getRowDimension() - 1);
}
}
@@ -1132,7 +1103,7 @@
throws MatrixIndexException {
if (column < 0 || column >= getColumnDimension()) {
throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]",
- new Object[] { column, 0, getColumnDimension() - 1});
+ column, 0, getColumnDimension() - 1);
}
}
@@ -1152,14 +1123,14 @@
checkRowIndex(endRow);
if (startRow > endRow) {
throw new MatrixIndexException("initial row {0} after final row {1}",
- new Object[] { startRow, endRow });
+ startRow, endRow);
}
checkColumnIndex(startColumn);
checkColumnIndex(endColumn);
if (startColumn > endColumn) {
throw new MatrixIndexException("initial column {0} after final column {1}",
- new Object[] { startColumn, endColumn });
+ startColumn, endColumn);
}
@@ -1176,9 +1147,9 @@
protected void checkSubMatrixIndex(final int[] selectedRows, final int[] selectedColumns) {
if (selectedRows.length * selectedColumns.length == 0) {
if (selectedRows.length == 0) {
- throw new MatrixIndexException("empty selected row index array", null);
+ throw new MatrixIndexException("empty selected row index array");
}
- throw new MatrixIndexException("empty selected column index array", null);
+ throw new MatrixIndexException("empty selected column index array");
}
for (final int row : selectedRows) {
@@ -1197,14 +1168,10 @@
protected void checkAdditionCompatible(final RealMatrix m) {
if ((getRowDimension() != m.getRowDimension()) ||
(getColumnDimension() != m.getColumnDimension())) {
- throw MathRuntimeException.createIllegalArgumentException("{0}x{1} and {2}x{3} matrices are not" +
- " addition compatible",
- new Object[] {
- getRowDimension(),
- getColumnDimension(),
- m.getRowDimension(),
- m.getColumnDimension()
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "{0}x{1} and {2}x{3} matrices are not addition compatible",
+ getRowDimension(), getColumnDimension(),
+ m.getRowDimension(), m.getColumnDimension());
}
}
@@ -1216,14 +1183,10 @@
protected void checkSubtractionCompatible(final RealMatrix m) {
if ((getRowDimension() != m.getRowDimension()) ||
(getColumnDimension() != m.getColumnDimension())) {
- throw MathRuntimeException.createIllegalArgumentException("{0}x{1} and {2}x{3} matrices are not" +
- " subtraction compatible",
- new Object[] {
- getRowDimension(),
- getColumnDimension(),
- m.getRowDimension(),
- m.getColumnDimension()
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "{0}x{1} and {2}x{3} matrices are not subtraction compatible",
+ getRowDimension(), getColumnDimension(),
+ m.getRowDimension(), m.getColumnDimension());
}
}
@@ -1234,14 +1197,10 @@
*/
protected void checkMultiplicationCompatible(final RealMatrix m) {
if (getColumnDimension() != m.getRowDimension()) {
- throw MathRuntimeException.createIllegalArgumentException("{0}x{1} and {2}x{3} matrices are not" +
- " multiplication compatible",
- new Object[] {
- getRowDimension(),
- getColumnDimension(),
- m.getRowDimension(),
- m.getColumnDimension()
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "{0}x{1} and {2}x{3} matrices are not multiplication compatible",
+ getRowDimension(), getColumnDimension(),
+ m.getRowDimension(), m.getColumnDimension());
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java Sat Feb 21 20:01:14 2009
@@ -588,14 +588,14 @@
checkRowIndex(endRow);
if (startRow > endRow) {
throw new MatrixIndexException("initial row {0} after final row {1}",
- new Object[] { startRow, endRow });
+ startRow, endRow);
}
checkColumnIndex(startColumn);
checkColumnIndex(endColumn);
if (startColumn > endColumn) {
throw new MatrixIndexException("initial column {0} after final column {1}",
- new Object[] { startColumn, endColumn });
+ startColumn, endColumn);
}
final BigDecimal[][] subMatrixData =
@@ -626,9 +626,9 @@
if (selectedRows.length * selectedColumns.length == 0) {
if (selectedRows.length == 0) {
- throw new MatrixIndexException("empty selected row index array", null);
+ throw new MatrixIndexException("empty selected row index array");
}
- throw new MatrixIndexException("empty selected column index array", null);
+ throw new MatrixIndexException("empty selected column index array");
}
final BigDecimal[][] subMatrixData =
@@ -702,12 +702,14 @@
if (data == null) {
if (row > 0) {
- throw MathRuntimeException.createIllegalStateException("first {0} rows are not initialized yet",
- new Object[] { row });
+ throw MathRuntimeException.createIllegalStateException(
+ "first {0} rows are not initialized yet",
+ row);
}
if (column > 0) {
- throw MathRuntimeException.createIllegalStateException("first {0} columns are not initialized yet",
- new Object[] { column });
+ throw MathRuntimeException.createIllegalStateException(
+ "first {0} columns are not initialized yet",
+ column);
}
data = new BigDecimal[nRows][nCols];
System.arraycopy(subMatrix, 0, data, 0, subMatrix.length);
@@ -859,11 +861,9 @@
try {
return data[row][column];
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -989,7 +989,7 @@
*/
public BigDecimal getTrace() throws IllegalArgumentException {
if (!isSquare()) {
- throw new IllegalArgumentException("matrix is not square");
+ throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());
}
BigDecimal trace = data[0][0];
for (int i = 1; i < this.getRowDimension(); i++) {
@@ -1006,8 +1006,10 @@
* @throws IllegalArgumentException if columnDimension != v.size()
*/
public BigDecimal[] operate(BigDecimal[] v) throws IllegalArgumentException {
- if (v.length != this.getColumnDimension()) {
- throw new IllegalArgumentException("vector has wrong length");
+ if (v.length != getColumnDimension()) {
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, getColumnDimension() );
}
final int nRows = this.getRowDimension();
final int nCols = this.getColumnDimension();
@@ -1047,7 +1049,9 @@
public BigDecimal[] preMultiply(BigDecimal[] v) throws IllegalArgumentException {
final int nRows = this.getRowDimension();
if (v.length != nRows) {
- throw new IllegalArgumentException("vector has wrong length");
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, nRows );
}
final int nCols = this.getColumnDimension();
final BigDecimal[] out = new BigDecimal[nCols];
@@ -1075,7 +1079,9 @@
public BigDecimal[] solve(BigDecimal[] b) throws IllegalArgumentException, InvalidMatrixException {
final int nRows = this.getRowDimension();
if (b.length != nRows) {
- throw new IllegalArgumentException("constant vector has wrong length");
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ b.length, nRows);
}
final BigMatrix bMatrix = new BigMatrixImpl(b);
final BigDecimal[][] solution = ((BigMatrixImpl) (solve(bMatrix))).getDataRef();
@@ -1117,10 +1123,12 @@
* @throws InvalidMatrixException if this matrix is not square or is singular
*/
public BigMatrix solve(BigMatrix b) throws IllegalArgumentException, InvalidMatrixException {
- if (b.getRowDimension() != this.getRowDimension()) {
- throw new IllegalArgumentException("Incorrect row dimension");
+ if (b.getRowDimension() != getRowDimension()) {
+ throw MathRuntimeException.createIllegalArgumentException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ b.getRowDimension(), b.getColumnDimension(), getRowDimension(), "n");
}
- if (!this.isSquare()) {
+ if (!isSquare()) {
throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());
}
if (this.isSingular()) { // side effect: compute LU decomp
@@ -1480,8 +1488,9 @@
*/
private void checkRowIndex(final int row) {
if (row < 0 || row >= getRowDimension()) {
- throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]",
- new Object[] { row, 0, getRowDimension() - 1});
+ throw new MatrixIndexException(
+ "row index {0} out of allowed range [{1}, {2}]",
+ row, 0, getRowDimension() - 1);
}
}
@@ -1493,8 +1502,9 @@
private void checkColumnIndex(final int column)
throws MatrixIndexException {
if (column < 0 || column >= getColumnDimension()) {
- throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]",
- new Object[] { column, 0, getColumnDimension() - 1});
+ throw new MatrixIndexException(
+ "column index {0} out of allowed range [{1}, {2}]",
+ column, 0, getColumnDimension() - 1);
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java Sat Feb 21 20:01:14 2009
@@ -166,11 +166,9 @@
final int iHeight = blockHeight(iBlock);
for (int jBlock = 0; jBlock < blockColumns; ++jBlock, ++index) {
if (blockData[index].length != iHeight * blockWidth(jBlock)) {
- throw MathRuntimeException.createIllegalArgumentException("wrong array shape (block length = {0}, expected {1})",
- new Object[] {
- blockData[index].length,
- iHeight * blockWidth(jBlock)
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "wrong array shape (block length = {0}, expected {1})",
+ blockData[index].length, iHeight * blockWidth(jBlock));
}
if (copyArray) {
blocks[index] = blockData[index].clone();
@@ -216,7 +214,7 @@
if (length != columns) {
throw MathRuntimeException.createIllegalArgumentException(
"some rows have length {0} while others have length {1}",
- new Object[] { columns, length });
+ columns, length);
}
}
@@ -801,18 +799,16 @@
// safety checks
final int refLength = subMatrix[0].length;
if (refLength < 1) {
- throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column",
- null);
+ throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
}
final int endRow = row + subMatrix.length - 1;
final int endColumn = column + refLength - 1;
checkSubMatrixIndex(row, endRow, column, endColumn);
for (final double[] subRow : subMatrix) {
if (subRow.length != refLength) {
- throw MathRuntimeException.createIllegalArgumentException("some rows have length {0} while others have length {1}",
- new Object[] {
- refLength, subRow.length
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "some rows have length {0} while others have length {1}",
+ refLength, subRow.length);
}
}
@@ -908,12 +904,10 @@
final int nCols = getColumnDimension();
if ((matrix.getRowDimension() != 1) ||
(matrix.getColumnDimension() != nCols)) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- matrix.getRowDimension(),
- matrix.getColumnDimension(),
- 1, nCols
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ matrix.getRowDimension(), matrix.getColumnDimension(),
+ 1, nCols);
}
// perform copy block-wise, to ensure good cache behavior
@@ -997,12 +991,10 @@
final int nRows = getRowDimension();
if ((matrix.getRowDimension() != nRows) ||
(matrix.getColumnDimension() != 1)) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- matrix.getRowDimension(),
- matrix.getColumnDimension(),
- nRows, 1
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ matrix.getRowDimension(), matrix.getColumnDimension(),
+ nRows, 1);
}
// perform copy block-wise, to ensure good cache behavior
@@ -1121,11 +1113,9 @@
checkRowIndex(row);
final int nCols = getColumnDimension();
if (array.length != nCols) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- 1, array.length,
- 1, nCols
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ 1, array.length, 1, nCols);
}
// perform copy block-wise, to ensure good cache behavior
@@ -1172,11 +1162,9 @@
checkColumnIndex(column);
final int nRows = getRowDimension();
if (array.length != nRows) {
- throw new InvalidMatrixException("dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- array.length, 1,
- nRows, 1
- });
+ throw new InvalidMatrixException(
+ "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+ array.length, 1, nRows, 1);
}
// perform copy block-wise, to ensure good cache behavior
@@ -1204,11 +1192,9 @@
(column - jBlock * BLOCK_SIZE);
return blocks[iBlock * blockColumns + jBlock][k];
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -1222,11 +1208,9 @@
(column - jBlock * BLOCK_SIZE);
blocks[iBlock * blockColumns + jBlock][k] = value;
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -1240,11 +1224,9 @@
(column - jBlock * BLOCK_SIZE);
blocks[iBlock * blockColumns + jBlock][k] += increment;
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -1258,11 +1240,9 @@
(column - jBlock * BLOCK_SIZE);
blocks[iBlock * blockColumns + jBlock][k] *= factor;
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -1317,11 +1297,9 @@
throws IllegalArgumentException {
if (v.length != columns) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.length, columns
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, columns);
}
final double[] out = new double[rows];
@@ -1361,11 +1339,9 @@
throws IllegalArgumentException {
if (v.length != rows) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.length, rows
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, rows);
}
final double[] out = new double[columns];
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java Sat Feb 21 20:01:14 2009
@@ -36,7 +36,7 @@
* @param arguments format arguments
* @since 2.0
*/
- public InvalidMatrixException(final String pattern, final Object[] arguments) {
+ public InvalidMatrixException(final String pattern, final Object ... arguments) {
super(pattern, arguments);
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java Sat Feb 21 20:01:14 2009
@@ -34,7 +34,7 @@
* @param pattern format specifier
* @param arguments format arguments
*/
- public MatrixIndexException(final String pattern, final Object[] arguments) {
+ public MatrixIndexException(final String pattern, final Object ... arguments) {
super(pattern, arguments);
}
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=746578&r1=746577&r2=746578&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 Sat Feb 21 20:01:14 2009
@@ -120,19 +120,17 @@
}
final int nRows = d.length;
if (nRows == 0) {
- throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row",
- null);
+ throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
}
final int nCols = d[0].length;
if (nCols == 0) {
- throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column",
- null);
+ throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
}
for (int r = 1; r < nRows; r++) {
if (d[r].length != nCols) {
- throw MathRuntimeException.createIllegalArgumentException("some rows have length {0} while" +
- " others have length {1}",
- new Object[] { nCols, d[r].length });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "some rows have length {0} while others have length {1}",
+ nCols, d[r].length);
}
}
data = d;
@@ -308,31 +306,30 @@
throws MatrixIndexException {
if (data == null) {
if (row > 0) {
- throw MathRuntimeException.createIllegalStateException("first {0} rows are not initialized yet",
- new Object[] { row });
+ throw MathRuntimeException.createIllegalStateException(
+ "first {0} rows are not initialized yet",
+ row);
}
if (column > 0) {
- throw MathRuntimeException.createIllegalStateException("first {0} columns are not initialized yet",
- new Object[] { column });
+ throw MathRuntimeException.createIllegalStateException(
+ "first {0} columns are not initialized yet",
+ column);
}
final int nRows = subMatrix.length;
if (nRows == 0) {
- throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row",
- null);
+ throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
- throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column",
- null);
+ throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
}
data = new double[subMatrix.length][nCols];
for (int i = 0; i < data.length; ++i) {
if (subMatrix[i].length != nCols) {
- throw MathRuntimeException.createIllegalArgumentException("some rows have length {0} while others have length {1}",
- new Object[] {
- nCols, subMatrix[i].length
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "some rows have length {0} while others have length {1}",
+ nCols, subMatrix[i].length);
}
System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
}
@@ -348,11 +345,9 @@
try {
return data[row][column];
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -362,11 +357,9 @@
try {
data[row][column] = value;
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -376,11 +369,9 @@
try {
data[row][column] += increment;
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -390,11 +381,9 @@
try {
data[row][column] *= factor;
} catch (ArrayIndexOutOfBoundsException e) {
- throw new MatrixIndexException("no entry at indices ({0}, {1}) in a {2}x{3} matrix",
- new Object[] {
- row, column,
- getRowDimension(), getColumnDimension()
- });
+ throw new MatrixIndexException(
+ "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+ row, column, getRowDimension(), getColumnDimension());
}
}
@@ -414,11 +403,9 @@
final int nRows = this.getRowDimension();
final int nCols = this.getColumnDimension();
if (v.length != nCols) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.length, nCols
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, nCols);
}
final double[] out = new double[nRows];
for (int row = 0; row < nRows; row++) {
@@ -439,11 +426,9 @@
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
if (v.length != nRows) {
- throw MathRuntimeException.createIllegalArgumentException("vector length mismatch:" +
- " got {0} but expected {1}",
- new Object[] {
- v.length, nRows
- });
+ throw MathRuntimeException.createIllegalArgumentException(
+ "vector length mismatch: got {0} but expected {1}",
+ v.length, nRows);
}
final double[] out = new double[nCols];
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorFormat.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorFormat.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorFormat.java Sat Feb 21 20:01:14 2009
@@ -259,9 +259,9 @@
ParsePosition parsePosition = new ParsePosition(0);
RealVectorImpl result = parse(source, parsePosition);
if (parsePosition.getIndex() == 0) {
- throw MathRuntimeException.createParseException("unparseable real vector: \"{0}\"",
- new Object[] { source },
- parsePosition.getErrorIndex());
+ throw MathRuntimeException.createParseException(
+ parsePosition.getErrorIndex(),
+ "unparseable real vector: \"{0}\"", source);
}
return result;
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java Sat Feb 21 20:01:14 2009
@@ -1069,7 +1069,7 @@
public RealVector unitVector() throws ArithmeticException {
final double norm = getNorm();
if (norm == 0) {
- throw MathRuntimeException.createArithmeticException("zero norm", null);
+ throw MathRuntimeException.createArithmeticException("zero norm");
}
return mapDivide(getNorm());
}
@@ -1078,8 +1078,7 @@
public void unitize() throws ArithmeticException {
final double norm = getNorm();
if (norm == 0) {
- throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector",
- null);
+ throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");
}
for (int i = 0; i < data.length; i++) {
data[i] /= norm;
@@ -1399,8 +1398,9 @@
private void checkIndex(final int index)
throws MatrixIndexException {
if (index < 0 || index >= getDimension()) {
- throw new MatrixIndexException("index {0} out of allowed range [{1}, {2}]",
- new Object[] { index, 0, getDimension() - 1});
+ throw new MatrixIndexException(
+ "index {0} out of allowed range [{1}, {2}]",
+ index, 0, getDimension() - 1);
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java Sat Feb 21 20:01:14 2009
@@ -1168,8 +1168,7 @@
public void unitize() {
double norm = getNorm();
if(isZero(norm)){
- throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector",
- null);
+ throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");
}
Iterator iter = entries.iterator();
@@ -1192,7 +1191,7 @@
if (index < 0 || index >= getDimension()) {
throw new MatrixIndexException(
"index {0} out of allowed range [{1}, {2}]",
- new Object[] { index, 0, getDimension() - 1 });
+ index, 0, getDimension() - 1);
}
}
@@ -1208,7 +1207,7 @@
if (getDimension() != n) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { getDimension(), n });
+ getDimension(), n);
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/CholeskyDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/CholeskyDecompositionImpl.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/CholeskyDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/CholeskyDecompositionImpl.java Sat Feb 21 20:01:14 2009
@@ -224,7 +224,7 @@
if (b.length != m) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.length, m });
+ b.length, m);
}
final double[] x = b.clone();
@@ -263,7 +263,7 @@
if (b.getDimension() != m) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.getDimension(), m });
+ b.getDimension(), m);
}
final double[] x = b.getData();
@@ -312,7 +312,7 @@
if (b.getRowDimension() != m) {
throw MathRuntimeException.createIllegalArgumentException(
"dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] { b.getRowDimension(), b.getColumnDimension(), m, "n"});
+ b.getRowDimension(), b.getColumnDimension(), m, "n");
}
final int nColB = b.getColumnDimension();
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/EigenDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/EigenDecompositionImpl.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/EigenDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/EigenDecompositionImpl.java Sat Feb 21 20:01:14 2009
@@ -177,8 +177,7 @@
} else {
// as of 2.0, non-symmetric matrices (i.e. complex eigenvalues) are NOT supported
// see issue https://issues.apache.org/jira/browse/MATH-235
- throw new InvalidMatrixException("eigen decomposition of assymetric matrices not supported yet",
- null);
+ throw new InvalidMatrixException("eigen decomposition of assymetric matrices not supported yet");
}
}
@@ -412,7 +411,7 @@
if (b.length != m) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.length, m });
+ b.length, m);
}
final double[] bp = new double[m];
@@ -448,7 +447,7 @@
if (b.getDimension() != m) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.getDimension(), m });
+ b.getDimension(), m);
}
final double[] bp = new double[m];
@@ -484,10 +483,7 @@
if (b.getRowDimension() != m) {
throw MathRuntimeException.createIllegalArgumentException(
"dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- b.getRowDimension(), b.getColumnDimension(),
- m, "n"
- });
+ b.getRowDimension(), b.getColumnDimension(), m, "n");
}
final int nColB = b.getColumnDimension();
@@ -744,7 +740,7 @@
final double p = q0 * q1 - e12;
final double delta = s * s - 4 * p;
if (delta < 0) {
- throw new InvalidMatrixException("cannot solve degree {0} equation", new Object[] { 2 });
+ throw new InvalidMatrixException("cannot solve degree {0} equation", 2);
}
final double largestRoot = 0.5 * (s + Math.sqrt(delta));
@@ -784,7 +780,7 @@
// in fact, there are solutions to the equation, but in the context
// of symmetric realEigenvalues problem, there should be three distinct
// real roots, so we throw an error if this condition is not met
- throw new InvalidMatrixException("cannot solve degree {0} equation", new Object[] { 3 });
+ throw new InvalidMatrixException("cannot solve degree {0} equation", 3);
}
final double sqrtMq = Math.sqrt(-q);
final double theta = Math.acos(r / (-q * sqrtMq));
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/LUDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/LUDecompositionImpl.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/LUDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/LUDecompositionImpl.java Sat Feb 21 20:01:14 2009
@@ -273,7 +273,7 @@
if (b.length != m) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.length, m });
+ b.length, m);
}
if (singular) {
throw new SingularMatrixException();
@@ -316,7 +316,7 @@
if (b.getDimension() != m) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.getDimension(), m });
+ b.getDimension(), m);
}
if (singular) {
throw new SingularMatrixException();
@@ -369,7 +369,7 @@
if (b.getRowDimension() != m) {
throw MathRuntimeException.createIllegalArgumentException(
"dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] { b.getRowDimension(), b.getColumnDimension(), m, "n"});
+ b.getRowDimension(), b.getColumnDimension(), m, "n");
}
if (singular) {
throw new SingularMatrixException();
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NonSquareMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NonSquareMatrixException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NonSquareMatrixException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NonSquareMatrixException.java Sat Feb 21 20:01:14 2009
@@ -36,7 +36,7 @@
*/
public NonSquareMatrixException(final int rows, final int columns) {
super("a {0}x{1} matrix was provided instead of a square matrix",
- new Object[] { rows, columns });
+ rows, columns);
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotPositiveDefiniteMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotPositiveDefiniteMatrixException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotPositiveDefiniteMatrixException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotPositiveDefiniteMatrixException.java Sat Feb 21 20:01:14 2009
@@ -36,7 +36,7 @@
* build an exception with a default message.
*/
public NotPositiveDefiniteMatrixException() {
- super("not positive definite matrix", null);
+ super("not positive definite matrix");
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotSymmetricMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotSymmetricMatrixException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotSymmetricMatrixException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/NotSymmetricMatrixException.java Sat Feb 21 20:01:14 2009
@@ -36,7 +36,7 @@
* build an exception with a default message.
*/
public NotSymmetricMatrixException() {
- super("not symmetric matrix", null);
+ super("not symmetric matrix");
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/QRDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/QRDecompositionImpl.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/QRDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/QRDecompositionImpl.java Sat Feb 21 20:01:14 2009
@@ -303,7 +303,7 @@
if (b.length != m) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.length, m });
+ b.length, m);
}
if (!isNonSingular()) {
throw new SingularMatrixException();
@@ -374,7 +374,7 @@
if (b.getRowDimension() != m) {
throw MathRuntimeException.createIllegalArgumentException(
"dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] { b.getRowDimension(), b.getColumnDimension(), m, "n"});
+ b.getRowDimension(), b.getColumnDimension(), m, "n");
}
if (!isNonSingular()) {
throw new SingularMatrixException();
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularMatrixException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularMatrixException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularMatrixException.java Sat Feb 21 20:01:14 2009
@@ -33,7 +33,7 @@
* Construct an exception with a default message.
*/
public SingularMatrixException() {
- super("matrix is singular", null);
+ super("matrix is singular");
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularValueDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularValueDecompositionImpl.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularValueDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/decomposition/SingularValueDecompositionImpl.java Sat Feb 21 20:01:14 2009
@@ -343,7 +343,7 @@
if (b.length != singularValues.length) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.length, singularValues.length });
+ b.length, singularValues.length);
}
final double[] w = uT.operate(b);
@@ -372,7 +372,7 @@
if (b.getDimension() != singularValues.length) {
throw MathRuntimeException.createIllegalArgumentException(
"vector length mismatch: got {0} but expected {1}",
- new Object[] { b.getDimension(), singularValues.length });
+ b.getDimension(), singularValues.length);
}
final RealVector w = uT.operate(b);
@@ -401,10 +401,8 @@
if (b.getRowDimension() != singularValues.length) {
throw MathRuntimeException.createIllegalArgumentException(
"dimensions mismatch: got {0}x{1} but expected {2}x{3}",
- new Object[] {
- b.getRowDimension(), b.getColumnDimension(),
- singularValues.length, "n"
- });
+ b.getRowDimension(), b.getColumnDimension(),
+ singularValues.length, "n");
}
final RealMatrix w = uT.multiply(b);
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/AbstractIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/AbstractIntegrator.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/AbstractIntegrator.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/AbstractIntegrator.java Sat Feb 21 20:01:14 2009
@@ -137,28 +137,23 @@
throws IntegratorException {
if (equations.getDimension() != y0.length) {
- throw new IntegratorException("dimensions mismatch: ODE problem has dimension {0}," +
- " initial state vector has dimension {1}",
- new Object[] {
- Integer.valueOf(equations.getDimension()),
- Integer.valueOf(y0.length)
- });
+ throw new IntegratorException(
+ "dimensions mismatch: ODE problem has dimension {0}," +
+ " initial state vector has dimension {1}",
+ equations.getDimension(), y0.length);
}
if (equations.getDimension() != y.length) {
- throw new IntegratorException("dimensions mismatch: ODE problem has dimension {0}," +
- " final state vector has dimension {1}",
- new Object[] {
- Integer.valueOf(equations.getDimension()),
- Integer.valueOf(y.length)
- });
+ throw new IntegratorException(
+ "dimensions mismatch: ODE problem has dimension {0}," +
+ " final state vector has dimension {1}",
+ equations.getDimension(), y.length);
}
if (Math.abs(t - t0) <= 1.0e-12 * Math.max(Math.abs(t0), Math.abs(t))) {
- throw new IntegratorException("too small integration interval: length = {0}",
- new Object[] {
- Double.valueOf(Math.abs(t - t0))
- });
+ throw new IntegratorException(
+ "too small integration interval: length = {0}",
+ Math.abs(t - t0));
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java Sat Feb 21 20:01:14 2009
@@ -315,7 +315,7 @@
steps.get(index).setInterpolatedTime(time);
} catch (DerivativeException de) {
- throw new MathRuntimeException("unexpected exception caught", null, de);
+ throw new MathRuntimeException(de, "unexpected exception caught");
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/DerivativeException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/DerivativeException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/DerivativeException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/DerivativeException.java Sat Feb 21 20:01:14 2009
@@ -29,12 +29,15 @@
public class DerivativeException
extends MathException {
+ /** Serializable version identifier */
+ private static final long serialVersionUID = 5666710788967425123L;
+
/** Simple constructor.
* Build an exception by translating and formating a message
* @param specifier format specifier (to be translated)
* @param parts to insert in the format (no translation)
*/
- public DerivativeException(final String specifier, final Object[] parts) {
+ public DerivativeException(final String specifier, final Object ... parts) {
super(specifier, parts);
}
@@ -45,7 +48,4 @@
super(cause);
}
- /** Serializable version identifier */
- private static final long serialVersionUID = -4100440615830558122L;
-
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/IntegratorException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/IntegratorException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/IntegratorException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/IntegratorException.java Sat Feb 21 20:01:14 2009
@@ -27,13 +27,16 @@
*/
public class IntegratorException
extends MathException {
-
+
+ /** Serializable version identifier */
+ private static final long serialVersionUID = -1607588949778036796L;
+
/** Simple constructor.
* Build an exception by translating and formating a message
* @param specifier format specifier (to be translated)
* @param parts to insert in the format (no translation)
*/
- public IntegratorException(final String specifier, final Object[] parts) {
+ public IntegratorException(final String specifier, final Object ... parts) {
super(specifier, parts);
}
@@ -45,7 +48,4 @@
super(cause);
}
- /** Serializable version identifier */
- private static final long serialVersionUID = -1215318282266670558L;
-
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventException.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventException.java Sat Feb 21 20:01:14 2009
@@ -35,7 +35,7 @@
* @param specifier format specifier (to be translated)
* @param parts to insert in the format (no translation)
*/
- public EventException(final String specifier, final Object[] parts) {
+ public EventException(final String specifier, final Object ... parts) {
super(specifier, parts);
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java Sat Feb 21 20:01:14 2009
@@ -197,9 +197,9 @@
interpolator.setInterpolatedTime(t);
return handler.g(t, interpolator.getInterpolatedState());
} catch (DerivativeException e) {
- throw new FunctionEvaluationException(t, e);
+ throw new FunctionEvaluationException(e, t);
} catch (EventException e) {
- throw new FunctionEvaluationException(t, e);
+ throw new FunctionEvaluationException(e, t);
}
}
};
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java?rev=746578&r1=746577&r2=746578&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java Sat Feb 21 20:01:14 2009
@@ -152,21 +152,17 @@
super.sanityChecks(equations, t0, y0, t, y);
if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != y0.length)) {
- throw new IntegratorException("dimensions mismatch: state vector has dimension {0}," +
- " absolute tolerance vector has dimension {1}",
- new Object[] {
- Integer.valueOf(y0.length),
- Integer.valueOf(vecAbsoluteTolerance.length)
- });
+ throw new IntegratorException(
+ "dimensions mismatch: state vector has dimension {0}," +
+ " absolute tolerance vector has dimension {1}",
+ y0.length, vecAbsoluteTolerance.length);
}
if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != y0.length)) {
- throw new IntegratorException("dimensions mismatch: state vector has dimension {0}," +
- " relative tolerance vector has dimension {1}",
- new Object[] {
- Integer.valueOf(y0.length),
- Integer.valueOf(vecRelativeTolerance.length)
- });
+ throw new IntegratorException(
+ "dimensions mismatch: state vector has dimension {0}," +
+ " relative tolerance vector has dimension {1}",
+ y0.length, vecRelativeTolerance.length);
}
}
@@ -267,12 +263,9 @@
if (acceptSmall) {
filteredH = forward ? minStep : -minStep;
} else {
- throw new IntegratorException("minimal step size ({0}) reached," +
- " integration needs {1}",
- new Object[] {
- Double.valueOf(minStep),
- Double.valueOf(Math.abs(h))
- });
+ throw new IntegratorException(
+ "minimal step size ({0}) reached, integration needs {1}",
+ minStep, Math.abs(h));
}
}