Changeset 04cdf06 in git
- Timestamp:
- Dec 14, 2010, 1:53:42 PM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 3da413f2c6332c298e7f4115ffffdc526d5e914a
- Parents:
- ab5b77f9e4845c4931341d1ae2da855f56b7b706
- Location:
- factory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFqBivar.cc
rab5b77 r04cdf06 860 860 else 861 861 { 862 if (GF) 863 gcdDerivX= GCD_GF (A, derivX); 864 else if (alpha == x) 865 gcdDerivX= GCD_small_p (A, derivX); 866 else 867 gcdDerivX= GCD_Fp_extension (A, derivX, alpha); 862 gcdDerivX= gcd (A, derivX); 868 863 if (degree (gcdDerivX) > 0) 869 864 { … … 885 880 else 886 881 { 887 if (GF) 888 gcdDerivY= GCD_GF (A, derivY); 889 else if (alpha == x) 890 gcdDerivY= GCD_small_p (A, derivY); 891 else 892 gcdDerivY= GCD_Fp_extension (A, derivY, alpha); 882 gcdDerivY= gcd (A, derivY); 893 883 if (degree (gcdDerivY) > 0) 894 884 { -
factory/facFqFactorize.cc
rab5b77 r04cdf06 49 49 CanonicalForm G= swapvar (F, F.mvar(), Variable (1)); 50 50 CFList L; 51 Variable alpha;52 bool algExt= hasFirstAlgVar (G, alpha);53 51 for (CFIterator i= G; i.hasTerms(); i++) 54 52 L.append (i.coeff()); 55 53 if (L.length() == 2) 56 { 57 bool GF= (CFFactory::gettype() == GaloisFieldDomain); 58 if (GF) 59 { 60 return swapvar (GCD_GF (L.getFirst(), L.getLast()), F.mvar(), 61 Variable (1)); 62 } 63 else if (!GF && algExt) 64 { 65 return swapvar (GCD_Fp_extension (L.getFirst(), L.getLast(), alpha), 66 F.mvar(), Variable (1)); 67 } 68 else 69 return swapvar (GCD_small_p (L.getFirst(), L.getLast()), F.mvar(), 70 Variable (1)); 71 } 54 return swapvar (gcd (L.getFirst(), L.getLast()), F.mvar(), Variable (1)); 72 55 if (L.length() == 1) 73 {74 56 return LC (F, Variable (1)); 75 }76 57 return swapvar (listGCD (L), F.mvar(), Variable (1)); 77 58 } … … 83 64 if (L.length() == 1) 84 65 return L.getFirst(); 85 Variable alpha;86 66 if (L.length() == 2) 87 { 88 bool GF= (CFFactory::gettype() == GaloisFieldDomain); 89 if (GF) 90 { 91 return GCD_GF (L.getFirst(), L.getLast()); 92 } 93 else if (!GF && (hasFirstAlgVar (L.getFirst(), alpha) || 94 hasFirstAlgVar (L.getLast(), alpha))) 95 { 96 return GCD_Fp_extension (L.getFirst(), L.getLast(), alpha); 97 } 98 else 99 return GCD_small_p (L.getFirst(), L.getLast()); 100 } 67 return gcd (L.getFirst(), L.getLast()); 101 68 else 102 69 { … … 104 71 CanonicalForm resultHi, resultLo; 105 72 int length= L.length()/2; 106 bool GF= (CFFactory::gettype() == GaloisFieldDomain);107 73 int j= 0; 108 74 for (CFListIterator i= L; j < length; i++, j++) … … 113 79 if (resultHi.isOne() || resultLo.isOne()) 114 80 return 1; 115 if (GF) 116 { 117 return GCD_GF (resultHi, resultLo); 118 } 119 else if (!GF && (hasFirstAlgVar (resultHi, alpha) || 120 hasFirstAlgVar (resultLo, alpha))) 121 { 122 return GCD_Fp_extension (resultHi, resultLo, alpha); 123 } 124 else 125 return GCD_small_p (resultHi, resultLo); 81 return gcd (resultHi, resultLo); 126 82 } 127 83 } … … 147 103 if (L.length() == 2) 148 104 { 149 bool GF= (CFFactory::gettype() == GaloisFieldDomain); 150 if (GF) 151 { 152 if (swap) 153 return swapvar(GCD_GF (L.getFirst(), L.getLast()), F.mvar(), x); 154 else 155 return GCD_GF (L.getFirst(), L.getLast()); 156 } 157 else if (!GF && algExt) 158 { 159 if (swap) 160 return swapvar(GCD_Fp_extension (L.getFirst(), L.getLast(), alpha), 161 F.mvar(), x); 162 else 163 return GCD_Fp_extension (L.getFirst(), L.getLast(), alpha); 164 } 105 if (swap) 106 return swapvar (gcd (L.getFirst(), L.getLast()), F.mvar(), x); 165 107 else 166 { 167 if (swap) 168 return swapvar (GCD_small_p (L.getFirst(), L.getLast()), F.mvar(), 169 x); 170 else 171 return GCD_small_p (L.getFirst(), L.getLast()); 172 } 108 return gcd (L.getFirst(), L.getLast()); 173 109 } 174 110 if (L.length() == 1) … … 181 117 return listGCD (L); 182 118 } 183 184 static inline185 CanonicalForm186 myLcm (const CanonicalForm& F, const CanonicalForm& G)187 {188 if ( F.isZero() || G.isZero() )189 return 0;190 else191 {192 Variable alpha;193 bool GF= (CFFactory::gettype() == GaloisFieldDomain);194 if (GF)195 return (F/GCD_GF (F, G))*G;196 else if (!GF && (hasFirstAlgVar (F, alpha) ||197 hasFirstAlgVar (G, alpha)))198 return (F/GCD_Fp_extension (F, G, alpha))*G;199 else200 return (F/GCD_small_p (F, G))*G;201 }202 }203 204 119 205 120 static inline … … 1346 1261 contentAi.append (myContent (A, i)); 1347 1262 contentAi.append (myContent (A, i - 1)); 1348 CanonicalForm result= myLcm (contentAi.getFirst(), contentAi.getLast());1263 CanonicalForm result= lcm (contentAi.getFirst(), contentAi.getLast()); 1349 1264 for (i= i - 2; i > 0; i--) 1350 1265 { 1351 1266 contentAi.append (content (A, i)); 1352 result= myLcm (result, contentAi.getLast());1267 result= lcm (result, contentAi.getLast()); 1353 1268 } 1354 1269 return result; … … 1750 1665 A= swapvar (A, x, z); 1751 1666 } 1752 if (GF) 1753 gcdDerivZ= GCD_GF (bufA, derivZ); 1754 else if (alpha == Variable (1)) 1755 gcdDerivZ= GCD_small_p (bufA, derivZ); 1756 else 1757 gcdDerivZ= GCD_Fp_extension (bufA, derivZ, alpha); 1667 gcdDerivZ= gcd (bufA, derivZ); 1758 1668 if (degree (gcdDerivZ) > 0 && !derivZ.isZero()) 1759 1669 { -
factory/facFqSquarefree.cc
rab5b77 r04cdf06 77 77 Variable buf= alpha; 78 78 CanonicalForm b= deriv (F, x); 79 bool GF= (CFFactory::gettype() == GaloisFieldDomain); 80 if (GF) 81 c= GCD_GF (F, b); 82 else if (GF == false && k != 1) 83 c= GCD_Fp_extension (F, b, buf); 84 else 85 c= GCD_small_p (F, b); 79 c= gcd (F, b); 86 80 CanonicalForm w= F/c; 87 81 CanonicalForm v= b/c; … … 93 87 while (j < p - 1 && degree(u) >= 0) 94 88 { 95 if (GF) 96 g= GCD_GF (w, u); 97 else if (GF == false && k != 1) 98 g= GCD_Fp_extension (w, u, buf); 99 else 100 g= GCD_small_p (w, u); 89 g= gcd (w, u); 101 90 if (degree(g) > 0) 102 91 result.append (CFFactor (g, j)); … … 190 179 for (CFFListIterator j= tmp1; j.hasItem(); j++) 191 180 { 192 if (GF) 193 tmp= GCD_GF (i.getItem().factor(), j.getItem().factor()); 194 else if (GF == false && buf == Variable (1)) 195 tmp= GCD_small_p (i.getItem().factor(), j.getItem().factor()); 196 else 197 tmp= GCD_Fp_extension (i.getItem().factor(),j.getItem().factor(),buf); 181 tmp= gcd (i.getItem().factor(), j.getItem().factor()); 198 182 i.getItem()= CFFactor (i.getItem().factor()/tmp, i.getItem().exp()); 199 183 j.getItem()= CFFactor (j.getItem().factor()/tmp, j.getItem().exp()); … … 243 227 return 1; 244 228 } 245 if (GF) 246 w= GCD_GF (A, deriv (A, Variable (i))); 247 else if (GF == false && alpha == Variable (1)) 248 w= GCD_small_p (A, deriv (A, Variable (i))); 249 else 250 w= GCD_Fp_extension (A, deriv (A, Variable (i)), vBuf); 229 w= gcd (A, deriv (A, Variable (i))); 251 230 252 231 b= A/w; … … 260 239 { 261 240 b= w; 262 if (GF) 263 w= GCD_GF (w, deriv (w, Variable (i))); 264 else if (GF == false && vBuf == Variable (1)) 265 w= GCD_small_p (w, deriv (w, Variable (i))); 266 else 267 w= GCD_Fp_extension (w, deriv (w, Variable (i)), vBuf); 241 w= gcd (w, deriv (w, Variable (i))); 268 242 b /= w; 269 243 if (degree (b) < 1) 270 244 break; 271 245 CanonicalForm g; 272 if (GF) 273 g= GCD_GF (b, result); 274 else if (GF == false && vBuf == Variable (1)) 275 g= GCD_small_p (b, result); 276 else 277 g= GCD_Fp_extension (b, result, vBuf); 246 g= gcd (b, result); 278 247 if (degree (g) > 0) 279 248 result *= b/g;
Note: See TracChangeset
for help on using the changeset viewer.