From 9528af011cbb4d5e6a38ef972e0d14e7928d5eef Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 25 Aug 2019 23:31:56 -0400 Subject: [PATCH] eja: use izip() instead of zip() in a few places. --- mjo/eja/eja_algebra.py | 4 ++-- mjo/eja/eja_element.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 53f6151..79ccc79 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -5,7 +5,7 @@ are used in optimization, and have some additional nice methods beyond what can be supported in a general Jordan Algebra. """ -from itertools import repeat +from itertools import izip, repeat from sage.algebras.quatalg.quaternion_algebra import QuaternionAlgebra from sage.categories.magmatic_algebras import MagmaticAlgebras @@ -938,7 +938,7 @@ class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra): (_,x,_,_) = J._charpoly_matrix_system() p = J._charpoly_coeff(i) # p might be missing some vars, have to substitute "optionally" - pairs = zip(x.base_ring().gens(), self._basis_normalizers) + pairs = izip(x.base_ring().gens(), self._basis_normalizers) substitutions = { v: v*c for (v,c) in pairs } return p.subs(substitutions) diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index c90893f..d9b6eb1 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -1,3 +1,5 @@ +from itertools import izip + from sage.matrix.constructor import matrix from sage.modules.free_module import VectorSpace from sage.modules.with_basis.indexed_element import IndexedFreeModuleElement @@ -830,7 +832,7 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): """ B = self.parent().natural_basis() W = self.parent().natural_basis_space() - return W.linear_combination(zip(B,self.to_vector())) + return W.linear_combination(izip(B,self.to_vector())) def norm(self): -- 2.44.2