Hi Stefan, Sorry for the slow reply to this.
Thanks for spotting that. When I fix those lines, I see:
[[ 3.9000001 3.0999999 2.0999999 1.10000002 1.89999998 2.9000001 ] [ 3.9000001 3.0999999 2.0999999 1.10000002 1.89999998 2.9000001 ]]
Actually, I think I made a mistake in my first post of 4 April, when I suggested the first value should be 3.9. I was thinking that the "reflect" mode just mirrors the input (like the "mirror" mode) and then interpolates the resulting values, in which case the first value would be 3.9 and the last would be 1.9 and 2.9. That seems to be what is now happening in your example above. However, I later realized that it is probably supposed to interpolate only within the bounds of the input data and *then* pad the output by "reflecting" the *interpolated* values in the way you describe below. What confused me was the extra 1.9 in the 2nd-last output column, but I think that is just the same problem (calculating one point too many) that I reported and you fixed for the "constant" mode, isn't it? If this is true, I think the (rounded) result should in fact be [[ 3.1 3.1 2.1 1.1 1.1 2.1] [ 3.1 3.1 2.1 1.1 1.1 2.1]] Does that make sense? Sorry if I confused the issue previously. So that's my impression of the intended behaviour, but whether it makes the most sense or not is a different matter; I don't personally have a use for padding with reflected values at the moment. I notice, however, that what I'm describing here can preserve symmetry when doubling the original array size (eg. [ 3.1 3.1 2.1 1.1 1.1 2.1 3.1 3.1 ]), if shifted appropriately, which may be the idea of "reflect" as opposed to "mirror" (otherwise the latter makes more sense to me). Unfortunately, interpolating breaks this symmetry for more general multiples, by unavoidably reducing the number of known values by one.
I'll submit to SVN later today. Note that I also enabled 'mirror' mode, which works almost the same way as reflect:
Reflect: 1 2 3 4 -> 1 2 3 4 4 3 2 1 Mirror: 1 2 3 4 -> 1 2 3 4 3 2 1
Yes, I noticed the mirror mode. It does seem good to have both options. I may have used the words "mirror" and "reflect" interchangeably in previous emails though. Cheers, James.