For $p,q \geq 0$ and $n=p+q\geq 1$, give $\mathbb{R}^n$ the indefinite inner product (written as a matrix) $ \begin{pmatrix} I_p & \\ & -I_q \end{pmatrix}, $ where $I_m$ is the $m \times m$ identity matrix. For example, if $\{e_i\}$ is a basis of $\mathbb{R}^n$ and $X = X^i e_i,$ then $ |X|^2 = (X^1)^2 + \cdots + (X^p)^2 - (X^{p+1})^2 - \cdots - (X^{p+q})^2.$
Let $\mathrm{O}(p,q,\mathbb{R})$ be the Lie group of all linear transformations $T : \mathbb{R}^n \rightarrow \mathbb{R}^n$ that preserve this indefinite inner product.
What is the Lie algebra of $\mathrm{O}(p,q,\mathbb{R})$? Does it admit a ``nice'' description when $p$ and $q$ are both positive?