alias quaternion = Algebra!(
float,
"1,i,j,k",
op("1", any) = any,
op("i,j,k", self) = "-1",
op("i", "j") = "k".antiCommutative,
op("j", "k") = "i".antiCommutative,
op("k", "i") = "j".antiCommutative,
);
source:
https://gist.github.com/Biotronic/833680b37d4afe774c8562fd21554c6b
--
Simen
So I was bored in a meeting and decided to implement a generic
template for defining complex numbers, dual numbers, quaternions
and many other possible algebras by simply defining a set of
rules and the components on which they act:
- Somewhat OT: defining algebra... Simen Kjærås via Digitalmars-d
- Re: Somewhat OT: definin... Amorphorious via Digitalmars-d
- Re: Somewhat OT: def... Nick Sabalausky (Abscissa) via Digitalmars-d
- Re: Somewhat OT:... Amorphorious via Digitalmars-d
- Re: Somewhat... Simen Kjærås via Digitalmars-d
- Re: Som... Amorphorious via Digitalmars-d
- Re: Somewhat OT: definin... Mark via Digitalmars-d
