public class SparseVector extends Object implements Vector
param: size size of the vector. param: indices index array, assume to be strictly increasing. param: values value array, must have the same length as the index array.
Constructor and Description |
---|
SparseVector(int size,
int[] indices,
double[] values) |
Modifier and Type | Method and Description |
---|---|
SparseVector |
copy()
Makes a deep copy of this vector.
|
int |
hashCode()
Returns a hash code value for the vector.
|
int[] |
indices() |
int |
numActives()
Number of active entries.
|
int |
numNonzeros()
Number of nonzero elements.
|
int |
size()
Size of the vector.
|
double[] |
toArray()
Converts the instance to a double array.
|
SparseVector |
toSparse()
Converts this vector to a sparse vector with all explicit zeros removed.
|
String |
toString() |
static scala.Option<scala.Tuple3<Object,int[],double[]>> |
unapply(SparseVector sv) |
double[] |
values() |
apply, compressed, equals, toDense
public static scala.Option<scala.Tuple3<Object,int[],double[]>> unapply(SparseVector sv)
public int size()
Vector
public int[] indices()
public double[] values()
public String toString()
toString
in class Object
public double[] toArray()
Vector
public SparseVector copy()
Vector
public int hashCode()
Vector
java.util.Arrays.hashCode
.public int numActives()
Vector
numActives
in interface Vector
public int numNonzeros()
Vector
numNonzeros
in interface Vector
public SparseVector toSparse()
Vector