[eigen] array functionality...

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


I want to quickly compute

sum_i alpha_i * std::exp( - gamma * (x - y_i)' * (x - y_i) )

Seems like a good candidate for Array, so I tried

ArrayXXd y;
ArrayXd x;
Array<double,1,Dynamic> alphas;

Array<double,1,Dynamic> norms =
x.replicate(1,y.cols()).colwise().squaredNorm(); // does not work,
needs a .matrix()
double val = (alphas * std::exp( -gamma * norms )).sum(); // does not
seem to be using SSE exp

Is it correct, that SSE exp is currently not used?
What do you think about allowing .colwise().squaredNorm() on arrays?

I need to verify this, but it feels as if the replicate implementation
is currently (at least on MSVC) slower than a hand crafted for loop

for (int i=0; i<size; ++i)
 norms(i) = (x - y.col()).matrix().squaredNorm();

Any hints would be welcome.


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