Peter - That shortest summing path is very neat. I have to admit I don't quite see how to jump from the OEIS sequence to a productive implementation though. I think an optimal summation path (raising things to integer powers) would be a nice addition to Eigen.
Hi,
just in case there's interest.
Am 11.05.21 um 01:27 schrieb Marc Glisse:
> Assuming pow is actually your own function and does the usual repeated squaring, unlike std::pow, this may do a lot of redundant computation (in particular base*base is computed many times). Do you know anything about the
> integers? In particular, are they always small? I assume the LinSpaced example doesn't look like the true data. Does your pow function already cache some results?
>
One can use the shortest summation path, see <https://oeis.org/A003313>, to calculate integer powers.
It's not so hard to do. If there's interest I could dig out an implementation I did a long time ago.
Could provide a nice feature for Eigen.
Best regards,
Peter