lstsq#
- lstsq(x, y, rep_x, rep_y)[source]#
Computes a solution to the least squares problem of a system of linear equations with equivariance constraints.
The \(\mathbb{G}\)-equivariant least squares problem to the linear system of equations \(\mathbf{Y} = \mathbf{A}\,\mathbf{X}\), is defined as:
\[\begin{split}\begin{align} &\operatorname{argmin}_{\mathbf{A}} \| \mathbf{Y} - \mathbf{A}\,\mathbf{X} \|_F \\ & \text{s.t.} \quad \rho_{\mathcal{Y}}(g) \mathbf{A} = \mathbf{A}\rho_{\mathcal{X}}(g) \quad \forall g \in \mathbb{G}, \end{align}\end{split}\]where \(\mathbf{X}: \Omega \to \mathcal{X}\) and \(\mathbf{Y}: \Omega \to \mathcal{Y}\) are random variables taking values in representation spaces \(\mathcal{X}\) and \(\mathcal{Y}\), and \(\rho_{\mathcal{X}}\), \(\rho_{\mathcal{Y}}\) are the corresponding (possibly decomposable) representations of \(\mathbb{G}\).
- Parameters:
x (
Tensor) – Realizations of the random variable \(\mathbf{X}\) with shape \((N, D_x)\), where \(N\) is the number of samples.y (
Tensor) – Realizations of the random variable \(\mathbf{Y}\) with shape \((N, D_y)\).rep_x (
Representation) – Representation \(\rho_{\mathcal{X}}\) acting on the vector space \(\mathcal{X}\).rep_y (
Representation) – Representation \(\rho_{\mathcal{Y}}\) acting on the vector space \(\mathcal{Y}\).
- Returns:
A \((D_y \times D_x)\) matrix \(\mathbf{A}\) satisfying the \(\mathbb{G}\)-equivariance constraint and minimizing \(\|\mathbf{Y} - \mathbf{A}\,\mathbf{X}\|^2\).
- Return type:
- Shape:
X: \((N, D_x)\)
Y: \((N, D_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.