|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

java.lang.Objectnet.sourceforge.combean.mathprog.linalg.statics.SparseVectorConverter
public final class SparseVectorConverter
Collection of static helper functions to convert SparseVectors to plain Java arrays.
| Constructor Summary | |
|---|---|
SparseVectorConverter()
|
|
| Method Summary | ||
|---|---|---|
static double[] |
convertToDoubleArray(int dim,
SparseVec<NoLabel> vec)
Convert SparseVec to plain double array |
|
static double[] |
convertToDoubleArray(int dim,
VectorIterator<NoLabel> itVec)
Convert a sparse vector given by an iterator over its components to a plain double array |
|
static double[] |
convertToDoubleArray(SparseVector vec)
Convert SparseVec to plain double array, giving the double array the exact dimension of the sparse vector. |
|
static
|
convertToIndexAndDoubleArray(SparseVec<T> vec,
int[] indexArr,
double[] valueArr)
Convert an SparseVec to two plain Java arrays, one containing the indices of non-zero entries and a double array containing their values. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SparseVectorConverter()
| Method Detail |
|---|
public static double[] convertToDoubleArray(int dim,
VectorIterator<NoLabel> itVec)
dim - the dimension of the dense output double arrayitVec - the iterator over the entries in the sparse vector
public static double[] convertToDoubleArray(int dim,
SparseVec<NoLabel> vec)
dim - desired dimension of the output array. must be big
enough such that all entries in vec fit into the outputvec - the vector to be converted
public static double[] convertToDoubleArray(SparseVector vec)
vec - the vector to be converted
public static <T> void convertToIndexAndDoubleArray(SparseVec<T> vec,
int[] indexArr,
double[] valueArr)
vec - the vector to be convertedindexArr - the index array to be filled. must be large enough
to accomodate all entries of vec.valueArr - the value array to be filled. must be large enough
to accomodate all entries of vec.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||