|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--jumbo.euclid.Status
|
+--jumbo.euclid.RealMatrix
RealMatrix - rectangular real number matrix class
RealMatrix represents a rectangular m-x-n matrix. The basic matrix algebra for non-square matrices is represented here and this class is also a base for square matrices.
Read the signature of each member function carefully as some MODIFY the object and some CREATE A NEW ONE. Among the reasons for this is that subclassing (e.g to RealSquareMatrix) is easier with one of these forms in certain cases. Note that if you modify an object, then all references to it will refer to the changed object
| Field Summary | |
protected int |
cols
number of columns |
protected double[][] |
flmat
the matrix |
protected int |
rows
number of rows |
| Constructor Summary | |
RealMatrix()
Default matrix, with cols = rows = 0 |
|
RealMatrix(double[][] m)
COPY from an existing matrix - check that it is rectangular |
|
RealMatrix(int r,
int c)
A rows*cols matrix set to 0.0 (rows or cols < 0 defaults to 0) |
|
RealMatrix(int r,
int c,
double f)
initalises all elements in the array with a given double[] |
|
RealMatrix(int rows,
int cols,
double[] array)
Formed by feeding in an existing 1-D array to a rowsXcols matrix. |
|
RealMatrix(IntMatrix m)
from a IntMatrix |
|
RealMatrix(RealMatrix m)
copy constructor - COPIES the other matrix |
|
RealMatrix(RealMatrix m,
int lowrow,
int hirow,
int lowcol,
int hicol)
submatrix of another matrix; fails if lowrow > hirow, lowrow < 0, etc. |
|
| Method Summary | |
void |
appendColumnData(RealArray f)
append data to matrix columnwise |
void |
appendColumnData(RealMatrix m)
append data to matrix columnwise |
void |
appendRowData(RealArray f)
append data to matrix rowwise |
void |
appendRowData(RealMatrix m)
append data to matrix rowwise |
void |
clearMatrix()
clear matrix |
RealMatrix |
clone(RealMatrix m)
|
void |
columnwiseDivide(RealArray f)
divide each column of a matrix by a vector of scalars (i.e. |
void |
deleteColumn(int col)
delete column from matrix and close up |
void |
deleteColumns(int low,
int high)
delete 2 or more adjacent columns (inclusive) from matrix and close up |
void |
deleteRow(int row)
delete row from matrix and close up |
void |
deleteRows(int low,
int high)
delete 2 or more adjacent rows (inclusive) from matrix and close up; if (high > rows-1 high -> rows-1; or low < 0, low -> 0 |
double |
elementAt(Int2 rowcol)
extracts a given element from the matrix |
double |
elementAt(int row,
int col)
extracts a given element from the matrix |
IntMatrix |
elementsInRange(RealRange r)
produce a mask of those elements which fall in a range (1) else (0) |
boolean |
equals(RealMatrix m)
are two matrices equal in all elements? |
double |
euclideanColumnLength(int i)
get Euclidean length of column |
RealArray |
euclideanColumnLengths()
get array of Euclidean column lengths |
double |
euclideanRowLength(int i)
get Euclidean length of row |
RealArray |
euclideanRowLengths()
get array of Euclidean row lengths |
RealArray |
extractColumnData(int col)
get column data from matrix |
RealArray |
extractRowData(int row)
get row data from matrix |
RealMatrix |
extractSubMatrixData(int low_row,
int high_row,
int low_col,
int high_col)
extract a RealMatrix submatrix from a RealMatrix |
int |
getCols()
get number of columns |
double[][] |
getMatrix()
|
double[] |
getMatrixAsArray()
get matrix as double[] (in C order: m(0,0), m(0,1) ...) |
int |
getRows()
get number of rows |
RealMatrix |
getTranspose()
transpose matrix - creates new Matrix |
Int2 |
indexOfLargestElement()
get index of largest element |
int |
indexOfLargestElementInColumn(int jcol)
get index of largest element in column |
int |
indexOfLargestElementInRow(int irow)
get index of largest element in row (or -1 if default matrix) |
Int2 |
indexOfSmallestElement()
get index of smallest element |
int |
indexOfSmallestElementInColumn(int jcol)
get index of smallest elem in column |
int |
indexOfSmallestElementInRow(int irow)
get index of smallest element in row |
void |
insertColumnData(int after_col,
RealArray f)
add data as column or column block into matrix and expand |
void |
insertColumnData(int after_col,
RealMatrix m)
add data as column or column block into matrix and expand |
void |
insertColumns(int after_col,
int delta_cols)
insert a hole into the matric and expand |
void |
insertRowData(int after_row,
RealArray f)
insert row of data into matrix and expand |
void |
insertRowData(int after_row,
RealMatrix m)
insert 2 or more adjacent rows of data into matrix and expand |
void |
insertRows(int after_row,
int delta_rows)
make space for new rows in matrix and expand |
boolean |
isOrthogonal()
is matrix Orthogonal (row-wise)? i.e. |
boolean |
isSquare()
is the matrix square? |
double |
largestElement()
get largest element |
double |
largestElementInColumn(int jcol)
get largest element in a column |
double |
largestElementInRow(int irow)
get largest element in a row |
static void |
main(java.lang.String[] args)
tests RealMatrix routines = new RealMatrix |
RealArray |
multiply(RealArray f)
matrix multiplication of a COLUMN vector |
RealMatrix |
multiply(RealMatrix m)
matrix multiplication - multiplies conformable matrices to give NEW matrix result = 'this' * m; (order matters) |
void |
multiplyBy(double f)
matrix multiplication by a scalar - MODIFIES matrix |
void |
negative()
unary minus - negate all elements of matrix; MODIFIES matrix |
void |
normaliseByColumns()
normalise matrix columns to length of 1.0 |
void |
normaliseByRows()
normalise matrix rows to length of 1.0 |
RealMatrix |
plus(RealMatrix m2)
matrix addition - adds conformable matrices giving NEW matrix |
RealMatrix |
reorderColumnsBy(IntSet is)
reorder the columns of a matrix. |
RealMatrix |
reorderRowsBy(IntSet is)
reorder the rows of a matrix. |
void |
replaceColumnData(int starting_col,
double[] f)
and from double[] |
boolean |
replaceColumnData(int column,
RealArray f)
replace data in a single column - return false if impossible |
void |
replaceColumnData(int start_column,
RealMatrix m)
replace data in a block of columns |
void |
replaceRowData(int row,
double[] f)
and using a double[] |
void |
replaceRowData(int row,
RealArray f)
overwrite existing row of data |
void |
replaceRowData(int after_row,
RealMatrix m)
overwrite existing block of rows; if too big, copying is truncated |
void |
replaceSubMatrixData(int low_row,
int low_col,
RealMatrix m)
replaces the data starting at (low_row, low_col) and extending by the dimensions for the matrix m |
void |
setAllElements(double f)
initialise matrix to given double |
void |
setElementAt(int row,
int col,
double f)
inserts a given element to the matrix - MODIFIES matrix |
void |
shallowCopy(RealMatrix m)
shallowCopy |
double |
smallestElement()
get smallest element |
double |
smallestElementInColumn(int jcol)
get smallest element in a column |
double |
smallestElementInRow(int irow)
get smallest element in a row |
RealMatrix |
subtract(RealMatrix m2)
matrix subtraction - subtracts conformable matrices giving NEW matrix |
java.lang.String |
toString()
output matrix - very crude... |
| Methods inherited from class jumbo.euclid.Status |
NYI |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected int rows
protected int cols
protected double[][] flmat
| Constructor Detail |
public RealMatrix()
public RealMatrix(int r,
int c)
public RealMatrix(int rows,
int cols,
double[] array)
throws BadArgumentException
public RealMatrix(int r,
int c,
double f)
public RealMatrix(RealMatrix m,
int lowrow,
int hirow,
int lowcol,
int hicol)
throws BadArgumentException
public RealMatrix(RealMatrix m)
public RealMatrix(IntMatrix m)
public RealMatrix(double[][] m)
throws NonRectMatrixException
| Method Detail |
public void shallowCopy(RealMatrix m)
public RealMatrix clone(RealMatrix m)
public int getRows()
public int getCols()
public double[][] getMatrix()
public double[] getMatrixAsArray()
public boolean equals(RealMatrix m)
throws UnequalMatricesException
public RealMatrix plus(RealMatrix m2)
throws UnequalMatricesException
public RealMatrix subtract(RealMatrix m2)
throws UnequalMatricesException
public void negative()
public RealMatrix multiply(RealMatrix m)
throws UnequalMatricesException
public void multiplyBy(double f)
public RealArray multiply(RealArray f)
throws UnequalMatricesException
public void columnwiseDivide(RealArray f)
throws UnequalMatricesException
public double elementAt(int row,
int col)
public double elementAt(Int2 rowcol)
public void setElementAt(int row,
int col,
double f)
public double largestElement()
public Int2 indexOfLargestElement()
public double largestElementInColumn(int jcol)
public int indexOfLargestElementInColumn(int jcol)
public double largestElementInRow(int irow)
public int indexOfLargestElementInRow(int irow)
public double smallestElement()
public Int2 indexOfSmallestElement()
public double smallestElementInColumn(int jcol)
public int indexOfSmallestElementInColumn(int jcol)
public double smallestElementInRow(int irow)
public int indexOfSmallestElementInRow(int irow)
public boolean isOrthogonal()
public double euclideanRowLength(int i)
public RealArray euclideanRowLengths()
public double euclideanColumnLength(int i)
public RealArray euclideanColumnLengths()
public RealArray extractColumnData(int col)
public RealArray extractRowData(int row)
public void clearMatrix()
public void setAllElements(double f)
public void normaliseByRows()
public void normaliseByColumns()
public RealMatrix getTranspose()
public boolean isSquare()
public void deleteColumn(int col)
public void deleteColumns(int low,
int high)
public void deleteRow(int row)
public void deleteRows(int low,
int high)
public boolean replaceColumnData(int column,
RealArray f)
public void replaceColumnData(int starting_col,
double[] f)
public void replaceColumnData(int start_column,
RealMatrix m)
public void insertColumns(int after_col,
int delta_cols)
public void insertColumnData(int after_col,
RealArray f)
public void insertColumnData(int after_col,
RealMatrix m)
public void insertRows(int after_row,
int delta_rows)
public void replaceRowData(int row,
RealArray f)
throws UnequalMatricesException
public void replaceRowData(int row,
double[] f)
throws UnequalMatricesException
public void replaceRowData(int after_row,
RealMatrix m)
throws UnequalMatricesException
public void insertRowData(int after_row,
RealMatrix m)
throws UnequalMatricesException
public void insertRowData(int after_row,
RealArray f)
throws UnequalMatricesException
public void appendColumnData(RealArray f)
throws UnequalMatricesException
public void appendColumnData(RealMatrix m)
throws UnequalMatricesException
public void appendRowData(RealArray f)
throws UnequalMatricesException
public void appendRowData(RealMatrix m)
throws UnequalMatricesException
public void replaceSubMatrixData(int low_row,
int low_col,
RealMatrix m)
public RealMatrix reorderColumnsBy(IntSet is)
throws UnequalMatricesException,
java.lang.ArrayIndexOutOfBoundsException
public RealMatrix reorderRowsBy(IntSet is)
throws UnequalMatricesException,
java.lang.ArrayIndexOutOfBoundsException
public RealMatrix extractSubMatrixData(int low_row,
int high_row,
int low_col,
int high_col)
throws BadArgumentException
public IntMatrix elementsInRange(RealRange r)
public java.lang.String toString()
public static void main(java.lang.String[] args)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||