Re: [eigen] matrix::linspace

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


On Tue, 26 Jan 2010, Benoit Jacob wrote:

2010/1/26 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
This depends on your application. If you want something like this to work

VectorXd x = VectorXd::LinSpaced(-1.0,1.0,10000);
std:acos(x(0));
std::acos(x(end));

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.

I'd call that a problem specific to acos(), not to the problem at hand!

That depends how you define the problem at hand :)

I'd define it as, LinSpaced(start, end, size) returns a vector with 'size' elements whose first element is 'start' and last element is 'end' such that the distance between consecutive elements is constant up to round-off error.

I wonder, in what practical situation is the performance of linspace a bottleneck? If there are none - and I cannot think of any - then perhaps accuracy is more important than performance.


Jitse



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