I want to understand the properties of the following set of matrices. Given a matrix $R \in \mathbb{R}^{p \times q}$, the set is:
$\qquad \{Q : Q^T \operatorname{diag}(d) Q = R^T \operatorname{diag}(d) R, \quad \forall d \ge 0\}$.
Obviously the equality holds even when we multiply rows of $R$ by $-1$, but are there other transformations that preserve equality? And does this set of matrices have any connection to the concept of simultaneous diagonalization?