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

Cesar Strauss cestrauss at gmail.com
Sun Jul 4 23:14:54 BST 2021

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] *

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.



More information about the Libre-soc-dev mailing list