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 |
|---|---|
double |
apply(int i)
Gets the value of the ith element.
|
int |
argmax()
Find the index of a maximal element.
|
SparseVector |
copy()
Makes a deep copy of this vector.
|
boolean |
equals(Object other) |
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.
|
String |
toString() |
static scala.Option<scala.Tuple3<Object,int[],double[]>> |
unapply(SparseVector sv) |
double[] |
values() |
compressed, dot, foreach, foreachActive, foreachNonZero, nonZeroIterator, toDense, toSparsepublic static scala.Option<scala.Tuple3<Object,int[],double[]>> unapply(SparseVector sv)
public int size()
Vectorpublic int[] indices()
public double[] values()
public String toString()
toString in class Objectpublic double[] toArray()
Vectorpublic SparseVector copy()
Vectorpublic double apply(int i)
Vectorpublic boolean equals(Object other)
public int hashCode()
Vectorjava.util.Arrays.hashCode.public int numActives()
VectornumActives in interface Vectorpublic int numNonzeros()
VectornumNonzeros in interface Vector