[Libre-soc-dev] complex numbers as matrices

Richard Wilbur richard.wilbur at gmail.com
Mon Jun 28 17:50:09 BST 2021


> On Jun 25, 2021, at 15:26, 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.
> 
> And matrix inverse is hard to do right.
> […]
> 
> It's not efficient to represent complex numbers as 2x2 matrices.

Another consideration from the practice of electrical engineering:  solving AC circuits with phasors uses vectors and 2-dimensional matrices of complex numbers.  If complex numbers are first-class types, the vector engine can easily handle it.  If we represent complex numbers as 2x2 matrices then the complex vectors will be represented as 3-dimensional real matrices and the complex 2-dimensional matrix becomes a 4-dimensional real matrix.  Here the bloat becomes exponentially worse (if that is how they are stored).  If, on the other hand, it is all sleight of hand with how the vector engine addresses things, then it is merely more complicated to think about.  Can the vector engine handle multiplying a 3-dimensional matrix by a 4-dimensional matrix, yielding a 3-dimensional matrix result?


More information about the Libre-soc-dev mailing list