I have a simple question that I have spent ages trying to work around over
the years and still haven't found a satisfactory solution. I have a single
double value, and without any allocation, I need to generate an Eigen
expression that allows me to take a double to an array of integers. In my
case, 25% of my code's execution time is spent working on this problem, and
I think I should be able to get that contribution back to closer to zero.
Initially I asked the question here:
https://stackoverflow.com/questions/25354205/how-to-raise-double-to-array-powers-in-eigen

This code doesn't compile (e.g., on godbolt):

#include <Eigen/Dense>

int main(){
    auto c = Eigen::ArrayXi::LinSpaced(11, 0, 10);
    auto r = Eigen::pow(3.7, c);
}

but if I switch the ArrayXi for ArrayXd it compiles (because the scalar
types match), but that is not what I want.

Really, what I need is to call my own implementation of pow(double, int),
because it is MUCH faster than pow(double, double).

In the end, I would like some guidance on how I can craft an Eigen
expression for this use case that will not introduce any intermediate
allocation.

Thanks,
Ian

Reply via email to