public interface Vector
extends scala.Serializable
| Modifier and Type | Method and Description |
|---|---|
scala.collection.Iterator<scala.Tuple2<Object,Object>> |
activeIterator()
Returns an iterator over all the active elements of this vector.
|
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 |
compressed()
Returns a vector in either dense or sparse format, whichever uses less storage.
|
Vector |
copy()
Makes a deep copy of this vector.
|
double |
dot(Vector v)
Calculate the dot product of this vector with another.
|
boolean |
equals(Object other) |
void |
foreach(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
Applies a function
f to all the elements of dense and sparse vector. |
void |
foreachActive(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
Applies a function
f to all the active elements of dense and sparse vector. |
void |
foreachNonZero(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
Applies a function
f to all the non-zero elements of dense and sparse vector. |
int |
hashCode()
Returns a hash code value for the vector.
|
scala.collection.Iterator<scala.Tuple2<Object,Object>> |
iterator()
Returns an iterator over all the elements of this vector.
|
scala.collection.Iterator<scala.Tuple2<Object,Object>> |
nonZeroIterator()
Returns an iterator over all the non-zero elements of this 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.
|
SparseVector |
toSparse()
Converts this vector to a sparse vector with all explicit zeros removed.
|
SparseVector |
toSparseWithSize(int nnz)
Converts this vector to a sparse vector with all explicit zeros removed when the size is known.
|
scala.collection.Iterator<scala.Tuple2<Object,Object>> activeIterator()
double apply(int i)
i - indexint argmax()
breeze.linalg.Vector<Object> asBreeze()
Vector compressed()
Vector copy()
double dot(Vector v)
If size does not match an IllegalArgumentException is thrown.
v - (undocumented)boolean equals(Object other)
equals in class Objectvoid foreach(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
f to all the 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.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.void foreachNonZero(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
f to all the non-zero 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 hashCode()
java.util.Arrays.hashCode.hashCode in class Objectscala.collection.Iterator<scala.Tuple2<Object,Object>> iterator()
scala.collection.Iterator<scala.Tuple2<Object,Object>> nonZeroIterator()
int numActives()
int numNonzeros()
int size()
double[] toArray()
DenseVector toDense()
SparseVector toSparse()
SparseVector toSparseWithSize(int nnz)
numNonzeros. e.g.
val nnz = numNonzeros
val sv = toSparse(nnz)
If nnz is under-specified, a ArrayIndexOutOfBoundsException is thrown.
nnz - (undocumented)