public class Matrix<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Matrix.IterationMode |
| Constructor and Description |
|---|
Matrix(Class<T> type,
int rows,
int columns) |
Matrix(T[][] data) |
| Modifier and Type | Method and Description |
|---|---|
protected T[] |
getArray(int arrayIndex) |
protected T[][] |
getData() |
T |
getElementAt(int rowIndex,
int colIndex) |
Class<T> |
getType() |
Iterable<T> |
iterate() |
Iterable<T> |
iterate(int centerRowIndex,
int centerColumnIndex,
double range) |
Iterable<T> |
iterate(int centerRowIndex,
int centerColumnIndex,
int squareRadius) |
Iterable<T> |
iterate(int firstRow,
int firstColumn,
int lastRow,
int lastColumn) |
protected Iterable<T> |
iterate(int firstRow,
int firstColumn,
int lastRow,
int lastColumn,
Double range) |
T |
setElementAt(int rowIndex,
int colIndex,
T newElement) |
void |
swapElements(int rowIndex1,
int colIndex1,
int rowIndex2,
int colIndex2) |
String |
toString() |
static <T> T[][] |
validateArray(T[][] array)
Validates if
array is a well-formed array in terms of a matrix. |
public Matrix(T[][] data)
public static <T> T[][] validateArray(T[][] array)
throws MatrixException,
NullPointerException
array is a well-formed array in terms of a matrix.
Well-formed arrays meet the following criteria:
- Both dimensions have a size greater than 0.
- No nested array may be null.
- All nested arrays have the same size.
T - the element typearray - the array to validateMatrixException - if array is an invalid matrixNullPointerException - if array or a member of it is nullprotected T[][] getData()
protected T[] getArray(int arrayIndex)
public String toString()
toString in class ObjectObject.toString()public T getElementAt(int rowIndex, int colIndex)
rowIndex - the row indexcolIndex - the column indexpublic T setElementAt(int rowIndex, int colIndex, T newElement)
rowIndex - the row indexcolIndex - the column indexnewElement - the element to setpublic void swapElements(int rowIndex1,
int colIndex1,
int rowIndex2,
int colIndex2)
protected Iterable<T> iterate(int firstRow, int firstColumn, int lastRow, int lastColumn, Double range) throws IllegalArgumentException
IllegalArgumentExceptionpublic Iterable<T> iterate(int firstRow, int firstColumn, int lastRow, int lastColumn) throws IllegalArgumentException
IllegalArgumentExceptionpublic Iterable<T> iterate(int centerRowIndex, int centerColumnIndex, int squareRadius) throws IllegalArgumentException
IllegalArgumentExceptionpublic Iterable<T> iterate(int centerRowIndex, int centerColumnIndex, double range) throws IllegalArgumentException
IllegalArgumentExceptionCopyright © 2022 MicroStream Software. All rights reserved.