public class DenseVector extends AbstractVector implements Serializable
double[]
array of the same length as
the vector itself.Vector.Norm
size
Constructor and Description |
---|
DenseVector(double[] x)
Constructor for DenseVector
|
DenseVector(double[] x,
boolean deep)
Constructor for DenseVector
|
DenseVector(int size)
Constructor for DenseVector
|
DenseVector(MatrixVectorReader r)
Constructor for DenseVector
|
DenseVector(Vector x)
Constructor for DenseVector
|
DenseVector(Vector x,
boolean deep)
Constructor for DenseVector
|
Modifier and Type | Method and Description |
---|---|
Vector |
add(double alpha,
Vector y)
x = alpha*y + x |
void |
add(int index,
double value)
x(index) += value |
Vector |
add(Vector y)
x = y + x |
DenseVector |
copy()
Creates a deep copy of the vector
|
double |
dot(Vector y)
xT*y |
double |
get(int index)
Returns
x(index) |
double[] |
getData()
Returns the internal vector contents.
|
protected double |
norm1() |
protected double |
norm2_robust() |
protected double |
norm2() |
protected double |
normInf() |
DenseVector |
scale(double alpha)
x=alpha*x |
Vector |
set(double alpha,
Vector y)
x=alpha*y |
void |
set(int index,
double value)
x(index) = value |
Vector |
set(Vector y)
x=y |
DenseVector |
zero()
Zeros all the entries in the vector, while preserving any underlying
structure
|
public DenseVector(MatrixVectorReader r) throws IOException
r
- Reader to get vector fromIOException
public DenseVector(int size)
size
- Size of the vectorpublic DenseVector(Vector x)
x
- Copies contents from this vector. A deep copy is madepublic DenseVector(Vector x, boolean deep)
x
- Copies contents from this vectordeep
- True for a deep copy. For a shallow copy, x
must be a DenseVector
public DenseVector(double[] x, boolean deep)
x
- Copies contents from this arraydeep
- True for a deep copy. For a shallow copy, x
is
aliased with the internal storagepublic DenseVector(double[] x)
x
- Copies contents from this array in a deep copypublic void set(int index, double value)
Vector
x(index) = value
set
in interface Vector
set
in class AbstractVector
public void add(int index, double value)
Vector
x(index) += value
add
in interface Vector
add
in class AbstractVector
public double get(int index)
Vector
x(index)
get
in interface Vector
get
in class AbstractVector
public DenseVector copy()
Vector
copy
in interface Vector
copy
in class AbstractVector
public DenseVector zero()
Vector
zero
in interface Vector
zero
in class AbstractVector
public DenseVector scale(double alpha)
Vector
x=alpha*x
scale
in interface Vector
scale
in class AbstractVector
public Vector set(Vector y)
Vector
x=y
set
in interface Vector
set
in class AbstractVector
public Vector set(double alpha, Vector y)
Vector
x=alpha*y
set
in interface Vector
set
in class AbstractVector
public Vector add(Vector y)
Vector
x = y + x
add
in interface Vector
add
in class AbstractVector
public Vector add(double alpha, Vector y)
Vector
x = alpha*y + x
add
in interface Vector
add
in class AbstractVector
public double dot(Vector y)
Vector
xT*y
dot
in interface Vector
dot
in class AbstractVector
protected double norm1()
norm1
in class AbstractVector
protected double norm2()
norm2
in class AbstractVector
protected double norm2_robust()
norm2_robust
in class AbstractVector
protected double normInf()
normInf
in class AbstractVector
public double[] getData()
Copyright © 2013. All Rights Reserved.