Cellular non-linear networks for minimization of functionals. Part 1: Theoretical aspects