[eigen] calculating on ranges

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


Hi all,

For calculating curves which consist of multiple peaks, I'd like
evaluate a function on a certain range.

Suppose I have a axis with a 100 data points specified in vector x and
two gaussians that have a significant value over only a small range
(data points 10-20 and data point 50-60). The value of the gaussians
is neglected at other points.

The gaussians can be added to the curve by two calls to this function:

void
addGaussianToCurve(const double*x, double* y, int start, int end,
double a, double b, double c) {
    for (int i=start; i<= end; ++i) {
        y[i] += a*exp(-pow(x[i]-b, 2)/c);
    }
}

Would Eigen offer a more advantageous/faster way of implementing this
function where only a certain range of a vector is used?

Cheers,
Jos



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