|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.combean.mathprog.linalg.SparseVectorWithConstantPattern
public class SparseVectorWithConstantPattern
A vector which has a constant non-zero value only in a block with indices that follow a simple arithmetic progression. A simple example is a vector with a non-zero consecutive block like v = [0, ..., 0, 2, 2, ..., 2, 0, ... 0]. A more complex example would be w = [0, ..., 0, 3, 0, 3, 0, ..., 3, 0, ... 0], where we would have an arithmetic progression with length 2.
Constructor Summary | |
---|---|
SparseVectorWithConstantPattern(int dim,
double val)
Construct a vector with a constant value everywhere. |
|
SparseVectorWithConstantPattern(int dim,
double val,
int from,
int to)
Construct a vector with a constant value in a consecutive block. |
|
SparseVectorWithConstantPattern(int dim,
double val,
int from,
int to,
int incr)
Construct a vector with a constant value in a arithmetic progression. |
Method Summary | |
---|---|
int |
getDimension()
Get the dimension of the vector. |
int |
getFrom()
|
int |
getIncrement()
|
int |
getNumIterations()
Return the number of entries of the vector through which the iterator returned by getIterator() iterates. |
int |
getTo()
|
double |
getVal()
|
VectorIterator<NoLabel> |
iterator()
Get an iterator which iterates through all non-zero entries of the vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SparseVectorWithConstantPattern(int dim, double val)
dim
- dimension of the vectorval
- the constant value of all elements of the vector.public SparseVectorWithConstantPattern(int dim, double val, int from, int to)
dim
- dimension of the vectorval
- the constant value of all elements of the vector.from
- the start index of the non-zero blockto
- the end index of the non-zero blockpublic SparseVectorWithConstantPattern(int dim, double val, int from, int to, int incr)
dim
- dimension of the vectorval
- the constant value of all non-elements of the vector.from
- the start index of the non-zero blockto
- the end index of the non-zero blockincr
- the increment of the arithmetic progressionMethod Detail |
---|
public int getDimension()
SparseVector
getDimension
in interface SparseVector
public VectorIterator<NoLabel> iterator()
SparseVec
iterator
in interface SparseVec<NoLabel>
public int getNumIterations()
SparseVec
getNumIterations
in interface SparseVec<NoLabel>
public final int getFrom()
public final int getTo()
public final double getVal()
public final int getIncrement()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |