|Re: [eigen] Machine precision<> too coarse|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Machine precision<> too coarse
- From: Keir Mierle <mierle@xxxxxxxxx>
- Date: Tue, 3 Feb 2009 08:24:12 -0800
- 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; bh=wZcxYAQ/3ut06NBKbG6mT2u+MgU9G/C/o1uaP1sLyyY=; b=TZXDYFQQleggKH8ws/O5wfTLFZwLil48+7vxahpwWkPTTho+hXVCRVykI7BwJ60TDl l3fKUIHNVACrYvnBrPezDObzo7sEFJiPF1UhL88OpK/Sk1oMYO4ivJIFPkHH80HAdyzc i9SROUwRJ219wbAOLbaMaR+CKqCm8Lyv+YBIQ=
- 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; b=BLKNxJrCuARmfhC6m6NUA5jUAkW2I1Hqc5pV6mL2VuJvBGiVbkVPBqYHm64iekCNDC 4Sy/NzEoDvxsTys/IjFd2qFmvkkDPtQjVQDsvL2OT6t/uiwuA0dEt70ILvlE1X5rnT06 fv172UvaRFb+D/0tRTzpLXdRrJrztiNxTb2zQ=
On Tue, Feb 3, 2009 at 5:31 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
2009/2/3 Keir Mierle <mierle@xxxxxxxxx>:
> Is there a reason that 1e-11 is used for double precision instead of theLet me ask the question the converse way: is there a reason why the
> more conventional 2.2e-16? And same for float precision; why 1e-5 instead of
> 1.2e-7 for floats?
"epsilon" 2.2e-16 should play any specific role here?
If coarser comparisons are needed, then they should be available as different names. Machine precision should indeed be e for which 1 + e = 1.
Matrix operations involve many, many floating point operations. The
imprecision accumulates and at the end of a matrix operation one
cannot hope to be withing the "epsilon" of the correct result.
Here's an example. Invert a random 1000x1000 matrix of double's,
uniformly picked in the interval [-1,1]. Check your computation:
double error = (matrix * matrix.inverse() - Identity ).norm();
If you used full pivoting LU, you'll get an error of the order of 1e-13
If you used partial pivoting LU, you'll get an error of the order of 1e-11
Now Eigen's internal choice of 1e-11 isn't meant for that kind of use
case; it's more meant for smaller internal operations like the ones
the full LU does in order to determine the rank. So the imprecision
doesn't get that big, but still it is much bigger than the epsilon
Certainly. But then there should be a different function available for machine epsilon.
In Eigen's unit tests, an even far coarser choice of precision is used
in order to check the result of large end-user operations for sanity.
Our unit tests generally don't aim to test precision, except for a few
of them (we should have more) which can compare precision to other
libraries such as GSL if they are found. (It's really hard to say
abstractly "this computation must have this precision").