|Re: [eigen] matrix::linspace|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] matrix::linspace
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Tue, 26 Jan 2010 20:55:17 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=6m2dK2ZOvEHsSjbIIavb/+4t4SClBQJWza26MSBTjuU=; b=jCY1BBe5HoSHn/NburArLhI5Ypk1h1m8bsOsVW7urnHtqpTEz9T65BCoh9uJwmp54v X4KnpLfShLkOfFLa3r8UCeexTLJgUkO13LZiQ9qMPccp4BV5I7t/8FuJmw7VAg7yRxuq ryq0+tPeLuQZO935FxPtQXuXTWML9xR88zhow=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=NFoCqbojHencCW0e8UtYY4QhqGmPqZFL2gdFIQRfWvPUyjn9wR3GpxGwKHMTnS/sdH rLUdIJnMAG9thD8wvJcifHu8tPD+E+SVAgJaAvnqTgRYL7nkzqVWSm15hh5l1c/w6SLh 4KCT6M9ZyEXWsil7AQta7OV2FN9do7KaKiq6M=
On Tue, Jan 26, 2010 at 7:56 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> Hm. "high = (size-1)*s" is true to machine precision which is good
This depends on your application. If you want something like this to work
VectorXd x = VectorXd::LinSpaced(-1.0,1.0,10000);
it better be in range or you'll end up with NaN when x(0)<-1 or
x(end)>-1. But maybe that's too application specific.
> The only idea that I see is that every, say, 8 iterations, you
> recompute the product with a multiplication (thus you get something
> good to machine precision) and you forget about the 'accumulated'
This will seriously decrease performance. I am just reading a bit over here
and I might give the 'Kahan Summation Formula' a try. At least it does
not include additional 'if' clauses.