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/06/07 05:26:32 UTC

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

psteitz     2004/06/06 20:26:32

  Modified:    math/src/java/org/apache/commons/math/linear
                        InvalidMatrixException.java
                        MatrixIndexException.java RealMatrix.java
                        RealMatrixImpl.java package.html
  Log:
  Formatting only, Eliminated tabs and trailing spaces.
  
  Revision  Changes    Path
  1.6       +8 -8      jakarta-commons/math/src/java/org/apache/commons/math/linear/InvalidMatrixException.java
  
  Index: InvalidMatrixException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/InvalidMatrixException.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- InvalidMatrixException.java	2 Jun 2004 00:06:18 -0000	1.5
  +++ InvalidMatrixException.java	7 Jun 2004 03:26:31 -0000	1.6
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -25,20 +25,20 @@
    * @version $Revision$ $Date$
    */
   public class InvalidMatrixException extends NestableRuntimeException {
  -    
  +
       /** Serializable version identifier */
       static final long serialVersionUID = 5318837237354354107L;
  -    
  +
       /**
        * Default constructor.
        */
       public InvalidMatrixException() {
           this(null, null);
       }
  -    
  +
       /**
        * Construct an exception with the given message.
  -     * @param message descriptive error message. 
  +     * @param message descriptive error message.
        */
       public InvalidMatrixException(String message) {
           this(message, null);
  
  
  
  1.6       +8 -8      jakarta-commons/math/src/java/org/apache/commons/math/linear/MatrixIndexException.java
  
  Index: MatrixIndexException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/MatrixIndexException.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MatrixIndexException.java	2 Jun 2004 00:06:18 -0000	1.5
  +++ MatrixIndexException.java	7 Jun 2004 03:26:31 -0000	1.6
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -24,20 +24,20 @@
    * @version $Revision$ $Date$
    */
   public class MatrixIndexException extends NestableRuntimeException {
  -    
  +
       /** Serializable version identifier */
       static final long serialVersionUID = -1341109412864309526L;
  -    
  +
       /**
        * Default constructor.
        */
       public MatrixIndexException() {
           this(null, null);
       }
  -    
  +
       /**
        * Construct an exception with the given message.
  -     * @param message descriptive error message. 
  +     * @param message descriptive error message.
        */
       public MatrixIndexException(String message) {
           this(message, null);
  
  
  
  1.19      +41 -41    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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RealMatrix.java	5 Jun 2004 22:28:10 -0000	1.18
  +++ RealMatrix.java	7 Jun 2004 03:26:31 -0000	1.19
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2003-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -28,7 +28,7 @@
        * @return matrix copy
        */
       RealMatrix copy();
  -    
  +
       /**
        * Compute the sum of this and m.
        *
  @@ -36,8 +36,8 @@
        * @return     this + m
        * @throws  IllegalArgumentException if m is not the same size as this
        */
  -    RealMatrix add(RealMatrix m) throws IllegalArgumentException;   
  -    
  +    RealMatrix add(RealMatrix m) throws IllegalArgumentException;
  +
       /**
        * Compute this minus m.
        *
  @@ -45,8 +45,8 @@
        * @return     this + m
        * @throws  IllegalArgumentException if m is not the same size as this
        */
  -    RealMatrix subtract(RealMatrix m) throws IllegalArgumentException;   
  -    
  +    RealMatrix subtract(RealMatrix m) throws IllegalArgumentException;
  +
        /**
        * Returns the result of adding d to each entry of this.
        *
  @@ -54,7 +54,7 @@
        * @return     d + this
        */
       RealMatrix scalarAdd(double d);
  -    
  +
       /**
        * Returns the result multiplying each entry of this by d.
        *
  @@ -62,17 +62,17 @@
        * @return     d * this
        */
       RealMatrix scalarMultiply(double d);
  -    
  +
       /**
        * Returns the result postmultiplying this by m.
        *
        * @param m    matrix to postmultiply by
        * @return     this * m
  -     * @throws     IllegalArgumentException 
  +     * @throws     IllegalArgumentException
        *             if columnDimension(this) != rowDimension(m)
        */
       RealMatrix multiply(RealMatrix m) throws IllegalArgumentException;
  -    
  +
       /**
        * Returns the result premultiplying this by <code>m</code>.
        * @param m    matrix to premultiply by
  @@ -81,14 +81,14 @@
        *             if rowDimension(this) != columnDimension(m)
        */
       public RealMatrix preMultiply(RealMatrix m) throws IllegalArgumentException;
  -    
  +
       /**
        * Returns matrix entries as a two-dimensional array.
        *
        * @return    2-dimensional array of entries
        */
       double[][] getData();
  -    
  +
       /**
        * Overwrites the underlying data for the matrix with
        * a fresh copy of <code>data</code>.
  @@ -96,7 +96,7 @@
        * @param  data  2-dimensional array of entries
        */
       void setData(double[][] data);
  -    
  +
       /**
        * Returns the <a href="http://mathworld.wolfram.com/MaximumAbsoluteRowSumNorm.html">
        * maximum absolute row sum norm</a> of the matrix.
  @@ -104,17 +104,17 @@
        * @return norm
        */
       double getNorm();
  -    
  +
       /**
        * Returns the entries in row number <code>row</code> as an array.
        *
        * @param row the row to be fetched
        * @return array of entries in the row
  -     * @throws MatrixIndexException if the specified row is greater 
  +     * @throws MatrixIndexException if the specified row is greater
        *                              than the number of rows in this matrix
        */
       double[] getRow(int row) throws MatrixIndexException;
  -    
  +
       /**
        * Returns the entries in column number <code>col</code> as an array.
        *
  @@ -124,37 +124,37 @@
        *                              than the number of columns in this matrix
        */
       double[] getColumn(int col) throws MatrixIndexException;
  -    
  +
       /**
        * Returns the entry in the specified row and column.
        *
  -     * @param row  row location of entry to be fetched  
  +     * @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 
  +     * @throws MatrixIndexException if the specified coordinate is outside
        *                              the dimensions of this matrix
        */
       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 
  +     * @param row    row location of entry to be set
        * @param column    column location of entry to be set
  -     * @param value  value to set 
  +     * @param value  value to set
        * @throws MatrixIndexException if the specified coordinate is outside
        *                              he dimensions of this matrix
        */
  -    void setEntry(int row, int column, double value) 
  +    void setEntry(int row, int column, double value)
           throws MatrixIndexException;
  -    
  +
       /**
        * Returns the transpose of this matrix.
        *
        * @return transpose matrix
        */
       RealMatrix transpose();
  -    
  +
       /**
        * Returns the inverse of this matrix.
        *
  @@ -162,40 +162,40 @@
        * @throws InvalidMatrixException if  this is not invertible
        */
       RealMatrix inverse() throws InvalidMatrixException;
  -    
  +
       /**
        * Returns the determinant of this matrix.
        *
        * @return determinant
        */
       double getDeterminant();
  -    
  +
       /**
        * Is this a square matrix?
        * @return true if the matrix is square (rowDimension = columnDimension)
        */
       boolean isSquare();
  -    
  +
       /**
        * Is this a singular matrix?
        * @return true if the matrix is singular
        */
       boolean isSingular();
  -    
  +
       /**
        * Returns the number of rows in the matrix.
        *
        * @return rowDimension
        */
       int getRowDimension();
  -    
  +
       /**
        * Returns the number of columns in the matrix.
        *
        * @return columnDimension
        */
       int getColumnDimension();
  -    
  +
       /**
        * Returns the <a href="http://mathworld.wolfram.com/MatrixTrace.html">
        * trace</a> of the matrix (the sum of the elements on the main diagonal).
  @@ -203,7 +203,7 @@
        * @return trace
        */
       double getTrace();
  -    
  +
       /**
        * Returns the result of multiplying this by the vector <code>v</code>.
        *
  @@ -212,7 +212,7 @@
        * @throws IllegalArgumentException if columnDimension != v.size()
        */
       double[] operate(double[] v) throws IllegalArgumentException;
  -    
  +
       /**
        * Returns the (row) vector result of premultiplying this by the vector <code>v</code>.
        *
  @@ -220,23 +220,23 @@
        * @return v*this
        * @throws IllegalArgumentException if rowDimension != v.size()
        */
  -    double[] preMultiply(double[] v) throws IllegalArgumentException;  
  -    
  +    double[] preMultiply(double[] v) throws IllegalArgumentException;
  +
       /**
        * Returns the solution vector for a linear system with coefficient
        * matrix = this and constant vector = <code>b</code>.
        *
        * @param b  constant vector
        * @return vector of solution values to AX = b, where A is *this
  -     * @throws IllegalArgumentException if this.rowDimension != b.length 
  +     * @throws IllegalArgumentException if this.rowDimension != b.length
        * @throws InvalidMatrixException if this matrix is not square or is singular
        */
       double[] solve(double[] b) throws IllegalArgumentException, InvalidMatrixException;
  -    
  +
       /**
        * Returns a matrix of (column) solution vectors for linear systems with
        * coefficient matrix = this and constant vectors = columns of
  -     * <code>b</code>. 
  +     * <code>b</code>.
        *
        * @param b  matrix of constant vectors forming RHS of linear systems to
        * to solve
  
  
  
  1.24      +42 -42    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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- RealMatrixImpl.java	5 Jun 2004 22:31:16 -0000	1.23
  +++ RealMatrixImpl.java	7 Jun 2004 03:26:31 -0000	1.24
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2003-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -20,7 +20,7 @@
   /**
    * Implementation for RealMatrix using a double[][] array to store entries
    * and <a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf">
  - * LU decompostion</a> to support linear system 
  + * LU decompostion</a> to support linear system
    * solution and inverse.
    * <p>
    * The LU decompostion is performed as needed, to support the following operations: <ul>
  @@ -31,10 +31,10 @@
    * <p>
    * <strong>Usage note</strong>:<br>
    * The LU decomposition is stored and reused on subsequent calls.  If matrix
  - * data are modified using any of the public setXxx methods, the saved 
  + * data are modified using any of the public setXxx methods, the saved
    * decomposition is discarded.  If data are modified via references to the
    * underlying array obtained using <code>getDataRef()</code>, then the stored
  - * LU decomposition will not be discarded.  In this case, you need to 
  + * LU decomposition will not be discarded.  In this case, you need to
    * explicitly invoke <code>LUDecompose()</code> to recompute the decomposition
    * before using any of the methods above.
    *
  @@ -44,7 +44,7 @@
   
       /** Serializable version identifier */
       static final long serialVersionUID = 4237564493130426188L;
  -    
  +
       /** Entries of the matrix */
       private double data[][] = null;
   
  @@ -62,7 +62,7 @@
       /** Bound to determine effective singularity in LU decomposition */
       protected static double TOO_SMALL = 10E-12;
   
  -    /** 
  +    /**
        * Creates a matrix with no data
        */
       public RealMatrixImpl() {
  @@ -93,8 +93,8 @@
       }
   
       /**
  -     * Create a new (column) RealMatrix using <code>v</code> as the 
  -     * data for the unique column of the <code>v.length x 1</code> matrix 
  +     * Create a new (column) RealMatrix using <code>v</code> as the
  +     * data for the unique column of the <code>v.length x 1</code> matrix
        * created.
        * <p>
        * The input array is copied, not referenced.
  @@ -229,7 +229,7 @@
           }
           return new RealMatrixImpl(outData);
       }
  -    
  +
       /**
        * Returns the result premultiplying this by <code>m</code>.
        * @param m    matrix to premultiply by
  @@ -308,7 +308,7 @@
        *
        * @param row the row to be fetched
        * @return array of entries in the row
  -     * @throws MatrixIndexException if the specified row is greater 
  +     * @throws MatrixIndexException if the specified row is greater
        *                              than the number of rows in this matrix
        */
       public double[] getRow(int row) throws MatrixIndexException {
  @@ -344,10 +344,10 @@
       /**
        * Returns the entry in the specified row and column.
        *
  -     * @param row  row location of entry to be fetched  
  +     * @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 
  +     * @throws MatrixIndexException if the specified coordinate is outside
        *                              the dimensions of this matrix
        */
       public double getEntry(int row, int column)
  @@ -361,9 +361,9 @@
       /**
        * Sets the entry in the specified row and column to the specified value.
        *
  -     * @param row    row location of entry to be set 
  +     * @param row    row location of entry to be set
        * @param column    column location of entry to be set
  -     * @param value  value to set 
  +     * @param value  value to set
        * @throws MatrixIndexException if the specified coordinate is outside
        *                              he dimensions of this matrix
        */
  @@ -396,7 +396,7 @@
   
       /**
        * Returns the inverse matrix if this matrix is invertible.
  -     * 
  +     *
        * @return inverse matrix
        * @throws InvalidMatrixException if this is not invertible
        */
  @@ -413,7 +413,7 @@
               throw new InvalidMatrixException("matrix is not square");
           }
           if (isSingular()) {   // note: this has side effect of attempting LU decomp if lu == null
  -            return 0d;  
  +            return 0d;
           } else {
               double det = (double) parity;
               for (int i = 0; i < this.getRowDimension(); i++) {
  @@ -422,7 +422,7 @@
               return det;
           }
       }
  -    
  +
       /**
        * @return true if the matrix is square (rowDimension = columnDimension)
        */
  @@ -522,7 +522,7 @@
       /**
        * Returns a matrix of (column) solution vectors for linear systems with
        * coefficient matrix = this and constant vectors = columns of
  -     * <code>b</code>. 
  +     * <code>b</code>.
        *
        * @param b  array of constant forming RHS of linear systems to
        * to solve
  @@ -547,7 +547,7 @@
       /**
        * Returns a matrix of (column) solution vectors for linear systems with
        * coefficient matrix = this and constant vectors = columns of
  -     * <code>b</code>. 
  +     * <code>b</code>.
        *
        * @param b  matrix of constant vectors forming RHS of linear systems to
        * to solve
  @@ -606,9 +606,9 @@
       }
   
       /**
  -     * Computes a new 
  +     * Computes a new
        * <a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf">
  -     * LU decompostion</a> for this matrix, storing the result for use by other methods. 
  +     * LU decompostion</a> for this matrix, storing the result for use by other methods.
        * <p>
        * <strong>Implementation Note</strong>:<br>
        * Uses <a href="http://www.damtp.cam.ac.uk/user/fdl/people/sd/lectures/nummeth98/linear.htm">
  @@ -624,7 +624,7 @@
        * @throws InvalidMatrixException if the matrix is non-square or singular.
        */
       public void luDecompose() throws InvalidMatrixException {
  -         
  +
           int nRows = this.getRowDimension();
           int nCols = this.getColumnDimension();
           if (nRows != nCols) {
  @@ -698,7 +698,7 @@
       }
   
       /**
  -     * 
  +     *
        * @see java.lang.Object#toString()
        */
       public String toString() {
  @@ -737,31 +737,31 @@
           }
           return out;
       }
  -    
  +
       /**
        *  Returns the LU decomposition as a RealMatrix.
  -     *  Returns a fresh copy of the cached LU matrix if this has been computed; 
  -     *  otherwise the composition is computed and cached for use by other methods.   
  -     *  Since a copy is returned in either case, changes to the returned matrix do not 
  -     *  affect the LU decomposition property. 
  +     *  Returns a fresh copy of the cached LU matrix if this has been computed;
  +     *  otherwise the composition is computed and cached for use by other methods.
  +     *  Since a copy is returned in either case, changes to the returned matrix do not
  +     *  affect the LU decomposition property.
        * <p>
  -     * The matrix returned is a compact representation of the LU decomposition. 
  -     * Elements below the main diagonal correspond to entries of the "L" matrix;   
  +     * The matrix returned is a compact representation of the LU decomposition.
  +     * Elements below the main diagonal correspond to entries of the "L" matrix;
        * elements on and above the main diagonal correspond to entries of the "U"
        * matrix.
        * <p>
        * Example: <pre>
  -     * 
  +     *
        *     Returned matrix                L                  U
  -     *         2  3  1                   1  0  0            2  3  1          
  +     *         2  3  1                   1  0  0            2  3  1
        *         5  4  6                   5  1  0            0  4  6
  -     *         1  7  8                   1  7  1            0  0  8          
  +     *         1  7  8                   1  7  1            0  0  8
        * </pre>
  -     * 
  +     *
        * The L and U matrices satisfy the matrix equation LU = permuteRows(this), <br>
        *  where permuteRows reorders the rows of the matrix to follow the order determined
        *  by the <a href=#getPermutation()>permutation</a> property.
  -     * 
  +     *
        * @return LU decomposition matrix
        * @throws InvalidMatrixException if the matrix is non-square or singular.
        */
  @@ -769,9 +769,9 @@
           if (lu == null) {
               luDecompose();
           }
  -        return new RealMatrixImpl(lu);   
  +        return new RealMatrixImpl(lu);
       }
  -    
  +
       /**
        * Returns the permutation associated with the lu decomposition.
        * The entries of the array represent a permutation of the numbers 0, ... , nRows - 1.
  @@ -781,7 +781,7 @@
        * and current first row is last.
        * <p>
        * Returns a fresh copy of the array.
  -     * 
  +     *
        * @return the permutation
        */
       protected int[] getPermutation() {
  @@ -836,5 +836,5 @@
   
           return !(row < 1 || row > nRows || col < 1 || col > nCols);
       }
  -    
  +
   }
  
  
  
  1.6       +2 -2      jakarta-commons/math/src/java/org/apache/commons/math/linear/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/package.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- package.html	26 Apr 2004 18:28:17 -0000	1.5
  +++ package.html	7 Jun 2004 03:26:31 -0000	1.6
  @@ -14,6 +14,6 @@
      See the License for the specific language governing permissions and
      limitations under the License.
     -->
  -	<!-- $Revision$ $Date$ -->
  -	<body>Linear algebra support.</body>
  +    <!-- $Revision$ $Date$ -->
  +    <body>Linear algebra support.</body>
   </html>
  
  
  

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