Re: [eigen] precision |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] precision*From*: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>*Date*: Fri, 8 May 2009 01:33:35 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=RiEb17eak2UMZcBAaN0imKiV/MEXC7sldrNu71U+23Y=; b=TscvxUqOftq1iGaOrxMBNylY9Q+/lHrdJMoIWAoxFnAU9YZ/UCvepmkQZNnSwCzUVz nbq5NjdCL1zkgSNYf6DkWTn8W4G1MI6M3s6oMVq8da5/Vbo8vGyERBxtouhR7fxo2ZPF Sq5tskzyJ5vJnmtmnOhS96K9ry6/8MGsD72kE=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=W5sOz4jtqqclwvI5j3VYHEHulO0q1b4CAXy5iVOm8mdZDePD0R7tWNcmXHWuzXd/Z6 zaCwRgD/J50dZvp5c0rahPcQXh3xTworCYULYdF7qqXCP9pTQg76mYFMm1xjR+gi6Dls UF/XDlF08HfV9QV7h0iZPVjdwLPE/kmIzcnlU=

Hi, 2009/5/8 Michael Meyer <mjhmeyer@xxxxxxxxx>: > > Hello, > > This is my first post to the list. > I am very impressed with the design of this library and could not believe the benchmarks when I saw them. > So the following comments are intended to be constructive: > > I think the precision (MathFunctions.h) is generally set too low > (I am on version 2.01, haven't switched to 2.1 yet). > Of course it depends on the context what a reasonable value is. In fact, your post is very timely as we've been working on similar issues ... today. A very, very long time ago, in the times of Eigen 0.9, I decided to introduce global precision levels (precision<T>()) and all-purpose fuzzy comparisons: that is ei_isMuchSmallerThan (when used with default precision parameter), etc, that you spotted. For a very long time, these were used absolutely everywhere in Eigen, regardless of context. Including in decomposition algorithms. Then a few monthes ago, Keir coded LDLt decomposition based on a different fuzzy comparison paradigm: he found a research paper on LDLt explaining what was the optimal fuzzy comparison to use internally in the computation of the LDLt, as a function of the machine-epsilon and of the matrix size. Then today, Hauke and myself investigated what was the best fuzzy comparison to use internally in the LU decomposition, see the other thread. Conclusions: 1) When we know enough _context_, for example when we're in the middle of a big decomposition algorithm, we can and should use specially tailored fuzzy comparisons. Only experiment can tell which fuzzy comparison is best in a particular situation. You mention Hessenberg decomposition, well this decomposition needs to be reworked in the first place and once this is done we need to experiment with various precision levels as in the other thread about LU. 2) However there will always be a need for the general "context-blind" fuzzy compare. Here, what's open for discussion is the particular value of precision<T>() to use. I was just thinking that the value for double, 1e-11, was a bit too coarse. I was about to propose replacing it by 1e-13. But it certainly doesn't make sense to replace it by 1e-20 as that would mean that ei_isApprox is just the same as operator== ! > > I played around with the Hessenberg tridiagonalization applied to the Hilbert matrix H in dimension 400 > (scalar type double, H=QTQ', T tridiagonal, Q orthogonal) and checked how close H-QTQ' is to the zero matrix > using the L1-norm. > > The norm of the Hilbert matrix is || H || = 550 > > With the value of precision<double> as in the distribution I got > > || H - QTQ' || = 4.4e-4 > > I then set precision<double> to 1e-20 and got > > || H - QTQ' || = 2.8e-8. > > Setting the pecision even higher did not improve the result. > The code is attached, sorry no includes since I renamed some the files: What this says is rather, as I discuss above in 1), that this decomposition algorithm should use a custom fuzzy compare. Cheers, Benoit

**Follow-Ups**:**Re: [eigen] precision***From:*Benoit Jacob

**References**:**[eigen] precision***From:*Michael Meyer

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] precision** - Next by Date:
**Re: [eigen] precision** - Previous by thread:
**[eigen] precision** - Next by thread:
**Re: [eigen] precision**

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