  We introduce a S.O.S hierarchy of lower bounds for a polynomial optimization
problem whose constraint is expressed as a matrix polynomial semidefinite
condition. Our approach involves utilizing a penalty function framework to
directly address the matrix-based constraint, making it applicable to both
discrete and continuous polynomial optimization problems. We investigate the
convergence rates of these bounds in both problem types. The proposed method
yields a variation of Putinar's theorem tailored for positive polynomials
within a compact semidefinite set, defined by a matrix polynomial semidefinite
constraint. More specifically, we derive novel insights into the convergence
rates and degree of additional terms in the representation within this modified
version of Putinar's theorem, based on the Jackson's theorem and a version of
{\L}ojasiewicz inequality.
