Hi,
is it allowed and OK to pass multiple times the same parameter to a single call to AddResidualBlock? A bit more context:
say I have a cost function that is evaluated for each pixel of an image, and this cost function depends on the respective 3x3 image block. For boundary pixels, I apply the same stencil but with boundary values mirrored. So the idea would be to write a single and simple cost function, and handle boundaries when creating the residuals, e.g., for a corner pixel, I would call:
AddResidualBlock(new my_cost(), 0,
&img(0,0), &img(0,0), &img(1,0),
&img(0,0), &img(0,0), &img(1,0),
&img(0,1), &img(0,1), &img(1,1));
and expect that the jacobian contributions of the duplicated parameters to be properly added (whether using analytic derivative or auto-diff).
Gaël.
BTW, I found the documentation of CostFunction::Evaluate misleading because (1) there is a confusion between parameter_block_sizes_.size() and parameter_block_sizes_[i], and (2) the index i here has not the same meaning that the index i of f_i a few lines above. Or is it just me who's not awake?