Changeset 555b03 in git for Singular/misc_ip.h
- Timestamp:
- Aug 30, 2010, 4:29:37 PM (14 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 5e016e27b98b70a42edca584335f57145f3a8dc0
- Parents:
- f9bb6862e22f14387a67696733ad2d1024a69ade
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/misc_ip.h
rf9bb68 r555b03 29 29 30 30 /** 31 * Co mputes an approximation of the square root of a bigintnumber.31 * Converts a non-negative bigint number into a GMP number. 32 32 * 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 **/ 34 void 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. 36 40 * 37 * @return an approximation of the square root of n41 * @return the bigint number representing the given GMP number 38 42 **/ 39 number approximateSqrt(const number n /**< [in] a number */ 40 ); 43 number 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 **/ 53 void 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 ); 41 57 42 58 /** … … 44 60 * than or equal to a given bound, with corresponding multiplicities. 45 61 * 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 53 68 * (sorted in ascending order), 54 69 * 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 55 71 * 56 72 * 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 <= the58 * provided bound (if this is not zero).73 * k is the number of mutually distinct prime factors (<= a provided non- 74 * zero bound). 59 75 * 60 * @return the factorisation data in a list76 * @return the factorisation data in a SINGULAR-internal list 61 77 **/ 62 78 lists 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 */ 65 82 ); 66 83
Note: See TracChangeset
for help on using the changeset viewer.