Class DoubleVector
- java.lang.Object
-
- com.singularsys.extensions.matrix.doublemat.DoubleVector
-
- All Implemented Interfaces:
VectorI
,java.io.Serializable
public final class DoubleVector extends java.lang.Object implements VectorI, java.io.Serializable
A vector where the elements are doubles- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DoubleVector(double[] data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
eq(DoubleVector vec)
boolean
equals(java.lang.Object obj)
Uses the Double.equals() rather than == for compatibility with hashcode.Dimensions
getDimensions()
Gets the dimensions of the Vector or Matrixjava.lang.Double
getEle(int i)
Gets the i-th element of a vectorint
getNEles()
Gets the number of elements of a vectorint
hashCode()
static DoubleVector
newInstance(double[] in)
static DoubleVector
newInstance(java.lang.Double[] in)
void
setEle(int index, java.lang.Object val)
Sets an element of a vector.double[]
toArray()
java.lang.Object[]
toArray(java.lang.Object[] vec)
java.lang.String
toString()
-
-
-
Method Detail
-
newInstance
public static DoubleVector newInstance(java.lang.Double[] in)
-
newInstance
public static DoubleVector newInstance(double[] in)
-
getEle
public java.lang.Double getEle(int i)
Description copied from interface:VectorI
Gets the i-th element of a vector
-
setEle
public void setEle(int index, java.lang.Object val) throws EvaluationException
Description copied from interface:VectorI
Sets an element of a vector.- Specified by:
setEle
in interfaceVectorI
- Throws:
EvaluationException
-
getNEles
public int getNEles()
Description copied from interface:VectorI
Gets the number of elements of a vector
-
getDimensions
public Dimensions getDimensions()
Description copied from interface:VectorI
Gets the dimensions of the Vector or Matrix- Specified by:
getDimensions
in interfaceVectorI
- Returns:
- the dimensions
-
toArray
public double[] toArray()
-
eq
public boolean eq(DoubleVector vec)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toArray
public java.lang.Object[] toArray(java.lang.Object[] vec) throws EvaluationException
- Specified by:
toArray
in interfaceVectorI
- Throws:
EvaluationException
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Uses the Double.equals() rather than == for compatibility with hashcode. Hence NaN equals NaN and -0.0 equals 0.0. Useeq(DoubleVector)
for comparison using ==.- Overrides:
equals
in classjava.lang.Object
-
-