Changeset e8eba7 in git for Singular/LIB/paraplanecurves.lib
- Timestamp:
- Aug 10, 2012, 2:49:42 PM (12 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 73260639099e75033ef78f48ad34a0ee10e1c15e
- Parents:
- e11ed0be7258f8a5789019dc86eb3edff31cfaf5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/paraplanecurves.lib
re11ed0 re8eba7 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id $";2 version="$Id: paraplanecurves.lib 14461 2011-12-14 11:00:17Z motsak $"; 3 3 category="Algebraic Geometry"; 4 4 info=" … … 26 26 library, also van Hoeij's algorithm for computing the integral basis will 27 27 be available. @* 28 From the integral basis, the adjoint ideal is obtained by linear algebra.28 >From the integral basis, the adjoint ideal is obtained by linear algebra. 29 29 Alternatively, the algorithm starts with a local analysis of the singular 30 30 locus of C. Then, for each primary component of the singular locus which … … 255 255 see @ref{integralbasis_lib}. In a future edition of the library, also van Hoeij's 256 256 algorithm for computing the integral basis will be available. @* 257 From the integral basis, the adjoint ideal is obtained by linear algebra.257 >From the integral basis, the adjoint ideal is obtained by linear algebra. 258 258 Alternatively, the algorithm starts with a local analysis of the singular 259 259 locus of C. Then, for each primary component of the singular locus which … … 486 486 from @ref{normal_lib}: see @ref{integralbasis_lib}. In a future edition of the library, 487 487 also van Hoeij's algorithm for computing the integral basis will be available.@* 488 From the integral basis, the adjoint ideal is obtained by linear algebra.488 >From the integral basis, the adjoint ideal is obtained by linear algebra. 489 489 Alternatively, the algorithm starts with a local analysis of the singular 490 490 locus of C. Then, for each primary component of the singular locus which … … 1941 1941 1942 1942 /////////////////////////////////////////////////////////////////////////////// 1943 static proc aMod(bigint a, bigint b) 1944 "USAGE: aMod(a,b); a, b bigint 1945 RETURN: r bigint 1946 THEORY: The asymmetric residue r of the division with remainder a mod b. 1947 " 1948 { 1949 bigint c = a mod b; 1950 if (c<0) 1951 { 1952 return(c+b); 1953 } 1954 return(c); 1955 } 1956 1957 /////////////////////////////////////////////////////////////////////////////// 1958 static proc aDiv(bigint a, bigint b) 1959 "USAGE: aDiv(a,b); a, b bigint 1960 RETURN: q bigint 1961 THEORY: Quotient with remainder q = a div b with asymmetric residue. 1962 " 1963 { 1964 bigint q = a div b; 1965 if ((a mod b)<0) 1966 { 1967 return(q-1); 1968 } 1969 return(q); 1970 } 1971 1972 1973 1974 /////////////////////////////////////////////////////////////////////////////// 1943 1975 static proc polyModP(poly q, bigint p) 1944 1976 "USAGE: polyModP(q, p); q poly, p bigint … … 2015 2047 b = inverseModP(bigint(leadcoef(q)), p); 2016 2048 q = q - lead(q); 2017 root = (bigint(q) * b) mod p;2049 root = aMod((bigint(q) * b),p); 2018 2050 if (((root * root - r) mod p) != 0) { root = 0; } 2019 2051 } … … 2035 2067 list L = extendedEuclid(r, p); 2036 2068 if (L[1] != 1) { "ERROR: GCD of", r, "and", p, "should be 1."; } 2037 L[2] = L[2] mod p;2069 L[2] = aMod(L[2],p); 2038 2070 return (L[2]); 2039 2071 } … … 2083 2115 for (i = 1; i <= size(L[1]); i++) 2084 2116 { 2085 roots = insert(roots, rootModP( r mod L[1][i], L[1][i]), size(roots));2117 roots = insert(roots, rootModP(aMod(r,L[1][i]), L[1][i]), size(roots)); 2086 2118 } 2087 2119 … … 2095 2127 c = bigint(roots[i]); l = pPower; 2096 2128 temp = r - c * c; l = bigint(2) * c * l; c = temp; 2097 c = c div pPower; l = l div pPower;2098 c = c mod L[1][i]; l = l mod L[1][i];2099 c = (c * bigint(inverseModP(l, L[1][i]))) mod L[1][i];2129 c = aDiv(c,pPower); l = aDiv(l,pPower); 2130 c = aMod(c,L[1][i]); l = aMod(l,L[1][i]); 2131 c = aMod((c * bigint(inverseModP(l, L[1][i]))), L[1][i]); 2100 2132 c = bigint(roots[i]) + c * pPower; 2101 2133 pPower = pPower * L[1][i]; roots[i] = c; … … 2114 2146 mm = insert(mm, z, size(mm)); 2115 2147 } 2116 return ( chineseRemainder(roots, mm) mod m);2148 return (aMod(chineseRemainder(roots, mm) , m)); 2117 2149 } 2118 2150 } … … 2134 2166 for (i = 1; i <= size(mm); i++) 2135 2167 { 2136 N = M div mm[i];2168 N = aDiv(M,mm[i]); 2137 2169 l = extendedEuclid(mm[i], N); 2138 2170 x = x + rr[i]*l[3]*N; … … 2209 2241 cc = c; if (cc <= 0) { cc = -cc; } 2210 2242 R1 = squareRoot(-a*b, cc, 0); 2211 r1 = (R1 * inverseModP(a, cc)) mod cc;2243 r1 = aMod((R1 * inverseModP(a, cc)), cc); 2212 2244 if (r1*bigint(2) > cc) { r1 = r1 - cc; } 2213 2245 Q = (a*r1*r1 + b)/c; … … 2272 2304 if (a == 0) { l = b, 0, 1; if (b < 0) { l = -b, 0, -1; } } 2273 2305 if (b == 0) { l = a, 1, 0; if (a < 0) { l = -a, -1, 0; } } 2274 if ( (a modb) == 0) { l = b, 0, 1; if (b < 0) { l = -b, 0, -1; } }2275 if ( (b moda) == 0) { l = a, 1, 0; if (a < 0) { l = -a, -1, 0; } }2306 if (aMod(a , b) == 0) { l = b, 0, 1; if (b < 0) { l = -b, 0, -1; } } 2307 if (aMod(b , a) == 0) { l = a, 1, 0; if (a < 0) { l = -a, -1, 0; } } 2276 2308 if (size(l) > 1) { return (l); } 2277 2309 2278 temp = a mod b;2310 temp = aMod(a , b); 2279 2311 l = extendedEuclid(b, temp); 2280 2312 temp = (a - temp) / b; … … 2292 2324 " 2293 2325 { 2294 bigint rr = r mod p;2326 bigint rr = aMod(r , p); 2295 2327 if (rr == 0) { return (0) } 2296 2328 if (rr == 1) { return (1) } … … 2301 2333 while (e > 0) 2302 2334 { 2303 if ((e mod 2) == 1) { result = (result * power) mod p; }2335 if ((e mod 2) == 1) { result = aMod((result * power), p); } 2304 2336 e = e / bigint(2); 2305 power = (power * power) mod p;2337 power = aMod((power * power), p); 2306 2338 } 2307 2339 if (result > 1) { result = result - p; /* should be -1 */ }
Note: See TracChangeset
for help on using the changeset viewer.