clifford
clifford copied to clipboard
Introduce a scalar product function (and operator)?
Today, all of the following are ways to compute scalar products
-
(a * b)[()]
-
(a | b)[()]
-
(a << b)[()]
-
(a * b)[0]
-
(a | b)[0]
-
(a << b)[0]
The problems with these approaches are:
- 1 and 4 compute a lot of unwanted terms
- 2 and 5 compute some unwanted terms
- 3 and 6 compute fewer unwanted terms
- 4, 5, and 6 fail if
a.layout._basis_blade_order.bitmap_to_index[0] != 0
.
It would be straightforward to compile a smt_func
in the same way we compile the other functions.
The question is, what should the API look like?
Some options:
-
a @ b
- treads on the toes of #267 -
a % b
-
a // b
- weird, because//
suggests division -
clifford.operator.sp(a, b)
-
a.sp(b)
-
a.scalar_product(b)
- ...
Other libraries:
- Ganja: no scalar product operator
- tpga: no scalar product operator
- garamon:
a.scalarProduct(b)
- Galgebra:
- docs suggest
&
was once the scalar product operator, but not implemented -
a.Ga.scalar_product(a, b)
- docs suggest
-
Galgebra.jl
:A ⊛ B