My apologies for the delay, but I finally got a chance to look at the problem you described. Your bug report is true, but the cause and the solution of the problem is not quite correct. Here is why:
DetectStructure is supposed to detect the static structure in the Jacobian matrix only for rows that contain an e-block, because the template specialization in the schur eliminator is only supposed to be used for rows with e-blocks. For rows without e-blocks, we are careful not to use template specialized code. Except for the one case you pointed out, where I was updating the diagonal blocks of the Schur complement using the statically detected f-block size.
So the solution is not to modify detect_structure.cc but to fix the schur eliminator. Please take a look at
and I believe it should solve the problems you are seeing. I have also added better documentation to detect_structure.h.
The fix to detect_structure that you proposed is actually not wrong. It would fix the problem, but it would do so by reducing the number of cases in which we can use a fixed f-block size. Since the bulk of the rows in which we use the Schur eliminator contain e-blocks, it is better from a performance point of view to try and use as much statically sized matrix operations as possible.
Sameer