|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Matrix represents a structurally immutable matrix of numbers(double) with index begining at 1.
The only way to change the elements in a matrix is through set(int, int, double)
A good convention to follow is to use row=1;row<=rows();row++(col=1;col<=cols();coll++)
as indices while looping over matrix elements.
And use the normal i,j,k
etc. to iterate over arrays!
Author: purangp
Date: 07.03.2004 Time: 15:52:02
Method Summary | |
int |
cols()
Gets the number of columns in the matrix counts from 1 |
double[][] |
get()
Gets a copy of the elements as a 2D array. |
double |
get(int row,
int col)
Gets the value of the element at the given row and column |
Matrix |
getColumn(int col)
Gets the entire column as a matrix |
Matrix |
getRow(int row)
Gets the entire row as a matrix |
Matrix |
getSubMatrix(int[] r,
int[] c)
Get a submatrix. |
Matrix |
getSubMatrix(int[] r,
int colI,
int colF)
Get a submatrix. |
Matrix |
getSubMatrix(int rowI,
int rowF,
int[] c)
Get a submatrix. |
Matrix |
getSubMatrix(int rowI,
int colI,
int rowF,
int colF)
Get a submatrix. |
int |
rows()
Gets the number of rows in the matrix Counts from 1 |
void |
set(int row,
int col,
double value)
Sets an element at the given position to a new value |
Method Detail |
public int rows()
public int cols()
public void set(int row, int col, double value)
row
- row in which the element occurscol
- column in which the element occursvalue
- the new value to be setpublic double get(int row, int col)
row
- row in which the element occurscol
- column in which the element occurs
public Matrix getRow(int row)
row
- row asked for
public Matrix getColumn(int col)
col
- column asked for
public double[][] get()
public Matrix getSubMatrix(int rowI, int colI, int rowF, int colF)
rowI
- Initial row indexcolI
- Initial column indexrowF
- Final row indexcolF
- Final column index
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic Matrix getSubMatrix(int[] r, int[] c)
r
- Array of row indices.c
- Array of column indices.
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic Matrix getSubMatrix(int rowI, int rowF, int[] c)
rowI
- Initial row indexrowF
- Final row indexc
- Array of column indices.
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic Matrix getSubMatrix(int[] r, int colI, int colF)
r
- Array of row indices.colI
- Initial column indexcolF
- Final column index
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indices
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |