  We consider the problem of decomposing a regular non-negative function as a
sum of squares of functions which preserve some form of regularity. In the same
way as decomposing non-negative polynomials as sum of squares of polynomials
allows to derive methods in order to solve global optimization problems on
polynomials, decomposing a regular function as a sum of squares allows to
derive methods to solve global optimization problems on more general functions.
As the regularity of the functions in the sum of squares decomposition is a key
indicator in analyzing the convergence and speed of convergence of optimization
methods, it is important to have theoretical results guaranteeing such a
regularity. In this work, we show second order sufficient conditions in order
for a $p$ times continuously differentiable non-negative function to be a sum
of squares of $p-2$ differentiable functions. The main hypothesis is that,
locally, the function grows quadratically in directions which are orthogonal to
its set of zeros. The novelty of this result, compared to previous works is
that it allows sets of zeros which are continuous as opposed to discrete, and
also applies to manifolds as opposed to open sets of $\R^d$. This has
applications in problems where manifolds of minimizers or zeros typically
appear, such as in optimal transport, and for minimizing functions defined on
manifolds.
