Description
Basically the reason you can't index ExplictTangentBundle
s with TaylorTangentIndex
except at the last position is because there are multiple possible ways to compute a given deriviatve of any order -- except the highest order, then you need to do all the things so there is only one way.
In a good world they are all equal but we may not live in a good world.
If we do live in a good world though we can.
And the thing to do is when given a TaylorTangentIndex
check all values that correspond to different paths to get a derivative of that order and if all equal return that value. If not all equal then error as we do not live in a good world.
The canonical index positioned to check are the ones that have count_ones(ii)
equal to the taylor index (the order of the derivative).
Computing this is apparently a well known problem, see this thread on discourse.
Probably for performance reasons want to hard code the indexs to check for order 1 and 2 (maybe 3), then fall back to one of those algorithms.