|[eigen] sub-matrix extensions|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] sub-matrix extensions
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Fri, 6 Feb 2009 09:39: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=5YyAYovK8miEmS7TJFefY+fuAs53Dx7N0LD8ra6SRZ8=; b=RcTNOBqHYXzsm7Tyt0kOEEzXrAv/lIvbhEvPfmGowA0LWnUuSKZ31MN+M61MrU5WZ9 VNyO1Wb+R033Ez77bTTX+RlWOF0pOzUxPMrVXIOtxW7BmN6notWhjwrcf/gs/Yy0fWjf 5t2w2qbtWXOodAABegRdddla4VjbLcH0mWmSM=
- 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=XcOvCJkS1XVtJYH7Bfm7sr1NxMra1udK9uKmUz/656T+27pMDNMPDz5WDRqFG0WDYz /tgCbKb9ldqgTYsY/mRrKhcrq+mmx5hBsl3x9UdIPmALb+SD9Qa/fnN7OJOeGAtMiQyu 23blNaJI//7JQdi6MXM+i8ojkMe/p9tS+9+aE=
I'd like your opinion about sub/super diagonal and an "every" expression API.
** sub/super diagonal expression **
I recently added sub/super diagonal expressions by extending diagonal
(like matlab). Example:
mat.diagonal<1>() <=> 1st super diagonal
mat.diagonal<-2>() <=> 2nd sub diagonal
a) currently the sub/super diagonal index must be a compile time
integer. Do you think it is worth it to add support for runtime index
? (aka do you have a use case for that)
b) Do you like the reuse of diagonal() with negative indices to
address sub-diagonals ? or would you prefer something more explicit
The advantage of the current solution is that you can use meta
programming to address either the 1st sub or super diagonal of a
lower/upper triangular matrix. So it is more flexible.
** "Every" expression **
Then there is the problem of accessing every elements, columns or rows
with a given stride. Proposal:
vec.every(2) => would return a reduced vector expression (half size)
with all even coefficients.
mat.every(2) => would "remove" all odd columns and rows
mat.colwise().every(2) => would return all even rows. Yes all even
rows and not even columns because colwise().every(2) has to be read as
"for each column call .every(2) on it". Just like all other
colwise()/rowwise() functions. Now I can understand that might be
confusing. This is why I'm asking here:
a) is it really confusing for someone ?
b) if yes, then any better naming idea to overcome the ambiguity ?
(eg.: mat.everyCols(2), mat.everyRows(2) ?)
c) here I have a use case where runtime strides are needed, but do
you think we also need compile-time strides ? (probably yes)
d) do you think bidirectional strides might be useful ? eg:
mat.stride(2,3) (picks the intersections of all even rows and k*3
For the implementation the "every" functions would probably simply
return assemblies of Map and Block expressions.