Consider the space
$$ S = \left\{ A \in \mathbb{R}^{n \times n} : \mathrm{SpectralRadius}(|A|) \leq 1 \right\}$$
where $|A|$ is the entry-wise absolute value. Given a matrix $M \in \mathbb{R}^{n\times n}$ such that $M \not \in S$. Is there a way to solve
$$\arg\min_{\hat M \in S} \Vert M - \hat M \Vert$$ for some matrix norm $\Vert \cdot \Vert$? That is, is there a (hopefully somewhat simple) operator that projects onto $S$ for some matrix norm?
For context, I'm interested in optimising a function $f:\mathbb{R}^{n\times n} \rightarrow \mathbb{R}$ over this space using stochastic gradient descent. This means that I'd have to perform this projection after every optimisation step. I know that in general $S$ is non-convex and so I won't have any guarantees.
Edit: I'm interested in the case with the absolute value. However, someone noted in a comment that the scenario may simplify if we consider the space $$S' = \left\{ A \in \mathbb{R}^{n \times n} : \mathrm{SpectralRadius}(A) \leq 1 \right\}$$ Maybe to start, is there a simpler answer in this case?