public class DenseVector extends Object implements Vector
| Constructor and Description |
|---|
DenseVector(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.
|
DenseVector |
asML()
Convert this vector to the new mllib-local representation.
|
DenseVector |
copy()
Makes a deep copy of this vector.
|
boolean |
equals(Object other) |
static DenseVector |
fromML(DenseVector v)
Convert new linalg type to spark.mllib type.
|
int |
hashCode()
Returns a hash code value for the vector.
|
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 |
toJson()
Converts the vector to a JSON string.
|
String |
toString() |
static scala.Option<double[]> |
unapply(DenseVector dv)
Extracts the value array from a dense vector.
|
double[] |
values() |
compressed, dot, foreach, foreachActive, foreachNonZero, nonZeroIterator, sparsity, toDense, toSparsepublic static scala.Option<double[]> unapply(DenseVector dv)
public static DenseVector fromML(DenseVector v)
v - (undocumented)public double[] values()
public int size()
Vectorpublic String toString()
toString in class Objectpublic double[] toArray()
Vectorpublic double apply(int i)
Vectorpublic DenseVector copy()
Vectorpublic boolean equals(Object other)
public int hashCode()
Vectorjava.util.Arrays.hashCode.public int numActives()
VectornumActives in interface Vectorpublic int numNonzeros()
VectornumNonzeros in interface Vectorpublic int argmax()
Vectorpublic String toJson()
Vectorpublic DenseVector asML()
Vector