tfga
tfga copied to clipboard
Add exp and log
Here's how galgebra solved exp: https://github.com/pygae/galgebra/blob/b5eb070340434d030dd737a5656fbf709538b0b1/galgebra/mv.py#L1093-L1145
https://www.euclideanspace.com/maths/algebra/clifford/algebra/functions/exponent/index.htm
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4361175/
- [x] Exp: https://github.com/RobinKa/tfga/pull/20
- [ ] Log
For 2D and 3D (including PGA) this seems to work (just took inspiration from the Quaternion logarithm), although I don't know under what conditions this works.
def rotor_log(x):
norm_x = tf.sqrt(ga.geom_prod(x, ga.reversion(x))[..., :1])
bv_indices = ga.get_kind_blade_indices("bivector")
v = ga.keep_blades(x, bv_indices)
norm_v = tf.sqrt(ga.geom_prod(v, ga.reversion(v))[..., :1])
s = x[..., :1]
scalar = tf.math.log(norm_x)
rotor = ga.from_tensor_with_kind(tf.math.acos(s / norm_x) / norm_v, "scalar")
return scalar + ga.geom_prod(v, rotor)
General bivector exp and log: https://arxiv.org/abs/2107.03771 (Graded Symmetry Groups: Plane and Simple)
- Exp and decomposition implemented in #21