# [Libre-soc-dev] complex numbers as matrices

Luke Kenneth Casson Leighton lkcl at lkcl.net
Fri Jun 25 22:55:31 BST 2021

```On 6/25/21, Hendrik Boom <hendrik at topoi.pooq.com> wrote:

> Representing a complex number as a matrix makes it into a 2x2 matrix of
> reals,
> That means more data manipulation for the same complex number.

double the amount, right?

however what if you had A as a 2x2 matrix (ab) and B as a 1x2 vector (ef)?

(a -b  (e
b  a)  f)

result is
(ae - bf)
(eb + af)

where the original was....

A = a + bj
B = e + fj

so A*B = ae - bf + (af + be)j

and yes it's the same! awesome.

the reason that's awesome is because we have a REMAP schedule system
capable of doing matrix-vector multiplication.

and if we have a scheduler for 2x2 matrices, it is quite
straightforward to embed *that* schedule into a larger one that
performs batches of them to create FFTs.

the only slightly awkward thing is, that's now 4 nested for-loops.
have to see if there's space.

>
> And matrix inverse is hard to do right.  There's a lot of numerical
> analysis on the subject,
> It turns out that just about any operation that can be elegantly written
> using a matrix inverse can better be done by a different algorithm

interesting. appreciated.

l.

```