[eigen] Specializing max_coeff_visitor for some number types

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


Hello,

as far as I understand, Eigen uses max_coeff_visitor internally to determine the best pivot to use. And its notion of "best" is the largest in absolute value, which makes a lot of sense for float/double. For other number types, I may have a different notion of best. For example, for a rational, I may want to pick the "simplest" non-zero coefficient, to avoid an explosion in coefficient size. For interval arithmetic, I may want to compare only the lower bounds of the absolute values, or maybe involve the width somehow, but if we call operator< on [.9,1.1] and [.8,1.2], we have lost.

As a quick hack, it looks like I can specialize scalar_abs_op to return something other than the absolute value, but that's ugly and I have to hope that abs is not used anywhere else in Eigen for other purposes.

Any advice?

--
Marc Glisse



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