Rewritting the FE formulation
I rewritten the formulation (up to section 2.2.3), in an actual FE context (already discretized).
Please, let me know if this is what you are implementing (and eventually merge). If you confirm that, we can start addressing the singularities (discussing before how you are "convolving" the gradient and the images discrepancies)