Only the weight matrix is updated inside the loop. There is no point in setting the system of equations on each iteration.
The copyright owner is Jorge Gil and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit