E - Base type for elements of the matrix.public class GenericMatrix<E> extends java.lang.Object implements MatrixI
setEle(int, int, Object) method. Both of these take a standard form.
class ComplexMatrix extends GenericMatrix<Complex> {
protected ComplexMatrix(Complex[][] data) {
super(data);
}
@Override
public void setEle(int row, int col, Object val) throws EvaluationException {
if(val instanceof Complex)
this.setEleG(row, col, (Complex) val);
else
throw new EvaluationException("Complex matrix setEle: element at "+row+", "+col+" should be Complex. It was "+val.toString());
}
}
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object[][] |
data |
| Modifier | Constructor and Description |
|---|---|
protected |
GenericMatrix(java.lang.Object[][] data) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
Dimensions |
getDimensions()
Gets the dimensions of the Vector or Matrix
|
E |
getEle(int i,
int j)
Gets an element of a matrix
|
int |
getNCols()
The number of columns
|
int |
getNRows()
The number of rows
|
int |
hashCode() |
void |
setEle(int row,
int col,
java.lang.Object val)
Set an element of a matrix
|
void |
setEleG(int i,
int j,
E val)
Set an element of a known type E.
|
java.lang.Object[][] |
toArray(java.lang.Object[][] mat)
Copies the data to an array
|
java.lang.String |
toString() |
protected GenericMatrix(java.lang.Object[][] data)
data - public final E getEle(int i, int j)
MatrixIpublic final void setEleG(int i,
int j,
E val)
throws EvaluationException
setEle(int, int, Object) method.i - index for the row (starting at 0)j - index for the column (starting at 0)val - matrix elementEvaluationExceptionpublic void setEle(int row,
int col,
java.lang.Object val)
throws EvaluationException
MatrixIsetEle in interface MatrixIval - value to setEvaluationExceptionpublic final int getNCols()
MatrixIpublic final int getNRows()
MatrixIpublic Dimensions getDimensions()
MatrixIgetDimensions in interface MatrixIpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object[][] toArray(java.lang.Object[][] mat)
throws EvaluationException
MatrixItoArray in interface MatrixIEvaluationException - if mat is not a matrix of the correct sizeCopyright © 2018 Singular Systems http://www.singularsys.com/jep