Summary: | obtain the coefficients of the indices for a row/colwise call to maxCoeff | ||
---|---|---|---|
Product: | Eigen | Reporter: | abachrach |
Component: | Core - general | Assignee: | Nobody <eigen.nobody> |
Status: | DECISIONNEEDED --- | ||
Severity: | Feature Request | CC: | abachrach, chtz, gael.guennebaud, jacob.benoit.1, rmlarsen |
Priority: | Normal | ||
Version: | 3.4 (development) | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Bug Depends on: | 984 | ||
Bug Blocks: |
Description
abachrach
2012-01-05 22:49:47 UTC
Just looked into attempting this, and unfortunately think it's well above my pay grade (for now :-p) As far as I can tell, it'll require fairly major changes to the VectorWiseOp class because it currently only allows Unary Expressions. I could be (probably am) wrong though... I'm afraid this is a bit complicated, due to lazy evaluation. At the moment test.rowwise().maxCoeff(); does nothing until it is assigned to a variable or individual coefficients are evaluated. That would be very non-intuitive for the requested variant. Maybe an alternative would be to essentially return a pair of two arrays (essentially, this is what Matlab does) -- I don't know how well this can be implemented with lazy evaluation, though. A simpler solution would be to simply implement a maxCoeffIdx() which only returns an index vector. Or maybe it's possible to disable lazy evaluation for this expression? +1 Christoph, I think having something like the maxCoeffIdx() you suggest (and perhaps a companion maxCoeffVal()) would be very helpful. Another idea would be implementing the technique suggested in Bug 984, i.e. something like vals, idxs = test.rowwise().maxCoeff(); or (vals, idxs) = test.rowwise().maxCoeff(); -- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/401. |