Changeset 9e2029c in git
- Timestamp:
- Jun 5, 2014, 5:11:56 PM (9 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 0bd659380ba176abcaad091e0fdef5817cb9954d
- Parents:
- f8df35286530f57c88ffeb98595d16aa5edd60f4
- git-author:
- Martin Lee <martinlee84@web.de>2014-06-05 17:11:56+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2014-06-17 14:08:30+02:00
- Location:
- factory
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facAbsFact.cc
rf8df35 r9e2029c 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
rf8df35 r9e2029c 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
rf8df35 r9e2029c 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 factors3= result2; 2092 return result; 2093 } 2094 2006 2095 //recombine bivariate factors in case one bivariate factorization yields less 2007 2096 // factors than the other … … 2021 2110 CFArray TT; 2022 2111 TT= copy (factors1); 2112 int recombinations= 0; 2023 2113 while (T.length() >= 2*s && s <= thres) 2024 2114 { … … 2028 2118 { 2029 2119 delete [] v; 2030 result.append (prod (T)); 2120 if (recombinations == factors2.length() - 1) 2121 result.append (prod (T)); 2122 else 2123 result= Union (result, T); 2031 2124 return result; 2032 2125 } … … 2037 2130 if (find (factors2, buf)) 2038 2131 { 2132 recombinations++; 2039 2133 T= Difference (T, S); 2040 2134 result.append (prod (S)); … … 2047 2141 if (T.length() < 2*s || T.length() == s) 2048 2142 { 2143 if (recombinations == factors2.length() - 1) 2144 result.append (prod (T)); 2145 else 2146 result= Union (result, T); 2049 2147 delete [] v; 2050 result.append (prod (T));2051 2148 return result; 2052 2149 } … … 2059 2156 if (T.length() < 2*s) 2060 2157 { 2061 result .append (prod (T));2158 result= Union (result, T); 2062 2159 return result; 2063 2160 } … … 2134 2231 2135 2232 void sortByUniFactors (CFList*& Aeval, int AevalLength, 2136 const CFList& uniFactors, const CFList& evaluation 2233 CFList& uniFactors, CFList& biFactors, 2234 const CFList& evaluation 2137 2235 ) 2138 2236 { … … 2143 2241 CFList LCs, buf; 2144 2242 CFArray l; 2145 int pos, index ;2243 int pos, index, checklength; 2146 2244 bool leaveLoop=false; 2245 recurse: 2147 2246 for (int j= 0; j < AevalLength; j++) 2148 2247 { … … 2173 2272 Aeval[j].length() - uniFactors.length() + 1, 2174 2273 evalPoint, v); 2274 2275 checklength= biFactors.length(); 2276 Aeval[j]= checkOneToOne (Aeval[j], uniFactors, biFactors, evalPoint, v); 2277 if (checklength > biFactors.length()) 2278 { 2279 uniFactors= buildUniFactors (biFactors, evaluation.getLast(), 2280 Variable (2)); 2281 goto recurse; 2282 } 2175 2283 2176 2284 buf= buildUniFactors (Aeval[j], evalPoint, v); … … 2776 2884 multiFactorize (const CanonicalForm& F, const ExtensionInfo& info) 2777 2885 { 2778 2779 2886 if (F.inCoeffDomain()) 2780 2887 return CFList (F); … … 3091 3198 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 3092 3199 3200 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y); 3201 3202 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, biFactors, evaluation); 3203 3204 minFactorsLength= tmin (minFactorsLength, biFactors.length()); 3205 3206 if (minFactorsLength == 1) 3207 { 3208 if (extension) 3209 { 3210 CFList source, dest; 3211 A= mapDown (A, info, source, dest); 3212 } 3213 factors.append (A); 3214 appendSwapDecompress (factors, contentAFactors, N, swapLevel, 3215 swapLevel2, x); 3216 if (!extension) 3217 normalize (factors); 3218 delete [] Aeval2; 3219 return factors; 3220 } 3221 3093 3222 if (differentSecondVar == lengthAeval2) 3094 3223 { … … 3123 3252 } 3124 3253 } 3125 3126 CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y);3127 3128 sortByUniFactors (Aeval2, lengthAeval2, uniFactors, evaluation);3129 3254 3130 3255 CFList * oldAeval= new CFList [lengthAeval2]; //TODO use bufAeval2 for this -
factory/facFqFactorize.h
rf8df35 r9e2029c 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 );
Note: See TracChangeset
for help on using the changeset viewer.