Skip to content
Open
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
64a7131
Added bivector split for arbitrary GAs and tests thereof.
Jun 6, 2021
0b0c76a
Added rotor_split.
Jun 7, 2021
6a5dd22
Parameterized the tests, added testng for rotor_split.
Jun 7, 2021
f4e56da
Stop checking if a MV matrix is invertible and let numpy decide.
Jun 7, 2021
6d64658
Normalize complex simple rotors correctly
Jun 7, 2021
e823281
Added closed form rotor logarithm.
Jun 7, 2021
4d6fcbc
Added tests for closed form rotor logarithm.
Jun 7, 2021
1149fb2
Fixed flake8 errors.
Jun 7, 2021
8cdf6be
Improved comments in the tests.
Jun 7, 2021
5215235
Add a basic test to verify assumptions about the bivectors produced b…
hugohadfield Jun 7, 2021
5ebe817
Merge branch 'decomposition' of https://github.com/tBuLi/clifford int…
Jun 7, 2021
58e078c
Added check for simplicity to the unknown_split test
Jun 7, 2021
5404367
Added bivector split for arbitrary GAs and tests thereof.
Jun 6, 2021
68908ca
Added rotor_split.
Jun 7, 2021
3254634
Parameterized the tests, added testng for rotor_split.
Jun 7, 2021
3afcdd3
Stop checking if a MV matrix is invertible and let numpy decide.
Jun 7, 2021
b81e15d
Normalize complex simple rotors correctly
Jun 7, 2021
559773c
Added closed form rotor logarithm.
Jun 7, 2021
4372805
Added tests for closed form rotor logarithm.
Jun 7, 2021
5200950
Fixed flake8 errors.
Jun 7, 2021
d744819
Improved comments in the tests.
Jun 7, 2021
47c8e41
Add a basic test to verify assumptions about the bivectors produced b…
hugohadfield Jun 7, 2021
7e72138
Added check for simplicity to the unknown_split test
Jun 7, 2021
aa5d283
change assertions slighlty
hugohadfield Jun 8, 2021
341dd07
Prefer np.testing.allclose vs np.testing.assert_almost_equal
hugohadfield Jun 8, 2021
d9115d4
Failing tests were due to Bs and ls not always being returned in the …
Jun 8, 2021
647efdf
Removed print statement
Jun 8, 2021
d28fa34
Improve type stability of exp and log, reduce required tolerance a bi…
hugohadfield Jun 8, 2021
68a18bb
Tag the bivector split as too slow when v high dimensional
hugohadfield Jun 8, 2021
5d82fa3
Added Roelfs thesis to bibliography
Jun 13, 2021
1322ebf
Merge branch 'decomposition' of https://github.com/tBuLi/clifford int…
Jun 13, 2021
89ceada
Merge remote-tracking branch 'origin/master' into decomposition
hugohadfield Jun 14, 2021
087aea0
Sort eigenvalues from boost to rotation, implement the split for even…
Jun 15, 2021
9234594
Boosts should never hve a negative scalar part.
Jun 15, 2021
47166a6
Update known_splits to new sort order
Jun 15, 2021
18ee52a
Test that exp(log(R)) == R
Jun 15, 2021
139250c
Make the accuracy dependent on total dimension
hugohadfield Jul 5, 2021
21be96d
JIT the internal helper function
hugohadfield Jul 5, 2021
424ed7b
Fix linting
hugohadfield Jul 5, 2021
e8bb4ff
Tidy up the tests to be more granular and not impact the startup time…
eric-wieser Aug 12, 2021
90d232e
Merge remote-tracking branch 'upstream/master' into decomposition
eric-wieser Aug 12, 2021
ca30432
Ensure docs are generated
eric-wieser Aug 12, 2021
5c8e386
flake8
eric-wieser Aug 12, 2021
7d5d0ac
Fix docstrings, flake8
eric-wieser Aug 12, 2021
9bfe9cc
try to fix CI
eric-wieser Aug 12, 2021
025d624
Fix doctest
eric-wieser Aug 12, 2021
e206c24
Merge remote-tracking branch 'upstream/master' into decomposition
eric-wieser Sep 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sort eigenvalues from boost to rotation, implement the split for even…
… and odd seperatelly to accomodate for this.
  • Loading branch information
tbuli authored and tbuli committed Jun 15, 2021
commit 087aea03df00505270034fc6972f01d9099979e8
28 changes: 20 additions & 8 deletions clifford/invariant_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,20 @@
from ._settings import _eps


def single_split(Wm, li):
"""Helper function to compute the split for a given set of W_m and eigenvalue lambda_i.
def single_split_even(Wm, li, r):
"""Helper function to compute a single split for a given set of W_m and
eigenvalue lambda_i, when the total number of terms in the split is even.
"""
N = sum(W * li**(r - j) for j, W in enumerate(Wm[::2]))
D = sum(W * li**(r - j) for j, W in enumerate(Wm[1::2], start=1))
return N*D.inv()

def single_split_odd(Wm, li, r):
"""Helper function to compute a single split for a given set of W_m and
eigenvalue lambda_i, when the total number of terms in the split is odd.
"""
D = sum(W / li**j for j, W in enumerate(Wm[::2]))
N = sum(W / li**j for j, W in enumerate(Wm[1::2]))
N = sum(W * li ** (r - j) for j, W in enumerate(Wm[1::2]))
D = sum(W * li ** (r - j) for j, W in enumerate(Wm[::2]))
return N*D.inv()


Expand All @@ -71,15 +79,19 @@ def _bivector_split(Wm, return_all=True):
Wm = Wm[:-1]

k = (len(Wm) - 1)
r = k // 2
Wm_sq = np.array([(W ** 2).value[0] * (-1) ** (k - m) for m, W in enumerate(Wm)])
ls = np.roots(Wm_sq)

Bs = []
# Sort to have the value closest to zero last.
ls_sorted = sorted(ls, key=lambda li: -np.abs(li))
ls_sorted = sorted(ls, key=lambda li: -li)
# Exclude the smallest value if asked.
for li in (ls_sorted if return_all else ls_sorted[:-1]):
Bs.append(single_split(Wm, li))
if k % 2 == 0:
Bs.append(single_split_even(Wm, li, r))
else:
Bs.append(single_split_odd(Wm, li, r))
return (Bs, ls_sorted)


Expand Down Expand Up @@ -111,8 +123,8 @@ def rotor_split(R, k=None, roots=False):
Wm = [R(2 * m) for m in range(0, k + 1)]
Ts, ls = _bivector_split(Wm, return_all=False)

Rs = [(R(0) + R(0) * ti) for ti in Ts]
Rs = [Ri.normal() if np.isreal((Ri*(~Ri)).value[0]) else Ri / np.sqrt((Ri*(~Ri)).value[0]) for Ri in Rs]
Rs = [(1 + ti) for ti in Ts]
Rs = [Ri.normal() if np.isreal((Ri*~Ri).value[0]) else Ri / np.sqrt((Ri*~Ri).value[0]) for Ri in Rs]
P = reduce(lambda tot, x: tot*x, Rs, 1)
Rs = Rs + [R/P]
return (Rs, ls) if roots else Rs
Expand Down