Re: [eigen] Specializing max_coeff_visitor for some number types |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Specializing max_coeff_visitor for some number types*From*: Marc Glisse <marc.glisse@xxxxxxxx>*Date*: Tue, 8 Apr 2014 18:56:07 +0200 (CEST)

On Tue, 8 Apr 2014, Christoph Hertzberg wrote:

On 07.04.2014 20:33, Marc Glisse wrote:The attached patch doesn't change the result of make check (adolc is still broken, there is a missing -lGL somewhere, and parmetis doesn't chose any MPI so finds none).The adolc test is passing at my machine (that is with current devel, I havenot tested your patch yet):http://manao.inria.fr/CDash/testSummary.php?project=1&name=forward_adolc&date=2014-04-08

Building CXX object unsupported/test/CMakeFiles/forward_adolc.dir/forward_adolc.cpp.o In file included from /data/repos/eigen-pristine/unsupported/test/forward_adolc.cpp:14:0: /data/repos/eigen-pristine/unsupported/Eigen/AdolcForward:81:29: error: ʽadoubleʼ is not a member of ʽadtlʼ template<> struct NumTraits<adtl::adouble> ^ /data/repos/eigen-pristine/unsupported/Eigen/AdolcForward:81:29: note: suggested alternative: In file included from /data/repos/eigen-pristine/unsupported/Eigen/AdolcForward:28:0, from /data/repos/eigen-pristine/unsupported/test/forward_adolc.cpp:14: /usr/include/adolc/adouble.h:350:24: note: ʽadoubleʼ class ADOLC_DLL_EXPORT adouble:public badouble { ^

I don't have METIS installed and strangely, OpenGL is not detected here.

As you can see in LU, there is a subtlety I hadn't thought of: max(abs) was returning a RealScalar, not a Scalar. That's not a big problem when we only want to compare it with 0.I think that m_maxpivot would technically not be needed for rational typesand for interval types, because in neither case we need any kind ofthresholding to determine if a pivot is exactly zero (rational), or ispossibly zero (interval).But that's actually another problem to specialize rank(), and this likelyagain requires different specializations for all decompositions.

I think I didn't break maxPivot() in FullPivLU.maxPivot wouldn't really make sense for rationals, because you are taking a'best' pivot using some other criterion -- of course you can still calculateyour maxPivot, but it has no significant meaning.

householder, SVD, etc would likely need a similar treatment.Of course, but let us do that after we agreed on how to finish this.

Agreed.

That said, maybe there is a need to let the user provide different pivotingstrategies, depending on his needs? Unfortunately, that risks bloating theinterface.

Is the patch roughly the right approach? Where do we go from there?I would consider this the right approach especially as long as we don'tchange existing behavior. But I'd like to hear the opinion of otherdevelopers before going further.

Of course, to make your patch worth the effort, we'd also need an example ofa specialized scalar_better_coeff_op, demonstrating the benefits.

--- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -1446,6 +1446,18 @@ namespace Eigen { MulCost = 10 }; }; + + namespace internal { + template<class> struct scalar_better_coeff_op; + template<bool b> + struct scalar_better_coeff_op <CGAL::Interval_nt<b> > { + typedef CGAL::Interval_nt<b> Scalar; + typedef bool result_type; + bool operator()(Scalar const&x, Scalar const&y)const{ + return abs(x).inf()>abs(y).inf(); + } + }; + } } #endif // CGAL_INTERVAL_NT_H -- Marc Glisse

**Follow-Ups**:**Re: [eigen] Specializing max_coeff_visitor for some number types***From:*Marc Glisse

**References**:**[eigen] Specializing max_coeff_visitor for some number types***From:*Marc Glisse

**Re: [eigen] Specializing max_coeff_visitor for some number types***From:*Christoph Hertzberg

**Re: [eigen] Specializing max_coeff_visitor for some number types***From:*Marc Glisse

**Re: [eigen] Specializing max_coeff_visitor for some number types***From:*Christoph Hertzberg

**Re: [eigen] Specializing max_coeff_visitor for some number types***From:*Marc Glisse

**Re: [eigen] Specializing max_coeff_visitor for some number types***From:*Christoph Hertzberg

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Specializing max_coeff_visitor for some number types** - Next by Date:
**Re: [eigen] news on the refactoring of the expression template mechanism** - Previous by thread:
**Re: [eigen] Specializing max_coeff_visitor for some number types** - Next by thread:
**Re: [eigen] Specializing max_coeff_visitor for some number types**

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