Abstracted inner ADMM loop into a template function typed by two functors F and G that implement the projection and selection functions.