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()
Vector
public int[] indices()
public double[] values()
public String toString()
toString
in class Object
public double[] toArray()
Vector
public SparseVector copy()
Vector
public breeze.linalg.Vector<Object> toBreeze()
Vector
public void foreachActive(scala.Function2<Object,Object,scala.runtime.BoxedUnit> f)
Vector
f
to all the active elements of dense and sparse vector.
foreachActive
in interface 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
.