Given a matrix $M^{n \times n}$, I would like to decompose it into two smaller matrices $A^{n \times m}$ and $B^{m \times n}$, with $m < n$ so that the multiplication of both $AB = M'$ approximates $M$ as best as possible.
Is there any algorithm that does this? And computationally efficient?
As additional information, the values in $M$ are sparse and all positive.
You can replace a matrix $M$ easily by two smaller matrices $A$ and $B$ such that $M'=AB$ is as close to $M$ as possible in the Frobenius norm. This can be achieve numerical efficiently and stable via calculating the singular value decomposition, $$M=U \Sigma V^\dagger.$$ You get the required decomposition by keeping only the $m$ largest singular values in $\Sigma$, and setting $$A=U', \qquad\text{and} \qquad B= \Sigma' V^\dagger;$$ here, $\Sigma'$ s the same matrix as $\Sigma$ except that it contains only the $m$ largest singular values, and $U'$ is the same as $U$ just retaining the rows corresponding to the largest singular values. More information can be found here.