Ticket #12343: 12343.patch

File 12343.patch, 5.5 KB (added by lftabera, 11 years ago)
  • sage/databases/cunningham_tables.py

    # HG changeset patch
    # User Luis Felipe Tabera Alonso <lftabera@yahoo.es>
    # Parent 45c4da67d2340847b680e925242a630bf387cc8c
    #12343 Cleanup unexisting methods after #10263
    
    diff --git a/sage/databases/cunningham_tables.py b/sage/databases/cunningham_tables.py
    a b  
    1818        return map(Integer,load(file))
    1919    else:
    2020        from warnings import warn
    21         warn("You might consider installing the optional package for factoring Cunningham numbers with the following command: ``sage -i cunningham_tables-1.0``")
     21        warn("You might consider installing the optional package for factoring Cunningham numbers with the following command: ``sage -i cunningham_tables``")
    2222        return []
    2323
    2424
  • sage/rings/factorint.pyx

    diff --git a/sage/rings/factorint.pyx b/sage/rings/factorint.pyx
    a b  
    206206
    207207    You need to install an optional package to use this method,
    208208    this can be done with the following command line:
    209     ``sage -i cunningham_tables-1.0``
     209    ``sage -i cunningham_tables``
    210210
    211211    INPUT:
    212212
     
    216216
    217217    EXAMPLES::
    218218
    219         sage: (2^257-1)._factor_cunningham() # optional - cunningham
     219        sage: from sage.rings.factorint import factor_cunningham
     220        sage: factor_cunningham(2^257-1) # optional - cunningham
    220221        535006138814359 * 1155685395246619182673033 * 374550598501810936581776630096313181393
    221         sage: ((3^101+1)*(2^60).next_prime())._factor_cunningham(proof=False) # optional - cunningham
     222        sage: factor_cunningham((3^101+1)*(2^60).next_prime(),proof=False) # optional - cunningham
    222223        2^2 * 379963 * 1152921504606847009 * 1017291527198723292208309354658785077827527
    223224
    224225    """
  • sage/rings/finite_rings/element_base.pyx

    diff --git a/sage/rings/finite_rings/element_base.pyx b/sage/rings/finite_rings/element_base.pyx
    a b  
    4141            sage: a = Zmod(17)(13)
    4242            sage: a._nth_root_common(4, True, "Johnston", False)
    4343            [3, 5, 14, 12]
     44            sage: a._nth_root_common(4, True, "Johnston", cunningham = True) # optional - cunningham
     45            [3, 5, 14, 12]
    4446        """
    4547        K = self.parent()
    4648        q = K.order()
     
    6971            else: raise ValueError, "no nth root"
    7072        self = self**alpha
    7173        if cunningham:
    72             F = n._factor_cunningham()
     74            from sage.rings.factorint import factor_cunningham
     75            F = factor_cunningham(n)
    7376        else:
    7477            F = n.factor()
    7578        from sage.groups.generic import discrete_log
  • sage/rings/finite_rings/finite_field_base.pyx

    diff --git a/sage/rings/finite_rings/finite_field_base.pyx b/sage/rings/finite_rings/finite_field_base.pyx
    a b  
    538538        """
    539539        if self.__factored_unit_order is None:
    540540            if self.characteristic() in []: # want to be [2,3,5,7,11] once #7240 is finished.
    541                 self.__factored_unit_order = [(self.order()-1)._factor_cunningham()]
     541                from sage.rings.factorint import factor_cunningham
     542                self.__factored_unit_order = [factor_cunningham(self.order()-1)]
    542543            else:
    543544                self.__factored_unit_order = [(self.order()-1).factor()]
    544545        return self.__factored_unit_order
  • sage/rings/finite_rings/integer_mod.pyx

    diff --git a/sage/rings/finite_rings/integer_mod.pyx b/sage/rings/finite_rings/integer_mod.pyx
    a b  
    996996          CRT and p-adic log techniques are used to reduce to this case.
    997997          'Johnston' is the only currently supported option.
    998998
     999        - ``cunningham`` - bool (default: ``False``); In some cases,
     1000          factorization of ``n`` is computed. If cunningham is set to ``True``,
     1001          the factorization of ``n`` is computed using trial division for all
     1002          primes in the so called Cunningham table. Refer to
     1003          sage.rings.factorint.factor_cunningham for more information. You need
     1004          to install an optional package to use this method, this can be done
     1005          with the following command line ``sage -i cunningham_tables``
     1006
    9991007        OUTPUT:
    10001008
    10011009        If self has an `n`\th root, returns one (if ``all`` is ``False``) or a
     
    10871095            ...       except ValueError:
    10881096            ...           pass
    10891097
     1098        Check that the code path cunningham might be used::
     1099
     1100            sage: a = Mod(9,11)
     1101            sage: a.nth_root(2, False, True, 'Johnston', cunningham = True) # optional - cunningham
     1102            [3, 8]
     1103
    10901104        ALGORITHMS:
    10911105
    10921106        - The default for prime modulus is currently an algorithm described in the following paper:
  • sage/rings/integer.pyx

    diff --git a/sage/rings/integer.pyx b/sage/rings/integer.pyx
    a b  
    46004600            2 * 101^2
    46014601            sage: a.squarefree_part(bound=1000)
    46024602            2
     4603            sage: a.squarefree_part(bound=2**14)
     4604            2
    46034605            sage: a = 7^3 * next_prime(2^100)^2 * next_prime(2^200)
    46044606            sage: a / a.squarefree_part(bound=1000)
    46054607            49
     
    46344636            if bound == -1:
    46354637                F = self.factor()
    46364638            else:
    4637                 F = self._factor_trial_division(bound)
     4639                from sage.rings.factorint import factor_trial_division
     4640                F = factor_trial_division(self,bound)
    46384641            n = one
    46394642            for pp, e in F:
    46404643                if e % 2 != 0: