diff --git a/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java b/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java index dbcb9811a..7903524ca 100644 --- a/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java +++ b/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java @@ -37,11 +37,13 @@ import org.apache.commons.math.exception.util.LocalizedFormats; *
All the methods implemented here use {@link #getEntry(int, int)} to access * matrix elements. Derived class can provide faster implementations.
* - * @paramThe input array is copied, not referenced. This constructor has
* the same effect as calling {@link #Array2DRowFieldMatrix(FieldElement[][], boolean)}
- * with the second argument set to true
.
d
is not rectangular
- * (not all rows have the same length) or empty
- * @throws NullPointerException if d
is null
+ * @param d Data for the new matrix.
+ * @throws DimensionMismatchException if {@code d} is not rectangular.
+ * @throws org.apache.commons.math.exception.NullArgumentException if
+ * {@code d} is {@code null}.
+ * @throws NoDataException if there are not at least one row and one column.
* @see #Array2DRowFieldMatrix(FieldElement[][], boolean)
*/
- public Array2DRowFieldMatrix(final T[][] d)
- throws IllegalArgumentException, NullPointerException {
+ public Array2DRowFieldMatrix(final T[][] d) {
super(extractField(d));
copyIn(d);
}
/**
- * Create a new FieldMatrixIf an array is built specially in order to be embedded in a
- * FieldMatrixcopyArray
may be
- * set to false} and not used directly, the {@code copyArray} may be
+ * set to {@code false}. This will prevent the copying and improve
* performance as no new array will be built and no data will be copied.
d
is not rectangular
- * (not all rows have the same length) or empty
- * @throws NullPointerException if d
is null
+ *
+ * @param d Data for the new matrix.
+ * @param copyArray Whether to copy or reference the input array.
+ * @throws DimensionMismatchException if {@code d} is not rectangular.
+ * @throws NoDataException if there are not at least one row and one column.
+ * @throws org.apache.commons.math.exception.NullArgumentException
+ * if {@code d} is {@code null}.
* @see #Array2DRowFieldMatrix(FieldElement[][])
*/
- public Array2DRowFieldMatrix(final T[][] d, final boolean copyArray)
- throws IllegalArgumentException, NullPointerException {
+ public Array2DRowFieldMatrix(final T[][] d, final boolean copyArray) {
super(extractField(d));
if (copyArray) {
copyIn(d);
@@ -113,18 +114,15 @@ public class Array2DRowFieldMatrixv
as the
- * data for the unique column of the v.length x 1
matrix
- * created.
- * The input array is copied, not referenced.
+ * Create a new (column) {@code FieldMatrixm
.
+ * Add {@code m} to this matrix.
*
- * @param m matrix to be added
- * @return this + m
- * @throws IllegalArgumentException if m is not the same size as this
+ * @param m Matrix to be added.
+ * @return {@code this} + m.
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if {@code m} is not the same size as this matrix.
*/
- public Array2DRowFieldMatrixm
.
+ * Subtract {@code m} from this matrix.
*
- * @param m matrix to be subtracted
- * @return this + m
- * @throws IllegalArgumentException if m is not the same size as this
+ * @param m Matrix to be subtracted.
+ * @return {@code this} + m.
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if {@code m} is not the same size as this matrix.
*/
- public Array2DRowFieldMatrixm
.
- * @param m matrix to postmultiply by
- * @return this*m
- * @throws IllegalArgumentException
- * if columnDimension(this) != rowDimension(m)
+ * Postmultiplying this matrix by {@code m}.
+ *
+ * @param m Matrix to postmultiply by.
+ * @return {@code this} * m.
+ * @throws DimensionMismatchException if the number of columns of this
+ * matrix is not equal to the number of rows of {@code m}.
*/
- public Array2DRowFieldMatrix- * Does not make a fresh copy of the underlying data.
+ * Get a reference to the underlying data array. + * This methods returns internal data, not fresh copy of it. * - * @return 2-dimensional array of entries + * @return the 2-dimensional array of entries. */ public T[][] getDataRef() { return data; @@ -307,29 +265,24 @@ public class Array2DRowFieldMatrix- * Verifies that the input array is rectangular and non-empty.
+ * Replace data with a fresh copy of the input array. * - * @param in data to copy in - * @throws IllegalArgumentException if input array is empty or not - * rectangular - * @throws NullPointerException if input array is null + * @param in Data to copy. + * @throws NoDataException if the input array is empty. + * @throws DimensionMismatchException if the input array is not rectangular. + * @throws org.apache.commons.math.exception.NullArgumentException if + * the input array is {@code null}. */ private void copyIn(final T[][] in) { setSubMatrix(in, 0, 0); } - } diff --git a/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java b/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java index 1c868352e..db61eab24 100644 --- a/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java +++ b/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java @@ -21,7 +21,7 @@ import java.io.Serializable; import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.exception.NullArgumentException; -import org.apache.commons.math.exception.ZeroException; +import org.apache.commons.math.exception.NoDataException; import org.apache.commons.math.exception.MathIllegalStateException; import org.apache.commons.math.exception.util.LocalizedFormats; @@ -67,32 +67,30 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ /** * Create a new RealMatrix with the supplied row and column dimensions. * - * @param rowDimension the number of rows in the new matrix - * @param columnDimension the number of columns in the new matrix - * @throws IllegalArgumentException if row or column dimension is not - * positive + * @param rowDimension Number of rows in the new matrix. + * @param columnDimension Number of columns in the new matrix. + * @throws org.apache.commons.math.exception.NotStrictlyPositiveException + * if the row or column dimension is not positive. */ - public Array2DRowRealMatrix(final int rowDimension, final int columnDimension) - throws IllegalArgumentException { + public Array2DRowRealMatrix(final int rowDimension, final int columnDimension) { super(rowDimension, columnDimension); data = new double[rowDimension][columnDimension]; } /** - * Create a new RealMatrix using the input array as the underlying + * Create a new {@code RealMatrix} using the input array as the underlying * data array. *The input array is copied, not referenced. This constructor has
* the same effect as calling {@link #Array2DRowRealMatrix(double[][], boolean)}
- * with the second argument set to true
.
d
is not rectangular
- * (not all rows have the same length) or empty
- * @throws NullPointerException if d
is null
+ * @param d Data for the new matrix.
+ * @throws DimensionMismatchException if {@code d} is not rectangular.
+ * @throws NoDataException if {@code d} row or colum dimension is zero.
+ * @throws NullPointerException if {@code d} is {@code null}.
* @see #Array2DRowRealMatrix(double[][], boolean)
*/
- public Array2DRowRealMatrix(final double[][] d)
- throws IllegalArgumentException, NullPointerException {
+ public Array2DRowRealMatrix(final double[][] d) {
copyIn(d);
}
@@ -110,7 +108,7 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
* @throws DimensionMismatchException if {@code d} is not rectangular
* (not all rows have the same length) or empty.
* @throws NullArgumentException if {@code d} is {@code null}.
- * @throws ZeroException if there are not at least one row and one column.
+ * @throws NoDataException if there are not at least one row and one column.
* @see #Array2DRowRealMatrix(double[][])
*/
public Array2DRowRealMatrix(final double[][] d, final boolean copyArray) {
@@ -122,11 +120,11 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
final int nRows = d.length;
if (nRows == 0) {
- throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_ROW);
+ throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = d[0].length;
if (nCols == 0) {
- throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+ throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; r++) {
if (d[r].length != nCols) {
@@ -139,9 +137,8 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
/**
* Create a new (column) RealMatrix using {@code v} as the
- * data for the unique column of the {@code v.length x 1} matrix
- * created.
- * The input array is copied, not referenced.
+ * data for the unique column of the created matrix.
+ * The input array is copied.
*
* @param v Column vector holding data for new matrix.
*/
@@ -221,13 +218,12 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/**
- * Returns the result of postmultiplying this matrix with {@code m}.
+ * Postmultiplying this matrix by {@code m}.
*
* @param m Matrix to postmultiply by.
* @return {@code this} * m.
- * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
- * if the column dimension of this matrix is different from the row
- * dimension of {@code m}.
+ * @throws DimensionMismatchException if the number of columns of this
+ * matrix is not equal to the number of rows of {@code m}.
*/
public Array2DRowRealMatrix multiply(final Array2DRowRealMatrix m) {
// Safety check.
@@ -260,7 +256,7 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/**
- * Return a reference to the underlying data array.
+ * Get a reference to the underlying data array.
*
* @return 2-dimensional array of entries.
*/
@@ -281,12 +277,12 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
final int nRows = subMatrix.length;
if (nRows == 0) {
- throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_ROW);
+ throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
- throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+ throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
data = new double[subMatrix.length][nCols];
for (int i = 0; i < data.length; ++i) {
@@ -510,7 +506,7 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/**
- * Returns a fresh copy of the underlying data array.
+ * Get a fresh copy of the underlying data array.
*
* @return a copy of the underlying data array.
*/
@@ -525,17 +521,15 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/**
- * Replaces data with a fresh copy of the input array.
- * - * Verifies that the input array is rectangular and non-empty.
+ * Replace data with a fresh copy of the input array. * - * @param in data to copy in - * @throws IllegalArgumentException if input array is empty or not - * rectangular - * @throws NullPointerException if input array is null + * @param in Data to copy. + * @throws NoDataException if the input array is empty. + * @throws DimensionMismatchException if the input array is not rectangular. + * @throws org.apache.commons.math.exception.NullArgumentException if + * the input array is {@code null}. */ private void copyIn(final double[][] in) { setSubMatrix(in, 0, 0); } - } diff --git a/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java b/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java index 18f8da01b..888cd957e 100644 --- a/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java +++ b/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java @@ -200,8 +200,8 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Construct a vector by appending one vector to another vector. - * @param v1 first vector (will be put in front of the new vector) - * @param v2 second vector (will be put at back of the new vector) + * @param v1 First vector (will be put in front of the new vector). + * @param v2 Second vector (will be put at back of the new vector). */ public ArrayRealVector(ArrayRealVector v1, ArrayRealVector v2) { data = new double[v1.data.length + v2.data.length]; @@ -211,8 +211,8 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Construct a vector by appending one vector to another vector. - * @param v1 first vector (will be put in front of the new vector) - * @param v2 second vector (will be put at back of the new vector) + * @param v1 First vector (will be put in front of the new vector). + * @param v2 Second vector (will be put at back of the new vector). */ public ArrayRealVector(ArrayRealVector v1, RealVector v2) { final int l1 = v1.data.length; @@ -226,8 +226,8 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Construct a vector by appending one vector to another vector. - * @param v1 first vector (will be put in front of the new vector) - * @param v2 second vector (will be put at back of the new vector) + * @param v1 First vector (will be put in front of the new vector). + * @param v2 Second vector (will be put at back of the new vector). */ public ArrayRealVector(RealVector v1, ArrayRealVector v2) { final int l1 = v1.getDimension(); @@ -241,8 +241,8 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Construct a vector by appending one vector to another vector. - * @param v1 first vector (will be put in front of the new vector) - * @param v2 second vector (will be put at back of the new vector) + * @param v1 First vector (will be put in front of the new vector). + * @param v2 Second vector (will be put at back of the new vector). */ public ArrayRealVector(ArrayRealVector v1, double[] v2) { final int l1 = v1.getDimension(); @@ -254,8 +254,8 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Construct a vector by appending one vector to another vector. - * @param v1 first vector (will be put in front of the new vector) - * @param v2 second vector (will be put at back of the new vector) + * @param v1 First vector (will be put in front of the new vector). + * @param v2 Second vector (will be put at back of the new vector). */ public ArrayRealVector(double[] v1, ArrayRealVector v2) { final int l1 = v1.length; @@ -286,8 +286,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public RealVector add(RealVector v) - throws IllegalArgumentException { + public RealVector add(RealVector v) { if (v instanceof ArrayRealVector) { return add((ArrayRealVector) v); } else { @@ -304,8 +303,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public RealVector add(double[] v) - throws IllegalArgumentException { + public RealVector add(double[] v) { checkVectorDimensions(v.length); double[] out = data.clone(); for (int i = 0; i < data.length; i++) { @@ -315,20 +313,20 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable } /** - * Compute the sum of this and v. - * @param v vector to be added - * @return this + v - * @throws IllegalArgumentException if v is not the same size as this + * Add {@code v} to this vector. + * + * @param v Vector to be added + * @return {@code this} + v. + * @throws DimensionMismatchException if {@code v} is not the same + * size as this vector. */ - public ArrayRealVector add(ArrayRealVector v) - throws IllegalArgumentException { + public ArrayRealVector add(ArrayRealVector v) { return (ArrayRealVector) add(v.data); } /** {@inheritDoc} */ @Override - public RealVector subtract(RealVector v) - throws IllegalArgumentException { + public RealVector subtract(RealVector v) { if (v instanceof ArrayRealVector) { return subtract((ArrayRealVector) v); } else { @@ -345,8 +343,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public RealVector subtract(double[] v) - throws IllegalArgumentException { + public RealVector subtract(double[] v) { checkVectorDimensions(v.length); double[] out = data.clone(); for (int i = 0; i < data.length; i++) { @@ -356,13 +353,14 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable } /** - * Compute this minus v. - * @param v vector to be subtracted - * @return this + v - * @throws IllegalArgumentException if v is not the same size as this + * Subtract {@code v} from this vector. + * + * @param v Vector to be subtracted. + * @return {@code this} - v. + * @throws DimensionMismatchException if {@code v} is not the + * same size as this vector. */ - public ArrayRealVector subtract(ArrayRealVector v) - throws IllegalArgumentException { + public ArrayRealVector subtract(ArrayRealVector v) { return (ArrayRealVector) subtract(v.data); } @@ -619,8 +617,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable } /** {@inheritDoc} */ - public RealVector ebeMultiply(RealVector v) - throws IllegalArgumentException { + public RealVector ebeMultiply(RealVector v) { if (v instanceof ArrayRealVector) { return ebeMultiply((ArrayRealVector) v); } else { @@ -635,8 +632,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public RealVector ebeMultiply(double[] v) - throws IllegalArgumentException { + public RealVector ebeMultiply(double[] v) { checkVectorDimensions(v.length); double[] out = data.clone(); for (int i = 0; i < data.length; i++) { @@ -647,18 +643,17 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Element-by-element multiplication. - * @param v vector by which instance elements must be multiplied - * @return a vector containing this[i] * v[i] for all i - * @exception IllegalArgumentException if v is not the same size as this + * @param v Vector by which instance elements must be multiplied. + * @return a Vector containing {@code this[i] * v[i]} for all {@code i}. + * @exception DimensionMismatchException if {@code v} is not the same + * size as this vector. */ - public ArrayRealVector ebeMultiply(ArrayRealVector v) - throws IllegalArgumentException { + public ArrayRealVector ebeMultiply(ArrayRealVector v) { return (ArrayRealVector) ebeMultiply(v.data); } /** {@inheritDoc} */ - public RealVector ebeDivide(RealVector v) - throws IllegalArgumentException { + public RealVector ebeDivide(RealVector v) { if (v instanceof ArrayRealVector) { return ebeDivide((ArrayRealVector) v); } else { @@ -673,8 +668,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public RealVector ebeDivide(double[] v) - throws IllegalArgumentException { + public RealVector ebeDivide(double[] v) { checkVectorDimensions(v.length); double[] out = data.clone(); for (int i = 0; i < data.length; i++) { @@ -685,12 +679,13 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Element-by-element division. - * @param v vector by which instance elements must be divided - * @return a vector containing this[i] / v[i] for all i - * @throws IllegalArgumentException if v is not the same size as this + * + * @param v Vector by which instance elements must be divided. + * @return a vector containing {@code this[i] / v[i]} for all {@code i}. + * @exception DimensionMismatchException if {@code v} is not the same + * size as this vector. */ - public ArrayRealVector ebeDivide(ArrayRealVector v) - throws IllegalArgumentException { + public ArrayRealVector ebeDivide(ArrayRealVector v) { return (ArrayRealVector) ebeDivide(v.data); } @@ -701,9 +696,10 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable } /** - * Returns a reference to the underlying data array. - *Does not make a fresh copy of the underlying data.
- * @return array of entries + * Get a reference to the underlying data array. + * This method does not make a fresh copy of the underlying data. + * + * @return the array of entries. */ public double[] getDataRef() { return data; @@ -711,8 +707,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public double dotProduct(RealVector v) - throws IllegalArgumentException { + public double dotProduct(RealVector v) { if (v instanceof ArrayRealVector) { return dotProduct((ArrayRealVector) v); } else { @@ -729,8 +724,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public double dotProduct(double[] v) - throws IllegalArgumentException { + public double dotProduct(double[] v) { checkVectorDimensions(v.length); double dot = 0; for (int i = 0; i < data.length; i++) { @@ -783,8 +777,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public double getDistance(RealVector v) - throws IllegalArgumentException { + public double getDistance(RealVector v) { if (v instanceof ArrayRealVector) { return getDistance((ArrayRealVector) v); } else { @@ -800,8 +793,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public double getDistance(double[] v) - throws IllegalArgumentException { + public double getDistance(double[] v) { checkVectorDimensions(v.length); double sum = 0; for (int i = 0; i < data.length; ++i) { @@ -817,7 +809,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable * L2 norm, i.e. the square root of the sum of * elements differences, or euclidian distance. * - * @param v vector to which distance is requested + * @param v Vector to which distance is requested. * @return the distance between two vectors. * @throws DimensionMismatchException if {@code v} is not the same size as * this vector. @@ -848,8 +840,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public double getL1Distance(double[] v) - throws IllegalArgumentException { + public double getL1Distance(double[] v) { checkVectorDimensions(v.length); double sum = 0; for (int i = 0; i < data.length; ++i) { @@ -896,8 +887,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public double getLInfDistance(double[] v) - throws IllegalArgumentException { + public double getLInfDistance(double[] v) { checkVectorDimensions(v.length); double max = 0; for (int i = 0; i < data.length; ++i) { @@ -970,8 +960,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** {@inheritDoc} */ @Override - public RealMatrix outerProduct(RealVector v) - throws IllegalArgumentException { + public RealMatrix outerProduct(RealVector v) { if (v instanceof ArrayRealVector) { return outerProduct((ArrayRealVector) v); } else { @@ -989,19 +978,18 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable /** * Compute the outer product. - * @param v vector with which outer product should be computed - * @return the square matrix outer product between instance and v - * @exception IllegalArgumentException if v is not the same size as this + * @param v Vector with which outer product should be computed. + * @return the square matrix outer product between this instance and {@code v}. + * @throws DimensionMismatchException if {@code v} is not the same + * size as this vector. */ - public RealMatrix outerProduct(ArrayRealVector v) - throws IllegalArgumentException { + public RealMatrix outerProduct(ArrayRealVector v) { return outerProduct(v.data); } /** {@inheritDoc} */ @Override - public RealMatrix outerProduct(double[] v) - throws IllegalArgumentException { + public RealMatrix outerProduct(double[] v) { checkVectorDimensions(v.length); final int m = data.length; final RealMatrix out = MatrixUtils.createRealMatrix(m, m); @@ -1084,7 +1072,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable set(index, (ArrayRealVector) v); } catch (ClassCastException cce) { for (int i = index; i < index + v.getDimension(); ++i) { - data[i] = v.getEntry(i-index); + data[i] = v.getEntry(i - index); } } } catch (IndexOutOfBoundsException e) { @@ -1110,7 +1098,7 @@ public class ArrayRealVector extends AbstractRealVector implements Serializable * @param index Index of first element to be set. * @param v Vector containing the values to set. * @throws org.apache.commons.math.exception.OutOfRangeException - * if the index is inconsistent with vector size. + * if the index is inconsistent with the vector size. */ public void set(int index, ArrayRealVector v) { setSubVector(index, v.data); diff --git a/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java b/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java index 75e3c6949..d59ab69fb 100644 --- a/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java +++ b/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java @@ -370,8 +370,7 @@ public class BlockFieldMatrixmatrix = new BlockRealMatrix(rawData.length, rawData[0].length, * toBlocksLayout(rawData), false);* - * @param rawData data for new matrix, in raw layout * - * @exception IllegalArgumentException if
blockData
shape is
- * inconsistent with block layout
+ * @param rawData data for new matrix, in raw layout
+ * @throws DimensionMismatchException if the shape of {@code blockData} is
+ * inconsistent with block layout.
* @see #BlockRealMatrix(int, int, double[][], boolean)
*/
- public BlockRealMatrix(final double[][] rawData)
- throws IllegalArgumentException {
+ public BlockRealMatrix(final double[][] rawData) {
this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);
}
/**
* Create a new dense matrix copying entries from block layout data.
* The input array must already be in blocks layout.
- * @param rows the number of rows in the new matrix - * @param columns the number of columns in the new matrix - * @param blockData data for new matrix - * @param copyArray if true, the input array will be copied, otherwise - * it will be referenced * - * @exception IllegalArgumentException ifblockData
shape is
- * inconsistent with block layout
+ * @param rows Number of rows in the new matrix.
+ * @param columns Number of columns in the new matrix.
+ * @param blockData data for new matrix
+ * @param copyArray Whether the input array will be copied or referenced.
+ * @throws DimensionMismatchException if the shape of {@code blockData} is
+ * inconsistent with block layout.
* @see #createBlocksLayout(int, int)
* @see #toBlocksLayout(double[][])
* @see #BlockRealMatrix(double[][])
@@ -183,10 +181,9 @@ public class BlockRealMatrix extends AbstractRealMatrix implements Serializable
* It can be used to provide the array argument of the {@link
* #BlockRealMatrix(int, int, double[][], boolean)} constructor.
*
- * @param rawData data array in raw layout
- * @return a new data array containing the same entries but in blocks layout
- * @exception IllegalArgumentException if rawData
is not rectangular
- * (not all rows have the same length)
+ * @param rawData Data array in raw layout.
+ * @return a new data array containing the same entries but in blocks layout.
+ * @throws DimensionMismatchException if {@code rawData} is not rectangular.
* @see #createBlocksLayout(int, int)
* @see #BlockRealMatrix(int, int, double[][], boolean)
*/
@@ -239,9 +236,9 @@ public class BlockRealMatrix extends AbstractRealMatrix implements Serializable
* This method can be used to create the array argument of the {@link
* #BlockRealMatrix(int, int, double[][], boolean)} constructor.
*
- * @param rows the number of rows in the new matrix
- * @param columns the number of columns in the new matrix
- * @return a new data array in blocks layout
+ * @param rows Number of rows in the new matrix.
+ * @param columns Number of columns in the new matrix.
+ * @return a new data array in blocks layout.
* @see #toBlocksLayout(double[][])
* @see #BlockRealMatrix(int, int, double[][], boolean)
*/
diff --git a/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java
index 769f7c460..c59d09d15 100644
--- a/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java
@@ -18,7 +18,6 @@
package org.apache.commons.math.linear;
import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.exception.MathUserException;
/**
* Default implementation of the {@link FieldMatrixChangingVisitor} interface.
@@ -33,7 +32,6 @@ import org.apache.commons.math.exception.MathUserException;
*/
public class DefaultFieldMatrixChangingVisitor@@ -30,7 +28,6 @@ import org.apache.commons.math.exception.MathUserException; * @since 2.0 */ public class DefaultRealMatrixChangingVisitor implements RealMatrixChangingVisitor { - /** {@inheritDoc} */ public void start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn) { @@ -45,5 +42,4 @@ public class DefaultRealMatrixChangingVisitor implements RealMatrixChangingVisit public double end() { return 0; } - } diff --git a/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java index 403cfeb69..981babdd9 100644 --- a/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java +++ b/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java @@ -17,8 +17,6 @@ package org.apache.commons.math.linear; -import org.apache.commons.math.exception.MathUserException; - /** * Default implementation of the {@link RealMatrixPreservingVisitor} interface. *
@@ -30,7 +28,6 @@ import org.apache.commons.math.exception.MathUserException;
* @since 2.0
*/
public class DefaultRealMatrixPreservingVisitor implements RealMatrixPreservingVisitor {
-
/** {@inheritDoc} */
public void start(int rows, int columns,
int startRow, int endRow, int startColumn, int endColumn) {
@@ -43,5 +40,4 @@ public class DefaultRealMatrixPreservingVisitor implements RealMatrixPreservingV
public double end() {
return 0;
}
-
}
diff --git a/src/main/java/org/apache/commons/math/linear/FieldMatrix.java b/src/main/java/org/apache/commons/math/linear/FieldMatrix.java
index 3b7597ae8..b143961fe 100644
--- a/src/main/java/org/apache/commons/math/linear/FieldMatrix.java
+++ b/src/main/java/org/apache/commons/math/linear/FieldMatrix.java
@@ -20,7 +20,6 @@ package org.apache.commons.math.linear;
import org.apache.commons.math.Field;
import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.exception.MathUserException;
/**
* Interface defining field-valued matrix with basic algebraic operations.
@@ -32,7 +31,6 @@ import org.apache.commons.math.exception.MathUserException;
* @version $Revision$ $Date$
*/
public interface FieldMatrix This method is called once before any entry of the matrix is visited. This method is called once before any entry of the matrix is visited.
@@ -29,7 +26,6 @@ import org.apache.commons.math.exception.MathUserException;
* @version $Revision$ $Date$
*/
public interface RealMatrix extends AnyMatrix {
-
/**
* Create a new RealMatrix of the same type as the instance with the supplied
* row and column dimensions.
diff --git a/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
index 395c6b841..0465b073a 100644
--- a/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
@@ -17,8 +17,6 @@
package org.apache.commons.math.linear;
-import org.apache.commons.math.exception.MathUserException;
-
/**
* Interface defining a visitor for matrix entries.
*
@@ -27,7 +25,6 @@ import org.apache.commons.math.exception.MathUserException;
* @since 2.0
*/
public interface RealMatrixChangingVisitor {
-
/**
* Start visiting a matrix.
* This method is called once before any entry of the matrix is visited. This method is called once before any entry of the matrix is visited.