[Libre-soc-dev] complex numbers as matrices

Luke Kenneth Casson Leighton lkcl at lkcl.net
Wed Jun 30 20:18:17 BST 2021

(do remember to trim context, jacob, esp. when replying to long
messages, had to scroll several pages on a tiny screen)

On 6/30/21, Jacob Lifshay <programmerjake at gmail.com> wrote:
> On Wed, Jun 30, 2021, 11:07 Richard Wilbur <richard.wilbur at gmail.com> wrote:

>> complex + complex = 2 scalar additions (covered by vector addition)
>> complex - complex = 2 scalar negations, 2 scalar additions (covered by
>> vector operations)
> wouldn't this just be a vec2 subtraction? no need for separate negation and
> addition...

it would result in the same operations *as if* it was a vec2, yes.
including, interestingly, as far as predicate bits were concerned.

however what happens if you want a vec2 of complexes, this tells us
that the complex number register "tag" has to be conceptually
completely separate from vec2/3/4 rather than try to overload vec2/4
to "provide" complex numbers.

> that's wrong, the correct expression is:
> z = re+i*im
> reciprocal(z) = conjugate(z) / (re^2 + im^2)

good catch i totally missed that, thinking in terms of hardware and
ISAs and... :)

> or in C++ for:
> struct MyComplex {
>     float real, imag;
>     auto operator <=>(const MyComplex &) const = default;
> };

i concur.

although now might not be the best time to mention that a friend who
uses haskell has been developing a geometric algebra library,
involving vectors where you represent things in terms of *areas* and
angles! :)

apparently the math for 3D computation is massively simplified.

but... one thing at a time, ehn? :)


More information about the Libre-soc-dev mailing list