Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Exchange tests for irreducibility and constant/leading coefficients
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrenet committed Jan 30, 2015
1 parent d27f849 commit f79eeaa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/sage/rings/polynomial/polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6774,9 +6774,6 @@ cdef class Polynomial(CommutativeAlgebraElement):
return False
return f.is_cyclotomic()

if not self.is_irreducible():
return False

if not self.is_monic():
return False

Expand All @@ -6785,10 +6782,14 @@ cdef class Polynomial(CommutativeAlgebraElement):
if (self == gen - 1): # the first cyc. pol. is treated apart
return True

coefs = self.coefficients(sparse=False)
if coefs[0] != 1:
if self.constant_coefficient() != 1:
return False

if not self.is_irreducible():
return False

coefs = self.coefficients(sparse=False)

# construct the odd and even part of self
po_odd = sum(coefs[i]*(gen**((i-1)/2)) for i in xrange(1,len(coefs),2))
po_even = sum(coefs[i]*(gen**(i/2)) for i in xrange(0,len(coefs),2))
Expand Down

0 comments on commit f79eeaa

Please sign in to comment.