Re: [eigen] matrix::linspace

[ Thread Index | Date Index | More Archives ]

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
> enough.

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'
> value.

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.

- Hauke

Mail converted by MHonArc 2.6.19+