Registered Member
|
Hi,
I was wondering if Eigen supports blocks with nonconsecutive rows/columns yet. Variations of this feature has been requested several times already (I didn't want to necrobump these posts, so I created a new one): viewtopic.php?f=74&t=97652 viewtopic.php?f=74&t=98093 viewtopic.php?f=74&t=98382 However, I can't find anything in the changelogs about this feature being implemented. I'm using Eigen for a machine learning application where I have a large matrix from which I repeatedly choose subsets of rows for linear regression. It'd be nice to not have to copy data around in each iteration. Thanks, Joseph |
Registered Member
|
For a similar problem, I worked around this as follows:
initilization: - pre-allocate a matrix 'sub' for the subset. per iteration: - use sub.row() or sub.col() to copy data into the subset (copying is much faster than memory-allocation) - use sub.block().triangularView<Eigen::Upper>().solveInPlace(x) to solve for a variable number of parameters, without memory re-allocation. I suspect the copying can be prevented by being clever with the permutation matrix. It is my understanding that Eigen's current implementation requires the permutation matrix to have full rank, which is cumbersome in this case, I assume. |
Registered Member
|
This is essentially what I'm doing already. Can you explain your comment on permutation matrices? Are they an extra parameter into the solve function or something?
|
Registered Member
|
There's a permutation class in Eigen: http://eigen.tuxfamily.org/dox-devel/classEigen_1_1PermutationMatrix.html The subset could then be defined as:
Eigen is then probably capable of doing all computations efficient. I've never tried it, though, so I have no idea whether this would actually work. |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]