# Ticket #6768: 12538.patch

File 12538.patch, 16.7 KB (added by wakep, 13 years ago)

```# HG changeset patch
# User Preston Wake <preston.wake@gmail.com>
# Date 1248373201 14400
# Node ID 28635b3d0b70e166aab75e0492f397f051df35ce
# Parent  2e793d2a0e123293b73eed40715e43185fd9ccfe

diff -r 2e793d2a0e12 -r 28635b3d0b70 sage/rings/polynomial/char_two_quad.py```
• ## sage/rings/polynomial/polynomial_element.pyx

`diff -r 2e793d2a0e12 -r 28635b3d0b70 sage/rings/polynomial/polynomial_element.pyx`
 a Traceback (most recent call last): ... NotImplementedError: factorization of polynomials over rings with composite characteristic is not implemented For quadratrics over GF(2^m) :: sage: F. = GF(4) sage: PP = PolynomialRing(F,'y') sage: f = PP([1,1,1]);f y^2 + y + 1 sage: f.factor() (y + x) * (y + x + 1) """ # PERFORMANCE NOTE: from sage.rings.integer_mod_ring import is_IntegerModRing from sage.rings.integer_ring import is_IntegerRing from sage.rings.rational_field import is_RationalField from sage.rings.polynomial.char_two_quad import quad n = None if is_IntegerModRing(R) or is_IntegerRing(R) or is_RationalField(R): return Factorization(v, from_M(F.unit())) elif is_FiniteField(R): v = [x._pari_("a") for x in self.list()] f = pari(v).Polrev() G = list(f.factor()) if ch==2 and self.degree()==2: G=quad(self) return Factorization(G[0],G[1]) else: v = [x._pari_("a") for x in self.list()] f = pari(v).Polrev() G = list(f.factor()) elif is_NumberField(R):

```# HG changeset patch
# User Preston Wake <preston.wake@gmail.com>
# Date 1248373201 14400
# Node ID 28635b3d0b70e166aab75e0492f397f051df35ce
# Parent  2e793d2a0e123293b73eed40715e43185fd9ccfe

diff -r 2e793d2a0e12 -r 28635b3d0b70 sage/rings/polynomial/char_two_quad.py```
• ## sage/rings/polynomial/polynomial_element.pyx

`diff -r 2e793d2a0e12 -r 28635b3d0b70 sage/rings/polynomial/polynomial_element.pyx`
 a Traceback (most recent call last): ... NotImplementedError: factorization of polynomials over rings with composite characteristic is not implemented For quadratrics over GF(2^m) :: sage: F. = GF(4) sage: PP = PolynomialRing(F,'y') sage: f = PP([1,1,1]);f y^2 + y + 1 sage: f.factor() (y + x) * (y + x + 1) """ # PERFORMANCE NOTE: from sage.rings.integer_mod_ring import is_IntegerModRing from sage.rings.integer_ring import is_IntegerRing from sage.rings.rational_field import is_RationalField from sage.rings.polynomial.char_two_quad import quad n = None if is_IntegerModRing(R) or is_IntegerRing(R) or is_RationalField(R): return Factorization(v, from_M(F.unit())) elif is_FiniteField(R): v = [x._pari_("a") for x in self.list()] f = pari(v).Polrev() G = list(f.factor()) if ch==2 and self.degree()==2: G=quad(self) return Factorization(G[0],G[1]) else: v = [x._pari_("a") for x in self.list()] f = pari(v).Polrev() G = list(f.factor()) elif is_NumberField(R):
• ## sage/modular/hecke/algebra.py

```# HG changeset patch
# User Preston Wake <preston.wake@gmail.com>
# Date 1250471218 14400
# Node ID 0fce5ebf9305c04d7c997245e2608ed25c761f0d
# Parent  2e793d2a0e123293b73eed40715e43185fd9ccfe
Added code for bases of Hecke Algebras

diff -r 2e793d2a0e12 -r 0fce5ebf9305 sage/modular/hecke/algebra.py```
 a import math import weakref import sage.rings.all as rings import sage.rings.arith as arith import sage.rings.infinity import sage.misc.latex as latex import sage.rings.commutative_algebra from sage.misc.misc import verbose from sage.matrix.constructor import matrix from sage.rings.arith import lcm from sage.matrix.matrix_space import MatrixSpace def is_HeckeAlgebra(x): r""" return T def _heckebasis(M): r""" Gives a basis of the hecke algebra of M as a ZZ-module INPUT: - ``M`` - a hecke module OUTPUT: - a list of hecke algebra elements represented as matrices EXAMPLES:: sage: M = ModularSymbols(11,2,1) sage: sage.modular.hecke.algebra._heckebasis(M) [Hecke operator on Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field defined by: [1 0] [0 1], Hecke operator on Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field defined by: [0 1] [0 5]] """ QQ = rings.QQ ZZ = rings.ZZ d = M.rank() VV = QQ**(d**2) WW = ZZ**(d**2) MM = MatrixSpace(QQ,d) MMZ = MatrixSpace(ZZ,d) S = []; Denom = []; B = []; B1 = [] for i in xrange(1, M.hecke_bound() + 1): v = M.hecke_operator(i).matrix() den = v.denominator() Denom.append(den) S.append(v) den = lcm(Denom) for m in S: B.append(WW((den*m).list())) UU = WW.submodule(B) B = UU.basis() for u in B: u1 = u.list() m1 = M.hecke_algebra()(MM(u1), check=False) #m1 = MM(u1) B1.append((1/den)*m1) return B1 class HeckeAlgebra_base(sage.rings.commutative_algebra.CommutativeAlgebra): """ Base class for algebras of Hecke operators on a fixed Hecke module. def basis(self): r""" Return a basis for this Hecke algebra as a free module over its base ring. Not implemented at present. its base ring. EXAMPLE:: sage: ModularSymbols(Gamma1(3), 3).hecke_algebra().basis() Traceback (most recent call last): ... NotImplementedError [Hecke operator on Modular Symbols space of dimension 2 for Gamma_1(3) of weight 3 with sign 0 and over Rational Field defined by: [1 0] [0 1], Hecke operator on Modular Symbols space of dimension 2 for Gamma_1(3) of weight 3 with sign 0 and over Rational Field defined by: [0 0] [0 2]] """ raise NotImplementedError try: return self.__basis_cache except AttributeError: self.__basis_cache=_heckebasis(self.__M) return self.__basis_cache def discriminant(self): r"""