You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2004/09/01 23:26:11 UTC
cvs commit: jakarta-commons/math/src/java/org/apache/commons/math/linear BigMatrix.java BigMatrixImpl.java RealMatrix.java RealMatrixImpl.java
psteitz 2004/09/01 14:26:11
Modified: math/src/java/org/apache/commons/math/linear BigMatrix.java
BigMatrixImpl.java RealMatrix.java
RealMatrixImpl.java
Log:
Made standard matrix entry addressing explicit in javadoc.
Revision Changes Path
1.6 +67 -26 jakarta-commons/math/src/java/org/apache/commons/math/linear/BigMatrix.java
Index: BigMatrix.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/BigMatrix.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BigMatrix.java 22 Aug 2004 01:42:58 -0000 1.5
+++ BigMatrix.java 1 Sep 2004 21:26:11 -0000 1.6
@@ -150,88 +150,122 @@
/**
* Returns the entries in row number <code>row</code> as an array.
+ * <p>
+ * Row indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < row <= rowDimension.</code>
*
* @param row the row to be fetched
* @return array of entries in the row
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified row is greater
- * than the number of rows in this matrix
+ * @throws MatrixIndexException if the specified row index is not valid
*/
BigDecimal[] getRow(int row) throws MatrixIndexException;
/**
* Returns the entries in row number <code>row</code> as an array
* of double values.
+ * <p>
+ * Row indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < row <= rowDimension.</code>
*
* @param row the row to be fetched
* @return array of entries in the row
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified row is greater
- * than the number of rows in this matrix
+ * @throws MatrixIndexException if the specified row index is not valid
*/
double [] getRowAsDoubleArray(int row) throws MatrixIndexException;
/**
* Returns the entries in column number <code>col</code> as an array.
+ * <p>
+ * Column indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < column <= columnDimension.</code>
*
- * @param col column to fetch
+ * @param col the column to be fetched
* @return array of entries in the column
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified column is greater
- * than the number of columns in this matrix
+ * @throws MatrixIndexException if the specified column index is not valid
*/
BigDecimal[] getColumn(int col) throws MatrixIndexException;
/**
* Returns the entries in column number <code>col</code> as an array
* of double values.
+ * <p>
+ * Column indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < column <= columnDimension.</code>
*
- * @param col column to fetch
+ * @param col the column to be fetched
* @return array of entries in the column
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified column is greater
- * than the number of columns in this matrix
+ * @throws MatrixIndexException if the specified column index is not valid
*/
double [] getColumnAsDoubleArray(int col) throws MatrixIndexException;
/**
* Returns the entry in the specified row and column.
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
*
* @param row row location of entry to be fetched
* @param column column location of entry to be fetched
* @return matrix entry in row,column
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified coordinate is outside
- * the dimensions of this matrix
+ * @throws MatrixIndexException if the row or column index is not valid
*/
BigDecimal getEntry(int row, int column) throws MatrixIndexException;
/**
- * Returns the entry in the specified row and column as a double
+ * Returns the entry in the specified row and column as a double.
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
*
* @param row row location of entry to be fetched
* @param column column location of entry to be fetched
* @return matrix entry in row,column
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified coordinate is outside
- * the dimensions of this matrix
+ * @throws MatrixIndexException if the row or column index is not valid
*/
double getEntryAsDouble(int row, int column) throws MatrixIndexException;
/**
* Sets the entry in the specified row and column to the specified value.
- *
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
* @param row row location of entry to be set
* @param column column location of entry to be set
* @param value value to set
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified coordinate is outside
- * he dimensions of this matrix
+ * @throws org.apache.commons.math.linear.MatrixIndexException if the row
+ * or column index is not valid
*/
void setEntry(int row, int column, BigDecimal value)
throws MatrixIndexException;
/**
* Sets the entry in the specified row and column to the specified value.
- *
- * @param row row location of entry to be set
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
+ * @param row row location of entry to be set
* @param column column location of entry to be set
- * @param value value to set
- * @throws org.apache.commons.math.linear.MatrixIndexException if the specified coordinate is outside
- * he dimensions of this matrix
+ * @param value value to set
+ * @throws org.apache.commons.math.linear.MatrixIndexException if the row
+ * or column index is not valid
*/
void setEntry(int row, int column, double value)
throws MatrixIndexException;
@@ -239,12 +273,19 @@
/**
* Sets the entry in the specified row and column to the
* <code>BigDecimal</code> value represented by the input string.
- *
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
* @param row row location of entry to be set
* @param column column location of entry to be set
* @param value value to set
* @throws org.apache.commons.math.linear.MatrixIndexException if the
- * specified coordinate is outside the dimensions of this matrix
+ * row or column index is not valid
* @throws NumberFormatException if <code>value</code> is not a valid
* representation of a <code>BigDecimal</code> value
*/
1.5 +70 -31 jakarta-commons/math/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
Index: BigMatrixImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/BigMatrixImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BigMatrixImpl.java 22 Aug 2004 01:42:58 -0000 1.4
+++ BigMatrixImpl.java 1 Sep 2004 21:26:11 -0000 1.5
@@ -427,11 +427,13 @@
/**
* Returns the entries in row number <code>row</code> as an array.
+ * <p>
+ * Row indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < row <= rowDimension.</code>
*
* @param row the row to be fetched
* @return array of entries in the row
- * @throws MatrixIndexException if the specified row is greater
- * than the number of rows in this matrix
+ * @throws MatrixIndexException if the specified row index is not valid
*/
public BigDecimal[] getRow(int row) throws MatrixIndexException {
if ( !isValidCoordinate( row, 1 ) ) {
@@ -443,14 +445,16 @@
return out;
}
- /**
+ /**
* Returns the entries in row number <code>row</code> as an array
* of double values.
+ * <p>
+ * Row indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < row <= rowDimension.</code>
*
* @param row the row to be fetched
* @return array of entries in the row
- * @throws org.apache.commons.math.linear.MatrixIndexException if the
- * specified row is greater than the number of rows in this matrix
+ * @throws MatrixIndexException if the specified row index is not valid
*/
public double[] getRowAsDoubleArray(int row) throws MatrixIndexException {
if ( !isValidCoordinate( row, 1 ) ) {
@@ -464,13 +468,15 @@
return out;
}
- /**
+ /**
* Returns the entries in column number <code>col</code> as an array.
+ * <p>
+ * Column indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < column <= columnDimension.</code>
*
- * @param col column to fetch
+ * @param col the column to be fetched
* @return array of entries in the column
- * @throws org.apache.commons.math.linear.MatrixIndexException if the
- * specified column is greater than the number of columns in this matrix
+ * @throws MatrixIndexException if the specified column index is not valid
*/
public BigDecimal[] getColumn(int col) throws MatrixIndexException {
if ( !isValidCoordinate(1, col) ) {
@@ -487,11 +493,13 @@
/**
* Returns the entries in column number <code>col</code> as an array
* of double values.
+ * <p>
+ * Column indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < column <= columnDimension.</code>
*
- * @param col column to fetch
+ * @param col the column to be fetched
* @return array of entries in the column
- * @throws org.apache.commons.math.linear.MatrixIndexException if the
- * specified column is greater than the number of columns in this matrix
+ * @throws MatrixIndexException if the specified column index is not valid
*/
public double[] getColumnAsDoubleArray(int col) throws MatrixIndexException {
if ( !isValidCoordinate( 1, col ) ) {
@@ -505,14 +513,20 @@
return out;
}
- /**
+ /**
* Returns the entry in the specified row and column.
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
*
* @param row row location of entry to be fetched
* @param column column location of entry to be fetched
* @return matrix entry in row,column
- * @throws MatrixIndexException if the specified coordinate is outside
- * the dimensions of this matrix
+ * @throws MatrixIndexException if the row or column index is not valid
*/
public BigDecimal getEntry(int row, int column)
throws MatrixIndexException {
@@ -523,13 +537,20 @@
}
/**
- * Returns the entry in the specified row and column as a double
+ * Returns the entry in the specified row and column as a double.
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
*
* @param row row location of entry to be fetched
* @param column column location of entry to be fetched
* @return matrix entry in row,column
- * @throws org.apache.commons.math.linear.MatrixIndexException if the
- * specified coordinate is outside the dimensions of this matrix
+ * @throws MatrixIndexException if the row
+ * or column index is not valid
*/
public double getEntryAsDouble(int row, int column) throws MatrixIndexException {
return getEntry(row,column).doubleValue();
@@ -537,12 +558,18 @@
/**
* Sets the entry in the specified row and column to the specified value.
- *
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
* @param row row location of entry to be set
* @param column column location of entry to be set
* @param value value to set
- * @throws MatrixIndexException if the specified coordinate is outside
- * he dimensions of this matrix
+ * @throws MatrixIndexException if the row or column index is not valid
*/
public void setEntry(int row, int column, BigDecimal value)
throws MatrixIndexException {
@@ -555,26 +582,38 @@
/**
* Sets the entry in the specified row and column to the specified value.
- *
- * @param row row location of entry to be set
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
+ * @param row row location of entry to be set
* @param column column location of entry to be set
- * @param value value to set
- * @throws org.apache.commons.math.linear.MatrixIndexException if the
- * specified coordinate is outside the dimensions of this matrix
+ * @param value value to set
+ * @throws MatrixIndexException if the row or column index is not valid
*/
public void setEntry(int row, int column, double value) throws MatrixIndexException {
setEntry(row, column, new BigDecimal(value));
}
- /**
+ /**
* Sets the entry in the specified row and column to the
* <code>BigDecimal</code> value represented by the input string.
- *
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
* @param row row location of entry to be set
* @param column column location of entry to be set
* @param value value to set
- * @throws org.apache.commons.math.linear.MatrixIndexException if the
- * specified coordinate is outside the dimensions of this matrix
+ * @throws MatrixIndexException if the row or column index is not valid
* @throws NumberFormatException if <code>value</code> is not a valid
* representation of a <code>BigDecimal</code> value
*/
1.21 +30 -14 jakarta-commons/math/src/java/org/apache/commons/math/linear/RealMatrix.java
Index: RealMatrix.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/RealMatrix.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- RealMatrix.java 22 Aug 2004 01:42:58 -0000 1.20
+++ RealMatrix.java 1 Sep 2004 21:26:11 -0000 1.21
@@ -107,43 +107,59 @@
/**
* Returns the entries in row number <code>row</code> as an array.
+ * <p>
+ * Row indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < row <= rowDimension.</code>
*
* @param row the row to be fetched
* @return array of entries in the row
- * @throws MatrixIndexException if the specified row is greater
- * than the number of rows in this matrix
+ * @throws MatrixIndexException if the specified row index is not valid
*/
double[] getRow(int row) throws MatrixIndexException;
/**
* Returns the entries in column number <code>col</code> as an array.
+ * <p>
+ * Column indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < column <= columnDimension.</code>
*
- * @param col column to fetch
+ * @param col the column to be fetched
* @return array of entries in the column
- * @throws MatrixIndexException if the specified column is greater
- * than the number of columns in this matrix
+ * @throws MatrixIndexException if the specified column index is not valid
*/
double[] getColumn(int col) throws MatrixIndexException;
/**
* Returns the entry in the specified row and column.
- *
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
* @param row row location of entry to be fetched
* @param column column location of entry to be fetched
* @return matrix entry in row,column
- * @throws MatrixIndexException if the specified coordinate is outside
- * the dimensions of this matrix
+ * @throws MatrixIndexException if the row or column index is not valid
*/
double getEntry(int row, int column) throws MatrixIndexException;
/**
* Sets the entry in the specified row and column to the specified value.
- *
- * @param row row location of entry to be set
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
+ * @param row row location of entry to be set
* @param column column location of entry to be set
- * @param value value to set
- * @throws MatrixIndexException if the specified coordinate is outside
- * he dimensions of this matrix
+ * @param value value to set
+ * @throws MatrixIndexException if the row or column index is not valid
*/
void setEntry(int row, int column, double value)
throws MatrixIndexException;
1.27 +31 -15 jakarta-commons/math/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
Index: RealMatrixImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/RealMatrixImpl.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- RealMatrixImpl.java 22 Aug 2004 01:42:58 -0000 1.26
+++ RealMatrixImpl.java 1 Sep 2004 21:26:11 -0000 1.27
@@ -303,13 +303,15 @@
return maxColSum;
}
- /**
+ /**
* Returns the entries in row number <code>row</code> as an array.
+ * <p>
+ * Row indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < row <= rowDimension.</code>
*
* @param row the row to be fetched
* @return array of entries in the row
- * @throws MatrixIndexException if the specified row is greater
- * than the number of rows in this matrix
+ * @throws MatrixIndexException if the specified row index is not valid
*/
public double[] getRow(int row) throws MatrixIndexException {
if ( !isValidCoordinate( row, 1 ) ) {
@@ -323,11 +325,13 @@
/**
* Returns the entries in column number <code>col</code> as an array.
+ * <p>
+ * Column indices start at 1. A <code>MatrixIndexException</code> is thrown
+ * unless <code>0 < column <= columnDimension.</code>
*
- * @param col column to fetch
+ * @param col the column to be fetched
* @return array of entries in the column
- * @throws MatrixIndexException if the specified column is greater
- * than the number of columns in this matrix
+ * @throws MatrixIndexException if the specified column index is not valid
*/
public double[] getColumn(int col) throws MatrixIndexException {
if ( !isValidCoordinate(1, col) ) {
@@ -343,12 +347,18 @@
/**
* Returns the entry in the specified row and column.
- *
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
* @param row row location of entry to be fetched
* @param column column location of entry to be fetched
* @return matrix entry in row,column
- * @throws MatrixIndexException if the specified coordinate is outside
- * the dimensions of this matrix
+ * @throws MatrixIndexException if the row or column index is not valid
*/
public double getEntry(int row, int column)
throws MatrixIndexException {
@@ -360,12 +370,18 @@
/**
* Sets the entry in the specified row and column to the specified value.
- *
- * @param row row location of entry to be set
+ * <p>
+ * Row and column indices start at 1 and must satisfy
+ * <ul>
+ * <li><code>0 < row <= rowDimension</code></li>
+ * <li><code> 0 < column <= columnDimension</code></li>
+ * </ul>
+ * otherwise a <code>MatrixIndexException</code> is thrown.
+ *
+ * @param row row location of entry to be set
* @param column column location of entry to be set
- * @param value value to set
- * @throws MatrixIndexException if the specified coordinate is outside
- * he dimensions of this matrix
+ * @param value value to set
+ * @throws MatrixIndexException if the row or column index is not valid
*/
public void setEntry(int row, int column, double value)
throws MatrixIndexException {
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org