public class LazyVector extends AbstractVector implements ISparseVector
Vector.Normsize| Constructor and Description |
|---|
LazyVector(int size)
Constructor for SparseVector.
|
LazyVector(int size,
int nz)
Constructor for SparseVector.
|
LazyVector(int size,
int[] index,
double[] data)
Constructor for SparseVector
|
LazyVector(int size,
int[] index,
double[] data,
boolean deep)
Constructor for SparseVector
|
LazyVector(Vector x)
Constructor for SparseVector, and copies the contents from the supplied
vector.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
double value)
x(index) += value |
void |
compact()
Compacts the vector
|
LazyVector |
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 value array.
|
int[] |
getIndex()
Returns the used indices
|
double[] |
getRawData()
Gets the raw internal data array.
|
int[] |
getRawIndex()
Gets the raw internal index array.
|
int |
getUsed()
Number of entries used in the sparse structure
|
java.util.Iterator<VectorEntry> |
iterator() |
protected double |
norm1() |
protected double |
norm2_robust() |
protected double |
norm2() |
protected double |
normInf() |
LazyVector |
scale(double alpha)
x=alpha*x |
void |
set(int index,
double value)
x(index) = value |
Vector |
set(Vector y)
x=y |
LazyVector |
zero()
Zeros all the entries in the vector, while preserving any underlying
structure
|
add, add, check, checkSize, norm, set, size, toStringpublic LazyVector(int size,
int nz)
size - Size of the vectornz - Initial number of non-zerospublic LazyVector(int size)
size - Size of the vectorpublic LazyVector(Vector x)
x - Vector to copy from. A deep copy is madepublic LazyVector(int size,
int[] index,
double[] data,
boolean deep)
size - Size of the vectorindex - Indices of the vectordata - Entries of the vectordeep - True for a deep copy. For shallow copies, the given indices
will be used internallypublic LazyVector(int size,
int[] index,
double[] data)
size - Size of the vectorindex - The vector indices are copies from this arraydata - The vector entries are copies from this arraypublic void set(int index,
double value)
Vectorx(index) = valueset in interface Vectorset in class AbstractVectorpublic void add(int index,
double value)
Vectorx(index) += valueadd in interface Vectoradd in class AbstractVectorpublic double get(int index)
Vectorx(index)get in interface Vectorget in class AbstractVectorpublic LazyVector copy()
Vectorcopy in interface Vectorcopy in class AbstractVectorpublic LazyVector zero()
Vectorzero in interface Vectorzero in class AbstractVectorpublic LazyVector scale(double alpha)
Vectorx=alpha*xscale in interface Vectorscale in class AbstractVectorpublic double dot(Vector y)
VectorxT*ydot in interface Vectordot in class AbstractVectorprotected double norm1()
norm1 in class AbstractVectorprotected double norm2()
norm2 in class AbstractVectorprotected double norm2_robust()
norm2_robust in class AbstractVectorprotected double normInf()
normInf in class AbstractVectorpublic double[] getData()
getData in interface ISparseVectorpublic int[] getIndex()
getIndex in interface ISparseVectorpublic int[] getRawIndex()
public double[] getRawData()
public int getUsed()
getUsed in interface ISparseVectorpublic void compact()
ISparseVectorcompact in interface ISparseVectorpublic java.util.Iterator<VectorEntry> iterator()
iterator in interface java.lang.Iterable<VectorEntry>iterator in class AbstractVectorCopyright © 2019. All Rights Reserved.