|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: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 3 Feb 2009 14:31:28 +0100
- 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=pSKPw2LTy8231Q7DcgWln9kXmGk61xr8FagWiHRsze0=; b=GKxyJ60j4P3iyx4Fff4c/n9L4Nueg9m8R0+1xgVy/Fc/UF5xmxD4kxf7BUKle/Lw0U 5w7e1cbVg9X57nV/Kj9AMmuBe5D/KMXVyXAWV2+TxwKaZpwJtfN4jSn9eZukWfFnSZIT bRJ+j36Iqcj7g/r6FAy8dENXiGtFK1kuMOKTU=
- 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=fNhM53fs0cBaQGuIwpNdR391e3MOsqPL/YWLQPwPabxc5aUQkx1921s7YMiI6YnO7I m4PUy2LaBXp8LdXPqRzi5M7cvEXIKbiSi0jPfpqEvNk3hOIHOqQBWTg7wpNngYRtM7Uz 4c7OKvnr5eJi2nVhqu2GjHVOKiJmkGRoE43E0=
2009/2/3 Keir Mierle <mierle@xxxxxxxxx>:
> Is there a reason that 1e-11 is used for double precision instead of the
> more conventional 2.2e-16? And same for float precision; why 1e-5 instead of
> 1.2e-7 for floats?
Let me ask the question the converse way: is there a reason why the
"epsilon" 2.2e-16 should play any specific role here?
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
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").