public final class SparseVector extends Object
Constructor and Description |
---|
SparseVector(double[] values,
int[] indices) |
SparseVector(double[] values,
int[] indices,
int size) |
Modifier and Type | Method and Description |
---|---|
double |
dot(Vector that)
Computes the inner product with another Vector.
|
double |
get(int index)
Access the value of the Vector at dimension i.
|
Tuple<Integer,Double> |
min()
Computes the min of all entries in the Vector.
|
double |
norm2()
Computes the L2 norm of this Vector.
|
double |
norm2Sqr()
Computes the square of the L2 norm of this Vector.
|
int |
size()
The size (dimensionality) of the Vector.
|
double |
sum()
Computes the computeSum of all entries in the Vector.
|
String |
toString() |
public SparseVector(double[] values, int[] indices, int size)
public SparseVector(double[] values, int[] indices)
public double get(int index)
ImmutableVector
get
in interface ImmutableVector
index
- indexpublic int size()
ImmutableVector
size
in interface ImmutableVector
public double dot(Vector that)
ImmutableVector
dot
in interface ImmutableVector
public double sum()
ImmutableVector
sum
in interface ImmutableVector
public double norm2()
ImmutableVector
norm2
in interface ImmutableVector
public double norm2Sqr()
ImmutableVector
norm2Sqr
in interface ImmutableVector
public Tuple<Integer,Double> min()
ImmutableVector
min
in interface ImmutableVector
Copyright © 2017 The Apache Software Foundation. All rights reserved.