public class DenseVector extends Vector
| 构造器和说明 |
|---|
DenseVector()
Create a zero size vector.
|
DenseVector(double[] data)
Create a dense vector with the user provided data.
|
DenseVector(int n)
Create a size n vector with all elements zero.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(int i,
double d)
Add the i-th element of the vector by value "val".
|
DenseVector |
append(double d)
Create a new vector by adding an element to the end of the vector.
|
DenseVector |
clone() |
double |
dot(Vector vec)
Compute the dot product with another vector.
|
boolean |
equals(Object o) |
double |
get(int i)
Get the i-th element of the vector.
|
double[] |
getData()
Get the data array.
|
int |
hashCode() |
VectorIterator |
iterator()
Get the iterator of the vector.
|
DenseVector |
minus(Vector other)
Create a new vector by subtracting another vector.
|
void |
minusEqual(Vector other)
Minus with another vector.
|
void |
normalizeEqual(double p)
Normalize the vector.
|
double |
normInf()
Return the Inf norm of the vector.
|
double |
normL1()
Return the L1 norm of the vector.
|
double |
normL2()
Return the L2 norm of the vector.
|
double |
normL2Square()
Return the square of L2 norm of the vector.
|
static DenseVector |
ones(int n)
Create a dense vector with all elements one.
|
DenseMatrix |
outer()
Compute the outer product with itself.
|
DenseMatrix |
outer(DenseVector other)
Compute the outer product with another vector.
|
DenseVector |
plus(Vector other)
Create a new vector by plussing another vector.
|
void |
plusEqual(Vector other)
Plus with another vector.
|
void |
plusScaleEqual(Vector other,
double alpha)
Plus with another vector scaled by "alpha".
|
DenseVector |
prefix(double d)
Create a new vector by adding an element to the head of the vector.
|
static DenseVector |
rand(int n)
Create a dense vector with random values uniformly distributed in the range of [0.0, 1.0].
|
DenseVector |
scale(double d)
Scale the vector by value "v" and create a new vector to store the result.
|
void |
scaleEqual(double d)
Scale the vector by value "v".
|
void |
set(int i,
double d)
Set the i-th element of the vector to value "val".
|
void |
setData(double[] data)
Set the data array.
|
void |
setEqual(DenseVector other)
Set the data of the vector the same as those of another vector.
|
int |
size()
Get the size of the vector.
|
DenseVector |
slice(int[] indices)
Slice the vector.
|
void |
standardizeEqual(double mean,
double stdvar)
Standardize the vector.
|
String |
toString() |
static DenseVector |
zeros(int n)
Create a dense vector with all elements zero.
|
public DenseVector()
public DenseVector(int n)
n - Size of the vector.public DenseVector(double[] data)
data - The vector data.public double[] getData()
public void setData(double[] data)
public static DenseVector ones(int n)
n - Size of the vector.public static DenseVector zeros(int n)
n - Size of the vector.public static DenseVector rand(int n)
n - Size of the vector.public DenseVector clone()
public double get(int i)
Vectorpublic void set(int i,
double d)
Vectorpublic void add(int i,
double d)
Vectorpublic double normL1()
Vectorpublic double normL2()
Vectorpublic double normL2Square()
VectornormL2Square 在类中 Vectorpublic double normInf()
Vectorpublic DenseVector slice(int[] indices)
Vectorpublic DenseVector prefix(double d)
Vectorpublic DenseVector append(double d)
Vectorpublic void scaleEqual(double d)
VectorscaleEqual 在类中 Vectorpublic DenseVector plus(Vector other)
Vectorpublic DenseVector minus(Vector other)
Vectorpublic DenseVector scale(double d)
Vectorpublic void standardizeEqual(double mean,
double stdvar)
VectorstandardizeEqual 在类中 Vectorpublic void normalizeEqual(double p)
VectornormalizeEqual 在类中 Vectorpublic void setEqual(DenseVector other)
public void plusEqual(Vector other)
public void minusEqual(Vector other)
public void plusScaleEqual(Vector other, double alpha)
public DenseMatrix outer()
Vectorpublic DenseMatrix outer(DenseVector other)
public VectorIterator iterator()
VectorCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.