# [Libre-soc-dev] [RFC] Matrix and DCT/FFT SVP64 REMAP

Hendrik Boom hendrik at topoi.pooq.com
Mon Jul 5 12:31:23 BST 2021

```On Sun, Jul 04, 2021 at 07:14:54PM -0300, Cesar Strauss wrote:
> On 07/02/2021 21:56, Luke Kenneth Casson Leighton wrote:
> > hm. to create the appearance of matrix multiply as 3 flattened arrays,
> > if the formula is this:
> >
> > for x in x_r:
> >  for y in y_r:
> >    for z in z_r:
> >      result[y][z] +=
> >         a[x][y] *
> >         b[x][z]
> >
> > (something like that)
>
> More precisely:
>
> for y in y_r:
>  for x in x_r:
>    for z in z_r:
>      result[y][x] +=
>         a[y][z] *
>         b[z][x]

This nesting of loops works for matrix multiply, but not for transitive
closure.

-- hendrik

>
> For C = A*B, the inner loop goes "horizontally" (along a row) on matrix
> A and "vertically" (along a column) on matrix B.
>
> It also means that the number of columns of A must be equal to the
> number of rows of B. In other words, A has the shape of (y_r) x (z_r)
> while B is (z_r) x (x_r).
>
> The result then has the same number of rows than A, and the same number
> of columns than B, or (y_r) x (x_r).
>
> I don't think there can be such a thing as an "in-place" algorithm for
> matrix multiplication.
>
> Regards,
>
> Cesar
>
> _______________________________________________
> Libre-soc-dev mailing list
> Libre-soc-dev at lists.libre-soc.org
> http://lists.libre-soc.org/mailman/listinfo/libre-soc-dev

```