Changeset 555b03 in git for Singular/misc_ip.h


Ignore:
Timestamp:
Aug 30, 2010, 4:29:37 PM (14 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
5e016e27b98b70a42edca584335f57145f3a8dc0
Parents:
f9bb6862e22f14387a67696733ad2d1024a69ade
Message:
primefactors via GMP, additional prob. check for unfactorized remainder

git-svn-id: file:///usr/local/Singular/svn/trunk@13153 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/misc_ip.h

    rf9bb68 r555b03  
    2929
    3030/**
    31  * Computes an approximation of the square root of a bigint number.
     31 * Converts a non-negative bigint number into a GMP number.
    3232 *
    33  * Expects a non-negative bigint number n and returns the bigint
    34  * number m which satisfies m*m <= n < (m+1)*(m+1). This implementation
    35  * does not require a valid currRing.
     33 **/
     34void number2mpz(number n,   /**< [in]  a bigint number >= 0  */
     35                mpz_t m     /**< [out] the GMP equivalent    */
     36               );
     37               
     38/**
     39 * Converts a non-negative GMP number into a bigint number.
    3640 *
    37  * @return an approximation of the square root of n
     41 * @return the bigint number representing the given GMP number
    3842 **/
    39 number approximateSqrt(const number n   /**< [in]  a number   */
    40                       );
     43number mpz2number(mpz_t m   /**< [in]  a GMP number >= 0  */
     44                 );
     45
     46/**
     47 * Divides 'n' as many times as possible by 'd' and returns the number
     48 * of divisions (without remainder) in 'times',
     49 * e.g., n = 48, d = 4, divTimes(n, d, t) = 3 produces n = 3, t = 2,
     50 *       since 48 = 4*4*3;
     51 * assumes that d is positive
     52 **/
     53void divTimes(mpz_t n,   /**< [in]  a GMP number >= 0                      */
     54              mpz_t d,   /**< [in]  the divisor, a GMP number >= 0         */
     55              int* times /**< [out] number of divisions without remainder  */
     56             );
    4157
    4258/**
     
    4460 * than or equal to a given bound, with corresponding multiplicities.
    4561 *
    46  * The method is capable of finding only prime factors < 2^31, and it looks
    47  * only for those less than or equal the given bound, if this bound is not 0.
    48  * Therefore, after dividing out all prime factors which have been found,
    49  * some number m > 1 may survive.
    50  * The method returns a list L filled with three entries:
    51  * L[1] contains m as int or bigint, depending on the size,
    52  * L[2] a list; L[2][i] contains the i-th prime factor as int
     62 * The method finds all prime factors with multiplicities. If a non-zero
     63 * bound is given, then only the prime factors <= pBound are being found.
     64 * In this case, there may remain an unfactored portion m of n.
     65 * The method returns a list L filled with four entries:
     66 * L[1] contains the remainder m as int or bigint, depending on the size,
     67 * L[2] a list; L[2][i] contains the i-th prime factor as int or bigint
    5368 *                     (sorted in ascending order),
    5469 * L[3] a list; L[3][i] contains the multiplicity of L[2, i] in n as int
     70 * L[4] 1 iff the remainder m is probably a prime, 0 otherwise
    5571 *
    5672 * We thus have: n = L[1] * L[2][1]^L[3][1] * ... * L[2][k]^L[3][k], where
    57  * k is the number of mutually distinct prime factors < 2^31 and <= the
    58  * provided bound (if this is not zero).
     73 * k is the number of mutually distinct prime factors (<= a provided non-
     74 * zero bound).
    5975 *
    60  * @return the factorisation data in a list
     76 * @return the factorisation data in a SINGULAR-internal list
    6177 **/
    6278lists primeFactorisation(
    63        const number n,    /**< [in]  the bigint to be factorised       */
    64        const int pBound   /**< [in]  bound on the prime factors seeked */
     79       const number n,     /**< [in]  the bigint > 0 to be factorised   */
     80       const number pBound /**< [in]  bigint bound on the prime factors
     81                                      seeked                            */
    6582                        );
    6683
Note: See TracChangeset for help on using the changeset viewer.