Changeset edc416 in git
- Timestamp:
- Jun 17, 2014, 5:57:27 PM (10 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- e6a143985100941ba5863e562ed668184e2e6b27
- Parents:
- 50a6c59553a4e9ed5c3b72c3937a614ffbeac4f5ef861dca4884e7cc85c510a8c52ad684bddcd892
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/syzextra/syzextra.cc
ref861dc redc416 388 388 { 389 389 const int sizeNew = IDELEMS(id); 390 390 typedef int(*cmp_fct)(const void *, const void *); 391 392 #ifdef HAVE_QSORT_R 391 393 #if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || defined __FREEBSD__ || defined __BSD__ || defined OpenBSD3_1 || defined OpenBSD3_9) 392 394 #define qsort_my(m, s, ss, r, cmp) qsort_r(m, s, ss, r, cmp) … … 394 396 #define qsort_my(m, s, ss, r, cmp) qsort_r(m, s, ss, cmp, r) 395 397 #else 396 #define qsort_my(m, s, ss, r, cmp) qsort(m, s, ss, cmp) 398 #define qsort_my(m, s, ss, r, cmp) qsort(m, s, ss, (cmp_fct)(cmp)) 399 #endif 400 #else 401 #define qsort_my(m, s, ss, r, cmp) qsort(m, s, ss, (cmp_fct)(cmp)) 397 402 #endif 398 403 -
configure.ac
ref861dc redc416 42 42 AC_CHECK_HEADERS(unistd.h iostream.h sys/time.h sys/times.h asm/sigcontext.h) 43 43 44 AC_CHECK_FUNCS(readlink getcwd getwd setenv putenv )44 AC_CHECK_FUNCS(readlink getcwd getwd setenv putenv qsort_r) 45 45 46 46 -
factory/cf_gcd_smallp.cc
r50a6c5 redc416 676 676 if (d0 == 0) 677 677 { 678 if (inextension) 679 { 680 CFList u, v; 681 ppA= mapDown (ppA, prim_elem, im_prim_elem, alpha, u, v); 682 ppB= mapDown (ppB, prim_elem, im_prim_elem, alpha, u, v); 683 } 678 684 coF= N (ppA*(cA/gcdcAcB)); 679 685 coG= N (ppB*(cB/gcdcAcB)); -
factory/facAbsFact.cc
r50a6c5 redc416 460 460 else if (biFactors.length() > minFactorsLength) 461 461 refineBiFactors (A, biFactors, Aeval2, evaluation, minFactorsLength); 462 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 463 464 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y); 465 466 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, biFactors, evaluation); 467 468 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 469 470 if (minFactorsLength == 1) 471 { 472 factors.append (CFAFactor (A, 1, 1)); 473 decompress (factors, N); 474 if (isOn (SW_RATIONAL)) 475 normalize (factors); 476 delete [] Aeval2; 477 return factors; 478 } 462 479 463 480 bool found= false; … … 502 519 } 503 520 } 504 505 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y);506 507 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, evaluation);508 521 509 522 CFList * oldAeval= new CFList [lengthAeval2]; -
factory/facFactorize.cc
r50a6c5 redc416 394 394 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 395 395 396 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y); 397 398 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, biFactors, evaluation); 399 400 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 401 402 if (minFactorsLength == 1) 403 { 404 factors.append (A); 405 appendSwapDecompress (factors, contentAFactors, N, 0, 0, x); 406 if (isOn (SW_RATIONAL)) 407 normalize (factors); 408 delete [] Aeval2; 409 return factors; 410 } 411 396 412 if (differentSecondVar == lengthAeval2) 397 413 { … … 421 437 } 422 438 } 423 424 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y);425 426 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, evaluation);427 439 428 440 CFList * oldAeval= new CFList [lengthAeval2]; -
factory/facFqFactorize.cc
r50a6c5 redc416 2004 2004 } 2005 2005 2006 void 2007 checkHelper (const CanonicalForm& f1, CFList& factors1, CFList& factors2, 2008 CFList& l1, CFList& l2) 2009 { 2010 CanonicalForm g1= f1, g2; 2011 CFListIterator iter1= factors1, iter2= factors2; 2012 for (; iter1.hasItem(); iter1++, iter2++) 2013 { 2014 g2= gcd (g1, iter1.getItem()); 2015 if (!g2.inCoeffDomain()) 2016 { 2017 l1.append (iter1.getItem()); 2018 l2.append (iter2.getItem()); 2019 g1 /= g2; 2020 } 2021 } 2022 factors1= Difference (factors1, l1); 2023 factors2= Difference (factors2, l2); 2024 } 2025 2026 /// check if univariate factors @a factors2 of @a factors3 coincide with 2027 /// univariate factors of @a factors1 and recombine if necessary. 2028 /// The recombined factors of @a factors1 are returned and @a factors3 is 2029 /// recombined accordingly. 2030 CFList 2031 checkOneToOne (const CFList& factors1, const CFList& factors2, CFList& factors3, 2032 const CanonicalForm& evalPoint, const Variable& x) 2033 { 2034 CFList uniFactorsOfFactors1; 2035 CFList result, result2; 2036 CFList bad1= factors2; 2037 CFListIterator iter, iter2, iter3; 2038 CanonicalForm tmp; 2039 int pos; 2040 2041 for (iter= factors1; iter.hasItem(); iter++) 2042 { 2043 tmp= iter.getItem() (evalPoint, x); 2044 tmp /= Lc (tmp); 2045 if (pos= findItem (factors2, tmp)) 2046 { 2047 result2.append (getItem (factors3, pos)); 2048 result.append (iter.getItem()); 2049 bad1= Difference (bad1, CFList (tmp)); 2050 } 2051 else 2052 uniFactorsOfFactors1.append (tmp); 2053 } 2054 2055 CFList bad2, bad3; 2056 bad2= Difference (factors1, result); 2057 bad3= Difference (factors3, result2); 2058 CFList tmp2, tmp3; 2059 CanonicalForm g1, g2, g3, g4; 2060 2061 while (!uniFactorsOfFactors1.isEmpty()) 2062 { 2063 tmp= uniFactorsOfFactors1.getFirst(); 2064 checkHelper (tmp, bad1, bad3, tmp2, tmp3); 2065 g1= prod (tmp2); 2066 g2= prod (tmp3); 2067 tmp2= CFList(); 2068 tmp3= CFList(); 2069 checkHelper (g1, uniFactorsOfFactors1, bad2, tmp2, tmp3); 2070 g3= prod (tmp2); 2071 g4= prod (tmp3); 2072 tmp2= CFList(); 2073 tmp3= CFList(); 2074 do 2075 { 2076 checkHelper (g3, bad1, bad3, tmp2, tmp3); 2077 g1 *= prod (tmp2); 2078 g2 *= prod (tmp3); 2079 tmp2= CFList(); 2080 tmp3= CFList(); 2081 checkHelper (g1, uniFactorsOfFactors1, bad2, tmp2, tmp3); 2082 g3 *= prod (tmp2); 2083 g4 *= prod (tmp3); 2084 tmp2= CFList(); 2085 tmp3= CFList(); 2086 } while (!bad2.isEmpty() && !bad3.isEmpty()); 2087 result.append (g4); 2088 result2.append (g2); 2089 } 2090 2091 if (factors3.length() != result2.length()) 2092 factors3= result2; 2093 return result; 2094 } 2095 2006 2096 //recombine bivariate factors in case one bivariate factorization yields less 2007 2097 // factors than the other … … 2021 2111 CFArray TT; 2022 2112 TT= copy (factors1); 2113 int recombinations= 0; 2023 2114 while (T.length() >= 2*s && s <= thres) 2024 2115 { … … 2028 2119 { 2029 2120 delete [] v; 2030 result.append (prod (T)); 2121 if (recombinations == factors2.length() - 1) 2122 result.append (prod (T)); 2123 else 2124 result= Union (result, T); 2031 2125 return result; 2032 2126 } … … 2037 2131 if (find (factors2, buf)) 2038 2132 { 2133 recombinations++; 2039 2134 T= Difference (T, S); 2040 2135 result.append (prod (S)); … … 2047 2142 if (T.length() < 2*s || T.length() == s) 2048 2143 { 2144 if (recombinations == factors2.length() - 1) 2145 result.append (prod (T)); 2146 else 2147 result= Union (result, T); 2049 2148 delete [] v; 2050 result.append (prod (T));2051 2149 return result; 2052 2150 } … … 2059 2157 if (T.length() < 2*s) 2060 2158 { 2061 result .append (prod (T));2159 result= Union (result, T); 2062 2160 return result; 2063 2161 } … … 2134 2232 2135 2233 void sortByUniFactors (CFList*& Aeval, int AevalLength, 2136 const CFList& uniFactors, const CFList& evaluation 2234 CFList& uniFactors, CFList& biFactors, 2235 const CFList& evaluation 2137 2236 ) 2138 2237 { … … 2143 2242 CFList LCs, buf; 2144 2243 CFArray l; 2145 int pos, index ;2244 int pos, index, checklength; 2146 2245 bool leaveLoop=false; 2246 recurse: 2147 2247 for (int j= 0; j < AevalLength; j++) 2148 2248 { … … 2173 2273 Aeval[j].length() - uniFactors.length() + 1, 2174 2274 evalPoint, v); 2275 2276 checklength= biFactors.length(); 2277 Aeval[j]= checkOneToOne (Aeval[j], uniFactors, biFactors, evalPoint, v); 2278 if (checklength > biFactors.length()) 2279 { 2280 uniFactors= buildUniFactors (biFactors, evaluation.getLast(), 2281 Variable (2)); 2282 goto recurse; 2283 } 2175 2284 2176 2285 buf= buildUniFactors (Aeval[j], evalPoint, v); … … 2776 2885 multiFactorize (const CanonicalForm& F, const ExtensionInfo& info) 2777 2886 { 2778 2779 2887 if (F.inCoeffDomain()) 2780 2888 return CFList (F); … … 2883 2991 else 2884 2992 { 2885 if (swapLevel == 1)2886 {2887 swapLevel= i;2888 bufA= swapvar (A, x, z);2889 }2890 2993 gcdDerivZ= gcd (bufA, derivZ); 2891 2994 if (degree (gcdDerivZ) > 0 && !derivZ.isZero()) … … 2902 3005 else 2903 3006 { 3007 if (swapLevel == 1) 3008 { 3009 swapLevel= i; 3010 bufA= swapvar (A, x, z); 3011 } 2904 3012 A= bufA; 2905 3013 break; … … 3091 3199 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 3092 3200 3201 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y); 3202 3203 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, biFactors, evaluation); 3204 3205 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 3206 3207 if (minFactorsLength == 1) 3208 { 3209 if (extension) 3210 { 3211 CFList source, dest; 3212 A= mapDown (A, info, source, dest); 3213 } 3214 factors.append (A); 3215 appendSwapDecompress (factors, contentAFactors, N, swapLevel, 3216 swapLevel2, x); 3217 if (!extension) 3218 normalize (factors); 3219 delete [] Aeval2; 3220 return factors; 3221 } 3222 3093 3223 if (differentSecondVar == lengthAeval2) 3094 3224 { … … 3123 3253 } 3124 3254 } 3125 3126 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y);3127 3128 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, evaluation);3129 3255 3130 3256 CFList * oldAeval= new CFList [lengthAeval2]; //TODO use bufAeval2 for this -
factory/facFqFactorize.h
r50a6c5 redc416 565 565 566 566 /// refine a bivariate factorization of A with l factors to one with 567 /// minFactorsLength 567 /// minFactorsLength if possible 568 568 void 569 569 refineBiFactors (const CanonicalForm& A, ///< [in] some poly … … 589 589 590 590 /// sort bivariate factors in Aeval such that their corresponding univariate 591 /// factors coincide with uniFactors 591 /// factors coincide with uniFactors, uniFactors and biFactors may get 592 /// recombined if necessary 592 593 void sortByUniFactors (CFList*& Aeval, ///< [in,out] array of bivariate 593 594 ///< factors 594 595 int AevalLength, ///< [in] length of Aeval 595 const CFList& uniFactors,///< [in] univariate factors 596 CFList& uniFactors, ///< [in,out] univariate factors 597 CFList& biFactors, ///< [in,out] bivariate factors 596 598 const CFList& evaluation ///< [in] evaluation point 597 599 ); -
factory/facSparseHensel.h
r50a6c5 redc416 398 398 CanonicalForm B= LC (A); 399 399 if (B.level() < level) 400 F= -tailcoeff (A/B); 400 { 401 CanonicalForm quot; 402 if (fdivides (B, A, quot)) 403 F= -tailcoeff (quot); 404 } 401 405 } 402 406 }
Note: See TracChangeset
for help on using the changeset viewer.