tBuLi / kingdon

A symbolically optimized and pythonic Clifford (geometric) algebra library named after none other than William Kingdon Clifford.
https://tbuli.github.io/teahouse/
MIT License
45 stars 5 forks source link

Operator dict improvements #17

Closed tBuLi closed 1 year ago

tBuLi commented 1 year ago

Made OperatorDict much more performant by specializing the binary case, which is by far the most common and should therefore be fast. Moreover a UnaryOperatorDict was added to likewise make this extremely common case more performant. I did chose not to seperate out binary into a seperate class however, since most products are not restricted to only two operants but could instead be chained together, if so desired. Additionally fixed #13, which occurs when applying numba to codegen for operators which depend on other operators, such as outerexp, which uses the outer product. Due to the place where we applied numba, the generated outer product could no longer be used on symbolic multivectors. Thus, we had to apply numba later in the process.