[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Sparse API
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 3 Feb 2009 11:30:10 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=Fq3C7sgK7D7aYBZbCXZKQ2J+hkqiF2NelqXTuRBinyM=; b=sK/aASleIBK30gE+Wuw+2Fo0mfsSPBygjqEryt21GFMtDb/gdROMiPutvTF2bYI2yx y/EhBjp6bsNuqxMvHSwKbjlN6hXCQtW/gyXHRxiSvZbNjHTijlND/w1h8OiuKYovyCtv 2DDkU7RlOFLEaSqKZ6KEyAtietazAqYzxc+r8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=HedCrN7XW6p9KAOgcHCgp2GU41Uosf/S+ZgT6TbWopLvibhYO1DZ/cA0my9PJWrybC Tu6Fgv7SbCnVoAycz7oUEP967WARky/kWRDy2WnHAsd5w0HbL8F/HiuAY28nOjtpAX3u hJGkM38n7YOgSJDuW3Dp+yGaK1EkEWPMHHNDQ=
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.