Changeset 797a9ff in git
- Timestamp:
- Oct 1, 2010, 1:53:08 PM (14 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
- Children:
- cd055e1dd6e77006ee3347c53932f782e97afc29
- Parents:
- f2de2ee419de0f638b6b86c0d38f82d6e481ae9e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/paraplanecurves.lib
rf2de2e r797a9ff 1826 1826 bigint nn = n; if (nn < 0) { nn = -n; } 1827 1827 list L = primefactors(nn); 1828 if (L[ 1] != 1)1828 if (L[3] != 1) 1829 1829 { "WARNING: command 'primefactors(.)' did not find all prime factors"; } 1830 1830 int i; bigint m = bigint(1); int e; int j; 1831 for (i = 1; i <= size(L[ 2]); i = i + 1)1831 for (i = 1; i <= size(L[1]); i++) 1832 1832 { 1833 e = L[ 3][i] / 2;1834 for (j = 1; j <= e; j = j + 1) { m = m * bigint(L[2][i]); }1833 e = L[2][i] / 2; 1834 for (j = 1; j <= e; j++) { m = m * bigint(L[1][i]); } 1835 1835 } 1836 1836 return (m); … … 1891 1891 /* For small p, we use a brute force approach: */ 1892 1892 int i; 1893 for (i = 2; i < p; i = i + 1)1893 for (i = 2; i < p; i++) 1894 1894 { 1895 1895 if (((i*i) mod p) == r) { return (i); } … … 1974 1974 1975 1975 list L = primefactors(m); 1976 if ( L[1] != 1)1976 if ((L[3] != 1)||(L[3]!=-1)) 1977 1977 { "WARNING: command 'primefactors(.)' did not find all prime factors"; } 1978 1978 int i; 1979 for (i = 1; i <= size(L[2]); i = i + 1)1979 for (i = 1; i <= size(L[2]); i++) 1980 1980 { 1981 if (legendreSymbol(r, L[ 2][i]) == -1) { return (-1); }1981 if (legendreSymbol(r, L[1][i]) == -1) { return (-1); } 1982 1982 } 1983 1983 /* now we know that there is some x in {0, 1, m-1} with … … 1996 1996 list roots; 1997 1997 // 2.1): 1998 for (i = 1; i <= size(L[ 2]); i = i + 1)1999 { 2000 roots = insert(roots, rootModP(r mod L[ 2][i], L[2][i]), size(roots));1998 for (i = 1; i <= size(L[1]); i++) 1999 { 2000 roots = insert(roots, rootModP(r mod L[1][i], L[1][i]), size(roots)); 2001 2001 } 2002 2002 2003 2003 // 2.2): 2004 2004 bigint c; bigint l; bigint temp; bigint pPower; int e; 2005 for (i = 1; i <= size(roots); i = i + 1)2006 { 2007 pPower = bigint(L[ 2][i]);2008 for (e = 2; e <= L[ 3][i]; e = e + 1)2005 for (i = 1; i <= size(roots); i++) 2006 { 2007 pPower = bigint(L[1][i]); 2008 for (e = 2; e <= L[2][i]; e++) 2009 2009 { 2010 2010 c = bigint(roots[i]); l = pPower; 2011 2011 temp = r - c * c; l = bigint(2) * c * l; c = temp; 2012 2012 c = c div pPower; l = l div pPower; 2013 c = c mod L[ 2][i]; l = l mod L[2][i];2014 c = (c * bigint(inverseModP(l, L[ 2][i]))) mod L[2][i];2013 c = c mod L[1][i]; l = l mod L[1][i]; 2014 c = (c * bigint(inverseModP(l, L[1][i]))) mod L[1][i]; 2015 2015 c = bigint(roots[i]) + c * pPower; 2016 pPower = pPower * L[ 2][i]; roots[i] = c;2016 pPower = pPower * L[1][i]; roots[i] = c; 2017 2017 } 2018 2018 } … … 2020 2020 // 2.3): 2021 2021 list mm; bigint z; int j; 2022 for (i = 1; i <= size(L[ 2]); i = i + 1)2023 { 2024 z = bigint(L[ 2][i]);2025 for (j = 2; j <= L[ 3][i]; j = j + 1)2022 for (i = 1; i <= size(L[1]); i++) 2023 { 2024 z = bigint(L[1][i]); 2025 for (j = 2; j <= L[2][i]; j++) 2026 2026 { 2027 z = z * bigint(L[ 2][i]);2027 z = z * bigint(L[1][i]); 2028 2028 } 2029 2029 mm = insert(mm, z, size(mm)); … … 2046 2046 bigint x = bigint(0); int i; bigint N; list l; 2047 2047 bigint M = bigint(mm[1]); 2048 for (i = 2; i <= size(mm); i = i + 1) { M = M * bigint(mm[i]); }2049 for (i = 1; i <= size(mm); i = i + 1)2048 for (i = 2; i <= size(mm); i++) { M = M * bigint(mm[i]); } 2049 for (i = 1; i <= size(mm); i++) 2050 2050 { 2051 2051 N = M div mm[i];
Note: See TracChangeset
for help on using the changeset viewer.