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/04/04 00:18:04 UTC

cvs commit: jakarta-commons/math/src/java/org/apache/commons/math/linear RealMatrix.java RealMatrixImpl.java

psteitz     2004/04/03 14:18:04

  Modified:    math/src/java/org/apache/commons/math/linear RealMatrix.java
                        RealMatrixImpl.java
  Log:
  Javadoc fixes, advertise correct exception in inverse().
  
  Revision  Changes    Path
  1.13      +3 -3      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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RealMatrix.java	18 Feb 2004 03:24:19 -0000	1.12
  +++ RealMatrix.java	3 Apr 2004 22:18:04 -0000	1.13
  @@ -160,9 +160,9 @@
        * Returns the inverse of this matrix.
        *
        * @return inverse matrix
  -     * @throws IllegalArgumentException if *this is not invertible
  +     * @throws InvalidMatrixException if  this is not invertible
        */
  -    RealMatrix inverse() throws IllegalArgumentException;
  +    RealMatrix inverse() throws InvalidMatrixException;
       
       /**
        * Returns the determinant of this matrix.
  
  
  
  1.15      +9 -7      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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RealMatrixImpl.java	18 Feb 2004 03:24:19 -0000	1.14
  +++ RealMatrixImpl.java	3 Apr 2004 22:18:04 -0000	1.15
  @@ -377,7 +377,8 @@
   	}
   
   	/**
  -	 *
  +	 * Returns the transpose matrix.
  +     *
   	 * @return transpose matrix
   	 */
   	public RealMatrix transpose() {
  @@ -394,10 +395,12 @@
   	}
   
   	/**
  +     * Returns the inverse matrix if this matrix is invertible.
  +     * 
   	 * @return inverse matrix
  -	 * @throws IllegalArgumentException if this is not invertible
  +	 * @throws InvalidMatrixException if this is not invertible
   	 */
  -	public RealMatrix inverse() throws IllegalArgumentException {
  +	public RealMatrix inverse() throws InvalidMatrixException {
   		return solve(getIdentity(this.getRowDimension()));
   	}
   
  @@ -409,8 +412,8 @@
   		if (!isSquare()) {
   			throw new InvalidMatrixException("matrix is not square");
   		}
  -		if (isSingular()) { // note: this has side effect of attempting LU
  -			return 0d; //       decomp if lu == null
  +		if (isSingular()) {   // note: this has side effect of attempting LU decomp if lu == null
  +			return 0d;  
   		} else {
   			double det = (double) parity;
   			for (int i = 0; i < this.getRowDimension(); i++) {
  @@ -431,7 +434,6 @@
   	 * @return true if the matrix is singular
   	 */
   	public boolean isSingular() {
  -		// @TODO A bad way to check for a singular matrix, is this the only way - kick off an LU decompose?
   		if (lu == null) {
   			try {
   				LUDecompose();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org