|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectorg.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 Vectorpublic int[] indices()
public double[] values()
public String toString()
toString in class Objectpublic double[] toArray()
Vector
toArray in interface Vectorpublic SparseVector copy()
Vector
copy in interface Vectorpublic int hashCode()
Vectorjava.util.Arrays.hashCode.
hashCode in interface VectorhashCode in class Objectpublic int numActives()
Vector
numActives in interface Vectorpublic int numNonzeros()
Vector
numNonzeros in interface Vectorpublic SparseVector toSparse()
Vector
toSparse in interface Vector
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||