public class SparseVector extends Object implements Vector
| Constructor and Description |
|---|
SparseVector(int size,
int[] indices,
double[] values) |
| Modifier and Type | Method and Description |
|---|---|
SparseVector |
copy()
Makes a deep copy of this 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. |
int[] |
indices() |
int |
size()
Size of the vector.
|
double[] |
toArray()
Converts the instance to a double array.
|
breeze.linalg.Vector<Object> |
toBreeze()
Converts the instance to a breeze vector.
|
String |
toString() |
double[] |
values() |
public int size()
Vectorpublic int[] indices()
public double[] values()
public String toString()
toString in class Objectpublic double[] toArray()
Vectorpublic SparseVector copy()
Vectorpublic breeze.linalg.Vector<Object> toBreeze()
Vectorpublic void foreachActive(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
Vectorf to all the active elements of dense and sparse vector.
foreachActive in interface Vectorf - 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.