|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Matrix
Two-dimensional matrix interface class for doubles.
Matrix elements are assumed to be doubles, but this class imposes no specific structure as to how the doubles are stored. Only operations to get and set elements in the matrix are defined here. All other matrix operations are handled by methods in other classes which take Matrix types as arguments.
Method Summary | |
---|---|
int |
columns()
Get number of columns in the matrix. |
double[][] |
get()
Get all elements as a two-dimensional double array. |
double |
get(int row,
int column)
Gets value of element at given row and column. |
Matrix |
getColumn(int column)
Get entire column as a matrix. |
double[] |
getColumnData(int column)
Get entire column as an array of doubles. |
Matrix |
getColumns(int[] columns)
Extract columns. |
Matrix |
getColumns(int firstColumn,
int lastColumn)
Extract columns. |
Matrix |
getCopy()
Get all elements as a new matrix. |
Matrix |
getRow(int row)
Get entire row as a matrix. |
double[] |
getRowData(int row)
Get entire row as an array of doubles . |
Matrix |
getRows(int[] rows)
Extract rows. |
Matrix |
getRows(int firstRow,
int lastRow)
Extract rows. |
Matrix |
getSubMatrix(int[] rows,
int[] columns)
Extract a submatrix. |
Matrix |
getSubMatrix(int[] rows,
int firstColumn,
int lastColumn)
Extract a submatrix. |
Matrix |
getSubMatrix(int firstRow,
int lastRow,
int[] columns)
Extract a submatrix. |
Matrix |
getSubMatrix(int firstRow,
int firstColumn,
int lastRow,
int lastColumn)
Extract a submatrix. |
int |
rows()
Get number of rows in the matrix. |
void |
set(double[][] values)
Set all elements of a matrix from a double array. |
void |
set(int row,
int column,
double value)
Set an element at the given position to a new value. |
void |
set(Matrix matrix)
Set all elements from another matrix. |
void |
setColumn(int column,
Matrix columnMatrix)
Set entire column of values from a column matrix. |
void |
setColumnData(int column,
double[] columnData)
Set entire column from an array of doubles . |
void |
setColumnData(int column,
int[] columnData)
Set entire column from an array of ints . |
void |
setRow(int row,
Matrix rowMatrix)
Set entire row of values from a row matrix. |
void |
setRowData(int row,
double[] rowData)
Set entire row from an array of doubles . |
java.lang.String |
toString()
Return the matrix as a displayable string. |
Method Detail |
---|
int rows()
int columns()
double get(int row, int column)
row
- Row in which the element occurs.column
- Column in which the element occurs.
void set(int row, int column, double value)
row
- Row in which the element occurs.column
- Column in which the element occurs.value
- The new value to be set. Matrix getCopy()
Essentially creates a deep clone of the current matrix.
void set(Matrix matrix)
matrix
- Matrix whose value to copy to this matrix.
MatrixMismatchedSizeException
- If the source matrix and this one don't have
the same number of rows and columns. double[][] get()
void set(double[][] values)
values
- The double[][] from which values should be set. Matrix getRow(int row)
row
- Row to retrieve.
double[] getRowData(int row)
row
- Row to retrieve.
void setRow(int row, Matrix rowMatrix)
row
- Row to set.rowMatrix
- Matrix containing row data. void setRowData(int row, double[] rowData)
row
- Row to set.rowData
- Array of doubles containing row data. Matrix getColumn(int column)
column
- Column to retrieve.
double[] getColumnData(int column)
column
- Column to retrieve.
void setColumn(int column, Matrix columnMatrix)
column
- Column to set.columnMatrix
- Matrix containing column data. void setColumnData(int column, double[] columnData)
column
- Column to set.columnData
- Array of doubles containing column data. void setColumnData(int column, int[] columnData)
column
- Column to set.columnData
- Array of ints containing column data. Matrix getSubMatrix(int firstRow, int firstColumn, int lastRow, int lastColumn)
firstRow
- First row index.firstColumn
- First column index.lastRow
- Last row index.lastColumn
- Last column index.
MatrixMismatchedSizeException
- If requested matrix indices are bad. Matrix getSubMatrix(int[] rows, int[] columns)
rows
- Array of row indices.columns
- Array of column indices.
MatrixMismatchedSizeException
- If requested matrix indices are bad. Matrix getSubMatrix(int firstRow, int lastRow, int[] columns)
firstRow
- First row index.lastRow
- Last row indexcolumns
- Array of column indices.
MismatchedSizeException
- If requested matrix indices are bad. Matrix getSubMatrix(int[] rows, int firstColumn, int lastColumn)
rows
- Array of row indices.firstColumn
- First column index.lastColumn
- Last column index.
MismatchedSizeException
- If requested matrix indices are bad. Matrix getColumns(int firstColumn, int lastColumn)
firstColumn
- First column index.lastColumn
- Last column index.
MismatchedSizeException
- If requested matrix indices are bad. Matrix getColumns(int[] columns)
columns
- Indices of columns to extract.
MismatchedSizeException
- If requested matrix indices are bad. Matrix getRows(int firstRow, int lastRow)
firstRow
- First row index.lastRow
- Last row index.
MismatchedSizeException
- If requested matrix indices are bad. Matrix getRows(int[] rows)
rows
- Indices of rows to extract.
MismatchedSizeException
- If requested matrix indices are bad. java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |