Made standard matrix entry addressing explicit in javadoc.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-09-01 21:26:11 +00:00
parent 411c6c9b2a
commit b39b6c7075
4 changed files with 198 additions and 86 deletions

View File

@ -22,7 +22,7 @@ import java.math.BigDecimal;
* Interface defining a real-valued matrix with basic algebraic operations, using
* BigDecimal representations for the entries.
*
* @version $Revision: 1.5 $ $Date: 2004/08/22 01:42:58 $
* @version $Revision: 1.6 $ $Date: 2004/09/01 21:26:11 $
*/
public interface BigMatrix {
@ -150,88 +150,122 @@ public interface BigMatrix {
/**
* 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.
* <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, double value)
throws MatrixIndexException;
@ -239,12 +273,19 @@ public interface BigMatrix {
/**
* 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
*/

View File

@ -39,7 +39,7 @@ import java.math.BigDecimal;
* explicitly invoke <code>LUDecompose()</code> to recompute the decomposition
* before using any of the methods above.
*
* @version $Revision: 1.4 $ $Date: 2004/08/22 01:42:58 $
* @version $Revision: 1.5 $ $Date: 2004/09/01 21:26:11 $
*/
public class BigMatrixImpl implements BigMatrix, Serializable {
@ -427,11 +427,13 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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 ) ) {
@ -446,11 +448,13 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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 ) ) {
@ -466,11 +470,13 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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 ) ) {
@ -507,12 +515,18 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
}
/**
* 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 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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,12 +582,18 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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 the dimensions of this matrix
* @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));
@ -569,12 +602,18 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
/**
* 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
*/

View File

@ -18,7 +18,7 @@ package org.apache.commons.math.linear;
/**
* Interface defining a real-valued matrix with basic algebraic operations
* @version $Revision: 1.20 $ $Date: 2004/08/22 01:42:58 $
* @version $Revision: 1.21 $ $Date: 2004/09/01 21:26:11 $
*/
public interface RealMatrix {
@ -107,43 +107,59 @@ public interface RealMatrix {
/**
* 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.
* <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
*/
void setEntry(int row, int column, double value)
throws MatrixIndexException;

View File

@ -38,7 +38,7 @@ import java.io.Serializable;
* explicitly invoke <code>LUDecompose()</code> to recompute the decomposition
* before using any of the methods above.
*
* @version $Revision: 1.26 $ $Date: 2004/08/22 01:42:58 $
* @version $Revision: 1.27 $ $Date: 2004/09/01 21:26:11 $
*/
public class RealMatrixImpl implements RealMatrix, Serializable {
@ -305,11 +305,13 @@ public class RealMatrixImpl implements RealMatrix, Serializable {
/**
* 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 @@ public class RealMatrixImpl implements RealMatrix, Serializable {
/**
* 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 @@ public class RealMatrixImpl implements RealMatrix, Serializable {
/**
* 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 @@ public class RealMatrixImpl implements RealMatrix, Serializable {
/**
* 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, double value)
throws MatrixIndexException {