Class GenericVector<E>
java.lang.Object
com.singularsys.extensions.matrix.genericmat.GenericVector<E>
- Type Parameters:
E- Base type for elements of the matrix.
- All Implemented Interfaces:
VectorI,Serializable,Iterable<Object>
- Direct Known Subclasses:
ComplexVector,ObjectVector,RationalMatrixFactory.RationalVector
Generic implementation of a matrix when all elements are of the base type E.
Subclasses just need to provide a constructor and
the
setEle(int, Object) method. Both of these take a standard form.
class ComplexVector extends GenericVector<Complex> {
protected ComplexVector(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 Vector setEle: element should Complex. It was "+val.toString());
}
}
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests equality using theArrays.equalsmethod.Gets the dimensions of the Vector or MatrixgetEle(int i) Gets the i-th element of a vectorintgetNEles()Gets the number of elements of a vectorinthashCode()voidSets an element of a vector.voidObject[]toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
data
-
-
Constructor Details
-
GenericVector
- Parameters:
data-
-
-
Method Details
-
getEle
Description copied from interface:VectorIGets the i-th element of a vector- Specified by:
getElein interfaceVectorI- Parameters:
i- index (starts from 0)- Returns:
- the i-th element
- Throws:
EvaluationException
-
setEleG
- Throws:
EvaluationException
-
setEle
Description copied from interface:VectorISets an element of a vector.- Specified by:
setElein interfaceVectorI- Parameters:
i-val-- Throws:
EvaluationException
-
getNEles
public int getNEles()Description copied from interface:VectorIGets the number of elements of a vector -
getDimensions
Description copied from interface:VectorIGets the dimensions of the Vector or Matrix- Specified by:
getDimensionsin interfaceVectorI- Returns:
- the dimensions
-
equals
Tests equality using theArrays.equalsmethod. -
hashCode
public int hashCode() -
toString
-
toArray
- Specified by:
toArrayin interfaceVectorI- Throws:
EvaluationException
-