Re: [eigen] Specializing max_coeff_visitor for some number types

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


On 07.04.2014 15:38, Marc Glisse wrote:
On Mon, 7 Apr 2014, Christoph Hertzberg wrote:
I would rather suggest to out-factor a method find_best_pivot which
then can be specialized for special types.

At what point exactly should it split? The easiest would be that LU calls:

DenseBase<Derived>::bestPivotCoeff(IndexType* index) const

which visits with a best_coeff_visitor, which uses
internal::scalar_better_coeff_op, which by default compares the absolute
values. But then we lost the parallelism in computing the absolute values.

I think this is a good point to split. We don't use SIMD-parallelism in abs() at this point, because the expression is later used by a non-parallel operation and it is so cheap that evaluating it to a temporary is not worth it. Theoretically, better_coeff_op could be implemented to also provide a packet operation (which needs to be finalized with a reduce() operation at the end), but I guess most of the time finding the pivot is negligible compared to the heavy matrix operations during decomposition.

For interval types, I guess the element with the biggest lower bound
is generally to be preferred (however it depends on if you want to
determine the best possible decomposition for a given matrix, or the
worst-case scenario what could happen when decomposing with standard
floating point types).

I want the best in my case (well, not necessarily the best, but one good
enough). And the biggest lower-bound is just a simple heuristic, given
the choice between (1,1) and (2,20) I'd pick the first interval as the
better pivot ;-) But it may not be worth doing anything more subtle.

Hm, well the question is for a matrix, e.g.,
  [ (1,1)  row1 ]
  [ (2,20) row2 ]
whether
  row2 - (2,20)/(1,1) * row1
or
  row1 - (1,1)/(2,20) * row2
is better (simplified example). But I agree that simply using the element with the bigger lower bound may not always be the best choice.


Christoph


--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



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