Revert fix for MATH-862: it created test regressions.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1459171 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-03-21 07:15:32 +00:00
parent 3f7280b87e
commit 2993a89b06
2 changed files with 1 additions and 18 deletions

View File

@ -353,13 +353,6 @@ public abstract class AbstractRealMatrix
rowsCount, columnsCount); rowsCount, columnsCount);
} }
for (int i = 1; i < rowsCount; i++) {
if (destination[i].length != columnsCount) {
throw new MatrixDimensionMismatchException(destination.length, destination[i].length,
rowsCount, columnsCount);
}
}
walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() { walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {
/** Initial row index. */ /** Initial row index. */
@ -392,19 +385,14 @@ public abstract class AbstractRealMatrix
throws OutOfRangeException, NullArgumentException, NoDataException, throws OutOfRangeException, NullArgumentException, NoDataException,
MatrixDimensionMismatchException { MatrixDimensionMismatchException {
MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns); MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns);
final int nCols = selectedColumns.length;
if ((destination.length < selectedRows.length) || if ((destination.length < selectedRows.length) ||
(destination[0].length < nCols)) { (destination[0].length < selectedColumns.length)) {
throw new MatrixDimensionMismatchException(destination.length, destination[0].length, throw new MatrixDimensionMismatchException(destination.length, destination[0].length,
selectedRows.length, selectedColumns.length); selectedRows.length, selectedColumns.length);
} }
for (int i = 0; i < selectedRows.length; i++) { for (int i = 0; i < selectedRows.length; i++) {
final double[] destinationI = destination[i]; final double[] destinationI = destination[i];
if (destinationI.length != nCols) {
throw new MatrixDimensionMismatchException(destination.length, destinationI.length,
selectedRows.length, selectedColumns.length);
}
for (int j = 0; j < selectedColumns.length; j++) { for (int j = 0; j < selectedColumns.length; j++) {
destinationI[j] = getEntry(selectedRows[i], selectedColumns[j]); destinationI[j] = getEntry(selectedRows[i], selectedColumns[j]);
} }

View File

@ -537,11 +537,6 @@ public final class Array2DRowRealMatrixTest {
checkCopy(m, null, 1, 0, 2, 4, true); checkCopy(m, null, 1, 0, 2, 4, true);
checkCopy(m, null, new int[] {}, new int[] { 0 }, true); checkCopy(m, null, new int[] {}, new int[] { 0 }, true);
checkCopy(m, null, new int[] { 0 }, new int[] { 4 }, true); checkCopy(m, null, new int[] { 0 }, new int[] { 4 }, true);
// rectangular check
double[][] copy = new double[][] { { 0, 0, 0 }, { 0, 0 } };
checkCopy(m, copy, 0, 1, 0, 2, true);
checkCopy(m, copy, new int[] { 0, 1 }, new int[] { 0, 2 }, true);
} }
private void checkCopy(RealMatrix m, double[][] reference, private void checkCopy(RealMatrix m, double[][] reference,