|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.apache.spark.mllib.linalg.SparseVector
public class SparseVector
A sparse vector represented by an index array and an value array.
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 Summary | |
---|---|
SparseVector(int size,
int[] indices,
double[] values)
|
Method Summary | |
---|---|
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()
|
Methods inherited from class Object |
---|
equals, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.spark.mllib.linalg.Vector |
---|
apply, compressed, equals, toDense |
Constructor Detail |
---|
public SparseVector(int size, int[] indices, double[] values)
Method Detail |
---|
public static scala.Option<scala.Tuple3<Object,int[],double[]>> unapply(SparseVector sv)
public int size()
Vector
size
in interface Vector
public int[] indices()
public double[] values()
public String toString()
toString
in class Object
public double[] toArray()
Vector
toArray
in interface Vector
public SparseVector copy()
Vector
copy
in interface Vector
public int hashCode()
Vector
java.util.Arrays.hashCode
.
hashCode
in interface Vector
hashCode
in class Object
public int numActives()
Vector
numActives
in interface Vector
public int numNonzeros()
Vector
numNonzeros
in interface Vector
public SparseVector toSparse()
Vector
toSparse
in interface Vector
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |