cov#

cov(x, y, rep_x, rep_y)[source]#

Compute the covariance between two symmetric random variables.

Let \(\mathbf{X}:\Omega\to\mathcal{X}\) and \(\mathbf{Y}:\Omega\to\mathcal{Y}\) with representations \(\rho_{\mathcal{X}}\), \(\rho_{\mathcal{Y}}\). The covariance is computed via the isotypic decomposition from isotypic_decomp_rep(). Covariance contributions between different isotypic types are zero in the constrained model. Hence, in the disentangled/isotypic basis the covariance can be computed in block-diagonal form:

\[\begin{split}\begin{align} \mathbf{C}_{xy} &= \mathbf{Q}_y^T (\bigoplus_{k} \mathbf{C}_{xy}^{(k)} )\mathbf{Q}_x \\ &= \mathbf{Q}_y^T ( \bigoplus_{k} \sum_{b\in \mathbb{B}_k} \mathbf{Z}_b^{(k)} \otimes \mathbf{b} ) \mathbf{Q}_x \\ \end{align}\end{split}\]

Where \(\mathbf{Q}_x^{\mathsf T}\) and \(\mathbf{Q}_y^{\mathsf T}\) are the change-of-basis matrices to the isotypic bases of \(\mathcal{X}\) and \(\mathcal{Y}\), respectively; \(\mathbf{C}_{xy}^{(k)}\) is the covariance restricted to the isotypic subspaces of type k; and \(\mathbf{Z}_b^{(k)}\) are the free parameters—i.e. the expansion coefficients in the endomorphism basis \(\mathbb{B}_k\) of the irreducible representation of type k.

Parameters:
  • x (Tensor) – Realizations of a random variable \(X\).

  • y (Tensor) – Realizations of a random variable \(Y\).

  • rep_x (Representation) – Representation \(\rho_{\mathcal{X}}\).

  • rep_y (Representation) – Representation \(\rho_{\mathcal{Y}}\).

Returns:

The covariance matrix between the two random variables, of shape \((D_y, D_x)\).

Return type:

Tensor

Shape:
  • x: \((N, D_x)\) where \(D_x\) is the dimension of the random variable \(\mathbf{X}\).

  • y: \((N, D_y)\) where \(D_y\) is the dimension of the random variable \(\mathbf{Y}\).

  • Output: \((D_y, D_x)\)

Note

This function calls isotypic_decomp_rep(), which caches decompositions in the group representation registry. Repeated calls with the same representations reuse cached decompositions.