From c4203897950b84665ea41ed103f87f68aee0852e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 7 Dec 2019 18:09:48 -0500 Subject: [PATCH] eja: use zip() instead of izip(), which doesn't exist in python-3.x. --- mjo/eja/eja_algebra.py | 10 +++++----- mjo/eja/eja_element.py | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 71cdd6f..0f2b655 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 izip, repeat +from itertools import repeat from sage.algebras.quatalg.quaternion_algebra import QuaternionAlgebra from sage.categories.magmatic_algebras import MagmaticAlgebras @@ -1032,7 +1032,7 @@ class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra): basis = tuple( s.change_ring(field) for s in basis ) self._basis_normalizers = tuple( ~(self.natural_inner_product(s,s).sqrt()) for s in basis ) - basis = tuple(s*c for (s,c) in izip(basis,self._basis_normalizers)) + basis = tuple(s*c for (s,c) in zip(basis,self._basis_normalizers)) Qs = self.multiplication_table_from_matrix_basis(basis) @@ -1055,8 +1055,8 @@ class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra): # with had entries in a nice field. return super(MatrixEuclideanJordanAlgebra, self)._charpoly_coeff(i) else: - basis = ( (b/n) for (b,n) in izip(self.natural_basis(), - self._basis_normalizers) ) + basis = ( (b/n) for (b,n) in zip(self.natural_basis(), + self._basis_normalizers) ) # Do this over the rationals and convert back at the end. J = MatrixEuclideanJordanAlgebra(QQ, @@ -1066,7 +1066,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 = izip(x.base_ring().gens(), self._basis_normalizers) + pairs = zip(x.base_ring().gens(), self._basis_normalizers) substitutions = { v: v*c for (v,c) in pairs } result = p.subs(substitutions) diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 276eab0..b7061bf 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -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 @@ -988,7 +986,7 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): """ B = self.parent().natural_basis() W = self.parent().natural_basis_space() - return W.linear_combination(izip(B,self.to_vector())) + return W.linear_combination(zip(B,self.to_vector())) def norm(self): -- 2.44.2