Let us consider the space of symmetric positive-definite (SPD) $\mathscr{P}^d$ matrices of dimensions $d \times d$. It is well known that this space is a pointed convex cone, which represents a differentiable manifold of finite dimension.
The boundary of such a space, denoted by $\partial \mathscr{P}^d$ is the set of singular positive-semidefinite matrices.
Due to Alexandrov theorem (a convex function $f$ is $C^2$ almost everywhere), I believe (but I am not sure) that the divergence theorem can be applied in such a space. But, again, I am not sure and I struggle to find reference on any application of divergence theorem in such space, clearly the problem is the boundary.
Any suggestions?
EDIT: The space $\mathscr{P}^d$ with its closure is a semialgebraic set. A semialgebraic set can be written as a finite union of smooth manifolds, $\mathscr{R}_r$, where $r=0, 1, ..., n$ represents the rank of the matrix. Then it is clear that $\partial \mathscr{P}^d= \cup_{r=0}^{n-1} \mathscr{R}_r$ and divergence theorem applies for piecewise smooth manifolds. This should be correct.