~ubuntu-branches/ubuntu/quantal/commons-math/quantal

« back to all changes in this revision

Viewing changes to src/main/java/org/apache/commons/math/linear/RealMatrix.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2010-04-05 23:33:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100405233302-gpqlceked76nw28a
Tags: 2.1-1
* New upstream release.
* Bump Standards-Version to 3.8.4: no changes needed
* Bump debhelper to >= 7
* Switch to 3.0 (quilt) source format:
  - Remove B-D on quilt
  - Add d/source/format
  - Remove d/README.source

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * <p>
24
24
 * Matrix element indexing is 0-based -- e.g., <code>getEntry(0, 0)</code>
25
25
 * returns the element in the first row, first column of the matrix.</p>
26
 
 * 
27
 
 * @version $Revision: 799906 $ $Date: 2009-08-01 15:01:59 -0400 (Sat, 01 Aug 2009) $
 
26
 *
 
27
 * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $
28
28
 */
29
29
public interface RealMatrix extends AnyMatrix {
30
30
 
98
98
     * @throws     IllegalArgumentException
99
99
     *             if rowDimension(this) != columnDimension(m)
100
100
     */
101
 
    public RealMatrix preMultiply(RealMatrix m) throws IllegalArgumentException;
 
101
    RealMatrix preMultiply(RealMatrix m) throws IllegalArgumentException;
102
102
 
103
103
    /**
104
104
     * Returns matrix entries as a two-dimensional array.
114
114
     * @return norm
115
115
     */
116
116
    double getNorm();
117
 
    
 
117
 
118
118
    /**
119
119
     * Returns the <a href="http://mathworld.wolfram.com/FrobeniusNorm.html">
120
120
     * Frobenius norm</a> of the matrix.
122
122
     * @return norm
123
123
     */
124
124
    double getFrobeniusNorm();
125
 
    
 
125
 
126
126
    /**
127
127
     * Gets a submatrix. Rows and columns are indicated
128
128
     * counting from 0 to n-1.
137
137
     */
138
138
   RealMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn)
139
139
       throws MatrixIndexException;
140
 
   
 
140
 
141
141
   /**
142
142
    * Gets a submatrix. Rows and columns are indicated
143
143
    * counting from 0 to n-1.
167
167
  void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
168
168
                     double[][] destination)
169
169
      throws MatrixIndexException, IllegalArgumentException;
170
 
  
 
170
 
171
171
  /**
172
172
   * Copy a submatrix. Rows and columns are indicated
173
173
   * counting from 0 to n-1.
181
181
   */
182
182
  void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination)
183
183
      throws MatrixIndexException, IllegalArgumentException;
184
 
 
 
184
 
185
185
   /**
186
186
    * Replace the submatrix starting at <code>row, column</code> using data in
187
187
    * the input <code>subMatrix</code> array. Indexes are 0-based.
188
 
    * <p> 
 
188
    * <p>
189
189
    * Example:<br>
190
190
    * Starting with <pre>
191
191
    * 1  2  3  4
192
192
    * 5  6  7  8
193
193
    * 9  0  1  2
194
194
    * </pre>
195
 
    * and <code>subMatrix = {{3, 4} {5,6}}</code>, invoking 
 
195
    * and <code>subMatrix = {{3, 4} {5,6}}</code>, invoking
196
196
    * <code>setSubMatrix(subMatrix,1,1))</code> will result in <pre>
197
197
    * 1  2  3  4
198
198
    * 5  3  4  8
199
199
    * 9  5  6  2
200
200
    * </pre></p>
201
 
    * 
 
201
    *
202
202
    * @param subMatrix  array containing the submatrix replacement data
203
203
    * @param row  row coordinate of the top, left element to be replaced
204
204
    * @param column  column coordinate of the top, left element to be replaced
205
 
    * @throws MatrixIndexException  if subMatrix does not fit into this 
206
 
    *    matrix from element in (row, column) 
 
205
    * @throws MatrixIndexException  if subMatrix does not fit into this
 
206
    *    matrix from element in (row, column)
207
207
    * @throws IllegalArgumentException if <code>subMatrix</code> is not rectangular
208
208
    *  (not all rows have the same length) or empty
209
209
    * @throws NullPointerException if <code>subMatrix</code> is null
210
210
    * @since 2.0
211
211
    */
212
 
   void setSubMatrix(double[][] subMatrix, int row, int column) 
 
212
   void setSubMatrix(double[][] subMatrix, int row, int column)
213
213
       throws MatrixIndexException;
214
214
 
215
215
   /**
221
221
    * @throws MatrixIndexException if the specified row index is invalid
222
222
    */
223
223
   RealMatrix getRowMatrix(int row) throws MatrixIndexException;
224
 
   
 
224
 
225
225
   /**
226
226
    * Sets the entries in row number <code>row</code>
227
227
    * as a row matrix.  Row indices start at 0.
235
235
    */
236
236
   void setRowMatrix(int row, RealMatrix matrix)
237
237
       throws MatrixIndexException, InvalidMatrixException;
238
 
   
 
238
 
239
239
   /**
240
240
    * Returns the entries in column number <code>column</code>
241
241
    * as a column matrix.  Column indices start at 0.
259
259
    */
260
260
   void setColumnMatrix(int column, RealMatrix matrix)
261
261
       throws MatrixIndexException, InvalidMatrixException;
262
 
   
 
262
 
263
263
   /**
264
264
    * Returns the entries in row number <code>row</code>
265
265
    * as a vector.  Row indices start at 0.
283
283
    */
284
284
   void setRowVector(int row, RealVector vector)
285
285
       throws MatrixIndexException, InvalidMatrixException;
286
 
   
 
286
 
287
287
   /**
288
288
    * Returns the entries in column number <code>column</code>
289
289
    * as a vector.  Column indices start at 0.
306
306
    */
307
307
   void setColumnVector(int column, RealVector vector)
308
308
       throws MatrixIndexException, InvalidMatrixException;
309
 
   
 
309
 
310
310
    /**
311
311
     * Returns the entries in row number <code>row</code> as an array.
312
312
     * <p>
331
331
     */
332
332
    void setRow(int row, double[] array)
333
333
        throws MatrixIndexException, InvalidMatrixException;
334
 
    
 
334
 
335
335
    /**
336
336
     * Returns the entries in column number <code>col</code> as an array.
337
337
     * <p>
356
356
     */
357
357
    void setColumn(int column, double[] array)
358
358
        throws MatrixIndexException, InvalidMatrixException;
359
 
    
 
359
 
360
360
    /**
361
361
     * Returns the entry in the specified row and column.
362
362
     * <p>
363
 
     * Row and column indices start at 0 and must satisfy 
 
363
     * Row and column indices start at 0 and must satisfy
364
364
     * <ul>
365
365
     * <li><code>0 <= row < rowDimension</code></li>
366
366
     * <li><code> 0 <= column < columnDimension</code></li>
367
367
     * </ul>
368
368
     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
369
 
     * 
 
369
     *
370
370
     * @param row  row location of entry to be fetched
371
371
     * @param column  column location of entry to be fetched
372
372
     * @return matrix entry in row,column
377
377
    /**
378
378
     * Set the entry in the specified row and column.
379
379
     * <p>
380
 
     * Row and column indices start at 0 and must satisfy 
 
380
     * Row and column indices start at 0 and must satisfy
381
381
     * <ul>
382
382
     * <li><code>0 <= row < rowDimension</code></li>
383
383
     * <li><code> 0 <= column < columnDimension</code></li>
384
384
     * </ul>
385
385
     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
386
 
     * 
 
386
     *
387
387
     * @param row  row location of entry to be set
388
388
     * @param column  column location of entry to be set
389
389
     * @param value matrix entry to be set in row,column
395
395
    /**
396
396
     * Change an entry in the specified row and column.
397
397
     * <p>
398
 
     * Row and column indices start at 0 and must satisfy 
 
398
     * Row and column indices start at 0 and must satisfy
399
399
     * <ul>
400
400
     * <li><code>0 <= row < rowDimension</code></li>
401
401
     * <li><code> 0 <= column < columnDimension</code></li>
402
402
     * </ul>
403
403
     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
404
 
     * 
 
404
     *
405
405
     * @param row  row location of entry to be set
406
406
     * @param column  column location of entry to be set
407
407
     * @param increment value to add to the current matrix entry in row,column
413
413
    /**
414
414
     * Change an entry in the specified row and column.
415
415
     * <p>
416
 
     * Row and column indices start at 0 and must satisfy 
 
416
     * Row and column indices start at 0 and must satisfy
417
417
     * <ul>
418
418
     * <li><code>0 <= row < rowDimension</code></li>
419
419
     * <li><code> 0 <= column < columnDimension</code></li>
420
420
     * </ul>
421
421
     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
422
 
     * 
 
422
     *
423
423
     * @param row  row location of entry to be set
424
424
     * @param column  column location of entry to be set
425
425
     * @param factor multiplication factor for the current matrix entry in row,column