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)
MatrixI
public 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 elementEvaluationException
public void setEle(int row, int col, java.lang.Object val) throws EvaluationException
MatrixI
setEle
in interface MatrixI
val
- value to setEvaluationException
public final int getNCols()
MatrixI
public final int getNRows()
MatrixI
public Dimensions getDimensions()
MatrixI
getDimensions
in interface MatrixI
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object[][] toArray(java.lang.Object[][] mat) throws EvaluationException
MatrixI
toArray
in interface MatrixI
EvaluationException
- if mat is not a matrix of the correct sizeCopyright © 2018 Singular Systems http://www.singularsys.com/jep