[eigen] Sparse API

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

just a quick API debate: To efficiently fill a sparse matrix we
currently provide:

SparseMatrix<double> mat(rows,cols);
mat.startFill(<approximate_nnz>);
  for()
    mat.fill(i,j) = value;
mat.endFill();

with some constraints on the order of the i,j indices. There is also a
variant (fillrand) with relaxed constraints. (to know all the details
check the tutorial:
http://eigen.tuxfamily.org/dox/TutorialSparse.html#TutorialSparseFilling)

However a common requirement is that the coefficient i,j must not
already exist (otherwise you get a runtime assertion). To make it more
clear in the API, I wanted to remove the fill*() functions in favor or
something like:

mat.insert(i,j, value);

the drawback is that makes difficult to remember the order of the
arguments, i.e., do I have to write mat.insert(value, i, j) or
mat.insert(i,j,value) ?? I have myself the same "problem" with
setConstant(). Any idea, suggestion regarding this part of the sparse
API ? Other possible changes include:

fill(i,j) => insert(i,j)=v, insertSorted(i,j)=v, insertInnerSorted(i,j)=v
fillrand(i,j) => insertRand(i,j)=v, insertRandom(i,j)=v,
insertInnerRandom(i,j)=v
startFill() => startFilling(), startInsertions()  (note that
startFill() clear the matrix)
etc.


Thanks,
gael.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/