public class DenseVector extends java.lang.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 |
copy()
Makes a deep copy of this vector.
|
void |
foreachActive(scala.Function2<java.lang.Object,java.lang.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.
|
java.lang.String |
toJson()
Converts the vector to a JSON string.
|
SparseVector |
toSparse()
Converts this vector to a sparse vector with all explicit zeros removed.
|
java.lang.String |
toString() |
static scala.Option<double[]> |
unapply(DenseVector dv)
Extracts the value array from a dense vector.
|
double[] |
values() |
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitcompressed, equals, toDensepublic static scala.Option<double[]> unapply(DenseVector dv)
public double[] values()
public int size()
Vectorpublic java.lang.String toString()
toString in class java.lang.Objectpublic double[] toArray()
Vectorpublic double apply(int i)
Vectorpublic DenseVector copy()
Vectorpublic void foreachActive(scala.Function2<java.lang.Object,java.lang.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.public int hashCode()
Vectorjava.util.Arrays.hashCode.public int numActives()
VectornumActives in interface Vectorpublic int numNonzeros()
VectornumNonzeros in interface Vectorpublic SparseVector toSparse()
Vectorpublic int argmax()
Vector