From 28ec09b5c64dd7a342a3ae8b35f809cc185d9c63 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 6 Nov 2020 08:44:07 -0500 Subject: [PATCH] eja: document why an a[0] access is safe. --- mjo/eja/eja_algebra.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 0492946..ded2df6 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1006,8 +1006,10 @@ class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra): # we simply undo the basis_normalizer scaling that we # performed earlier. # - # TODO: make this access safe. - XS = a[0].variables() + # The a[0] access here is safe because trivial algebras + # won't have any basis normalizers and therefore won't + # make it to this "else" branch. + XS = a[0].parent().gens() subs_dict = { XS[i]: self._basis_normalizers[i]*XS[i] for i in range(len(XS)) } return tuple( a_i.subs(subs_dict) for a_i in a ) -- 2.43.2