public interface Vector
extends scala.Serializable
Note: Users should not implement this interface.
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.
|
breeze.linalg.Vector<Object> |
asBreeze()
Converts the instance to a breeze vector.
|
Vector |
asML()
Convert this vector to the new mllib-local representation.
|
Vector |
compressed()
Returns a vector in either dense or sparse format, whichever uses less storage.
|
Vector |
copy()
Makes a deep copy of this vector.
|
boolean |
equals(Object other) |
void |
foreachActive(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
Applies a function
f to all the active elements of dense and sparse vector. |
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.
|
DenseVector |
toDense()
Converts this vector to a dense vector.
|
String |
toJson()
Converts the vector to a JSON string.
|
SparseVector |
toSparse()
Converts this vector to a sparse vector with all explicit zeros removed.
|
int size()
double[] toArray()
boolean equals(Object other)
equals
in class Object
int hashCode()
java.util.Arrays.hashCode
.hashCode
in class Object
breeze.linalg.Vector<Object> asBreeze()
double apply(int i)
i
- indexVector copy()
void foreachActive(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
f
to all the active elements of dense and sparse vector.
f
- the function takes two parameters where the first parameter is the index of
the vector with type Int
, and the second parameter is the corresponding value
with type Double
.int numActives()
int numNonzeros()
SparseVector toSparse()
DenseVector toDense()
Vector compressed()
int argmax()
String toJson()
Vector asML()