@TypeInfo(value=SparseVectorTypeInfoFactory.class) @PublicEvolving public class SparseVector extends Object implements Vector
Constructor and Description |
---|
SparseVector(int n,
int[] indices,
double[] values) |
Modifier and Type | Method and Description |
---|---|
SparseVector |
clone()
Makes a deep copy of the vector.
|
boolean |
equals(Object o) |
double |
get(int i)
Gets the value of the ith element.
|
int |
hashCode() |
void |
set(int i,
double value)
Sets the value of the ith element.
|
int |
size()
Gets the size of the vector.
|
double[] |
toArray()
Converts the instance to a double array.
|
DenseVector |
toDense()
Converts the instance to a dense vector.
|
SparseVector |
toSparse()
Converts the instance to a sparse vector.
|
String |
toString() |
public int size()
Vector
public double get(int i)
Vector
public void set(int i, double value)
Vector
public double[] toArray()
Vector
public DenseVector toDense()
Vector
public SparseVector toSparse()
Vector
Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.