# Transforming rectangular matrices to square ones?

Given two rectangular matrices $$A_{n \times m}$$ and $$B_{m \times r}$$ where $$n \neq m, \ m \neq r$$ and $$r, \ m < n$$. Mathematically, is it possible to convert $$A$$ and $$B$$ to $$A^{\prime}_{n \times n}$$ and $$B^{\prime}_{n \times n}$$ such that $$A^{\prime}_{n \times n}$$ and $$B^{\prime}_{n \times n}$$ hold the same information as $$A$$ and $$B$$ but with zero-padding?

I am asking this because I would like to implement the Coppersmith-Winograd Algorithm which offers $$\mathcal{O}(n^{2.38})$$ instead of the ordinary $$\mathcal{O}(n^{3})$$ matrix multiplication complexity. The algorithm only works on $$n \times n$$ matrices.

If so, what are the precautions I need to be taking care of?

Simply adding out $$\ A\$$ with extra zero columns, and $$\ B\$$ with extra zero rows won't change the product. That is, if you put $$A'=\pmatrix{A&0_{n\times(n-m)}}\$$ and $$B'=\pmatrix{B\\0_{(n-r)\times n}}\ ,$$ then $$\ A'\$$ and $$\ B'\$$ are $$\ n\times n\$$ square matrices with $$\ A'B'=AB\$$.