本文整理汇总了Python中sage.rings.finite_rings.finite_field_constructor.FiniteField.multiplicative_generator方法的典型用法代码示例。如果您正苦于以下问题:Python FiniteField.multiplicative_generator方法的具体用法?Python FiniteField.multiplicative_generator怎么用?Python FiniteField.multiplicative_generator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.finite_rings.finite_field_constructor.FiniteField
的用法示例。
在下文中一共展示了FiniteField.multiplicative_generator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: szekeres_difference_set_pair
# 需要导入模块: from sage.rings.finite_rings.finite_field_constructor import FiniteField [as 别名]
# 或者: from sage.rings.finite_rings.finite_field_constructor.FiniteField import multiplicative_generator [as 别名]
def szekeres_difference_set_pair(m, check=True):
r"""
Construct Szekeres `(2m+1,m,1)`-cyclic difference family
Let `4m+3` be a prime power. Theorem 3 in [Sz69]_ contains a construction of a pair
of *complementary difference sets* `A`, `B` in the subgroup `G` of the quadratic
residues in `F_{4m+3}^*`. Namely `|A|=|B|=m`, `a\in A` whenever `a-1\in G`, `b\in B`
whenever `b+1 \in G`. See also Theorem 2.6 in [SWW72]_ (there the formula for `B` is
correct, as opposed to (4.2) in [Sz69]_, where the sign before `1` is wrong.
In modern terminology, for `m>1` the sets `A` and `B` form a
:func:`difference family<sage.combinat.designs.difference_family>` with parameters `(2m+1,m,1)`.
I.e. each non-identity `g \in G` can be expressed uniquely as `xy^{-1}` for `x,y \in A` or `x,y \in B`.
Other, specific to this construction, properties of `A` and `B` are: for `a` in `A` one has
`a^{-1}` not in `A`, whereas for `b` in `B` one has `b^{-1}` in `B`.
INPUT:
- ``m`` (integer) -- dimension of the matrix
- ``check`` (default: ``True``) -- whether to check `A` and `B` for correctness
EXAMPLES::
sage: from sage.combinat.matrices.hadamard_matrix import szekeres_difference_set_pair
sage: G,A,B=szekeres_difference_set_pair(6)
sage: G,A,B=szekeres_difference_set_pair(7)
REFERENCE:
.. [Sz69] \G. Szekeres,
Tournaments and Hadamard matrices,
Enseignement Math. (2) 15(1969), 269-278
"""
from sage.rings.finite_rings.finite_field_constructor import GF
F = GF(4*m+3)
t = F.multiplicative_generator()**2
G = F.cyclotomic_cosets(t, cosets=[F.one()])[0]
sG = set(G)
A = filter(lambda a: a-F.one() in sG, G)
B = filter(lambda b: b+F.one() in sG, G)
if check:
from itertools import product, chain
assert(len(A)==len(B)==m)
if m>1:
assert(sG==set([xy[0]/xy[1] for xy in chain(product(A,A), product(B,B))]))
assert(all(F.one()/b+F.one() in sG for b in B))
assert(not any(F.one()/a-F.one() in sG for a in A))
return G,A,B
示例2: polynomial
# 需要导入模块: from sage.rings.finite_rings.finite_field_constructor import FiniteField [as 别名]
# 或者: from sage.rings.finite_rings.finite_field_constructor.FiniteField import multiplicative_generator [as 别名]
def polynomial(self, n):
r"""
Return the pseudo-Conway polynomial of degree `n` in this
lattice.
INPUT:
- ``n`` -- positive integer
OUTPUT:
- a pseudo-Conway polynomial of degree `n` for the prime `p`.
ALGORITHM:
Uses an algorithm described in [HL99]_, modified to find
pseudo-Conway polynomials rather than Conway polynomials. The
major difference is that we stop as soon as we find a
primitive polynomial.
REFERENCE:
.. [HL99] \L. Heath and N. Loehr (1999). New algorithms for
generating Conway polynomials over finite fields.
Proceedings of the tenth annual ACM-SIAM symposium on
discrete algorithms, pp. 429-437.
EXAMPLES::
sage: from sage.rings.finite_rings.conway_polynomials import PseudoConwayLattice
sage: PCL = PseudoConwayLattice(2, use_database=False)
sage: PCL.polynomial(3)
x^3 + x + 1
sage: PCL.polynomial(4)
x^4 + x^3 + 1
sage: PCL.polynomial(60)
x^60 + x^59 + x^58 + x^55 + x^54 + x^53 + x^52 + x^51 + x^48 + x^46 + x^45 + x^42 + x^41 + x^39 + x^38 + x^37 + x^35 + x^32 + x^31 + x^30 + x^28 + x^24 + x^22 + x^21 + x^18 + x^17 + x^16 + x^15 + x^14 + x^10 + x^8 + x^7 + x^5 + x^3 + x^2 + x + 1
"""
if n in self.nodes:
return self.nodes[n]
p = self.p
n = Integer(n)
if n == 1:
f = self.ring.gen() - FiniteField(p).multiplicative_generator()
self.nodes[1] = f
return f
# Work in an arbitrary field K of order p**n.
K = FiniteField(p**n, names='a')
# TODO: something like the following
# gcds = [n.gcd(d) for d in self.nodes.keys()]
# xi = { m: (...) for m in gcds }
xi = {q: self.polynomial(n//q).any_root(K, -n//q, assume_squarefree=True)
for q in n.prime_divisors()}
# The following is needed to ensure that in the concrete instantiation
# of the "new" extension all previous choices are compatible.
_frobenius_shift(K, xi)
# Construct a compatible element having order the lcm of orders
q, x = xi.popitem()
v = p**(n//q) - 1
for q, xitem in six.iteritems(xi):
w = p**(n//q) - 1
g, alpha, beta = v.xgcd(w)
x = x**beta * xitem**alpha
v = v.lcm(w)
r = p**n - 1
# Get the missing part of the order to be primitive
g = r // v
# Iterate through g-th roots of x until a primitive one is found
z = x.nth_root(g)
root = K.multiplicative_generator()**v
while z.multiplicative_order() != r:
z *= root
# The following should work but tries to create a huge list
# whose length overflows Python's ints for large parameters
#Z = x.nth_root(g, all=True)
#for z in Z:
# if z.multiplicative_order() == r:
# break
f = z.minimal_polynomial()
self.nodes[n] = f
return f