def __init__(self,
                 ec,
                 P=None,
                 dmap=None,
                 order=None,
                 pairing="weil",
                 k=None,
                 seed=None):
        self.ec = ec
        self.P = P

        self.distortion = self._deco(dmap)
        if dmap == None:
            self.distortion = self._ext

        if order == None:
            self.order = P.order()
        else:
            self.order = order

        self.pairing = pairing

        ord = self.ec.base_ring().cardinality()
        if k == None:
            k = Zmod(self.order)(ord).multiplicative_order()
        self.k = k

        random.seed(seed)
        self.t = random.randint(2, self.order - 1)

        base = FiniteField(ord**self.k, 'b')
        self.hom = Hom(self.ec.base_ring(),
                       base)(base.gen()**((ord**self.k - 1) / (ord - 1)))
        self.ec2 = EllipticCurve(map(int,
                                     self.ec.a_invariants())).change_ring(base)
Exemple #2
0
def hom_module_induced_morphism(f, N, action, hom_M_prime_N_data,
                                hom_M_N_data):
    M_prime = f.domain()
    M = f.codomain()
    hom_M_prime_N, M_prime_basis, M_prime_basis_keys, prime_components, prime_from_components, prime_hom_action = hom_M_prime_N_data
    hom_M_N, M_basis, M_basis_keys, components, from_components, hom_action = hom_M_N_data
    f_values = {}
    for i_prime in M_prime_basis_keys:
        f_values[i_prime] = f(M_prime_basis[i_prime])

    def f_star_components(x):
        c_x = components(x)
        c = {}
        for i_prime in M_prime_basis_keys:
            a = f_values[i_prime]
            for c in N.coordinates(
                    sum_in_module(N, [
                        linearly_extended_action(N, action, a[i], c_x[i])
                        for i in a.support()
                    ])):
                yield c

    matrix_representing_f_star = matrix(
        [tuple(f_star_components(x)) for x in hom_M_N.basis()],
        ncols=hom_M_prime_N.rank())
    return FreeModuleMorphism(Hom(hom_M_N, hom_M_prime_N),
                              matrix_representing_f_star)
Exemple #3
0
def base_change_morphism(f, R):
    M = f.domain()
    N = f.codomain()
    assert R.has_coerce_map_from(f.base_ring())
    MM = base_change_module(M, R)
    NN = base_change_module(N, R)
    return FreeModuleMorphism(Hom(MM, NN), f.matrix().change_ring(R))
Exemple #4
0
    def __init__(self, base=None, category=None):
        if base is QQ:
            self._element_factory = exactreal.Element[type(exactreal.RationalField())]
            self._module_factory = lambda gens: QQModule(*gens)
            number_field = QQ
        else:
            base = RealEmbeddedNumberField(base)
            ring = exactreal.NumberField(base.renf)
            self._element_factory = exactreal.Element[type(ring)]
            self._module_factory = lambda gens: NumberFieldModule(ring, *gens)
            number_field = base.number_field

        CommutativeRing.__init__(self, base, category=category)
        H = Hom(number_field, self)
        coercion = H.__make_element_class__(CoercionExactRealsNumberField)(H)
        self.register_coercion(coercion)
 def __init__(self, domain):
     Morphism.__init__(
         self, Hom(domain, domain.number_field, SetsWithPartialMaps()))
Exemple #6
0
 def __init__(self):
     Morphism.__init__(self, Hom(mpq, QQ, QQ.category(), check=False))
Exemple #7
0
 def __init__(self):
     Morphism.__init__(self, Hom(mpz, ZZ, ZZ.category(), check=False))
Exemple #8
0
 def __init__(self, domain):
     Morphism.__init__(self, Hom(domain, domain._isomorphic_vector_space, SetsWithPartialMaps()))