Changeset 8336c9 in git for factory/facFqFactorizeUtil.cc
- Timestamp:
- Aug 15, 2012, 4:47:03 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '2234726c50d679d6664181a5c72f75a6fd64a787')
- Children:
- 5b390eae2a5015d099e164e415bf9de0df375fd5
- Parents:
- c7b56e2b570482a60737ec1d6e4bf209156c36fa
- git-author:
- Martin Lee <martinlee84@web.de>2012-08-15 16:47:03+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-09-04 18:01:18+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFqFactorizeUtil.cc
rc7b56e2 r8336c9 15 15 #include "canonicalform.h" 16 16 #include "cf_map.h" 17 #include "cf_algorithm.h" 17 18 18 19 static inline … … 188 189 } 189 190 190 191 CFList evaluateAtZero (const CanonicalForm& F) 192 { 193 CFList result; 194 CanonicalForm buf= F; 195 result.insert (buf); 196 for (int i= F.level(); i > 2; i--) 197 { 198 buf= buf (0, i); 199 result.insert (buf); 200 } 201 return result; 202 } 203 204 CFList evaluateAtEval (const CanonicalForm& F, const CFArray& eval) 205 { 206 CFList result; 207 CanonicalForm buf= F; 208 result.insert (buf); 209 int k= eval.size(); 210 for (int i= 1; i < k; i++) 211 { 212 buf= buf (eval[i], i + 2); 213 result.insert (buf); 214 } 215 return result; 216 } 217 218 CFList evaluateAtEval (const CanonicalForm& F, const CFList& evaluation, int l) 219 { 220 CFList result; 221 CanonicalForm buf= F; 222 result.insert (buf); 223 int k= evaluation.length() + l - 1; 224 CFListIterator j= evaluation; 225 for (int i= k; j.hasItem() && i > l; i--, j++) 226 { 227 if (F.level() < i) 228 continue; 229 buf= buf (j.getItem(), i); 230 result.insert (buf); 231 } 232 return result; 233 } 234 235 236 CFList recoverFactors (const CanonicalForm& F, const CFList& factors) 237 { 238 CFList result; 239 CanonicalForm tmp, tmp2; 240 CanonicalForm G= F; 241 for (CFListIterator i= factors; i.hasItem(); i++) 242 { 243 tmp= i.getItem()/content (i.getItem(), 1); 244 if (fdivides (tmp, G, tmp2)) 245 { 246 G= tmp2; 247 result.append (tmp); 248 } 249 } 250 return result; 251 } 252 253 CFList recoverFactors (const CanonicalForm& F, const CFList& factors, 254 const CFList& evaluation) 255 { 256 CFList result; 257 CanonicalForm tmp, tmp2; 258 CanonicalForm G= F; 259 for (CFListIterator i= factors; i.hasItem(); i++) 260 { 261 tmp= reverseShift (i.getItem(), evaluation, 2); 262 tmp /= content (tmp, 1); 263 if (fdivides (tmp, G, tmp2)) 264 { 265 G= tmp2; 266 result.append (tmp); 267 } 268 } 269 return result; 270 } 271 272 CFList recoverFactors (CanonicalForm& F, const CFList& factors, int* index) 273 { 274 CFList result; 275 CanonicalForm tmp, tmp2; 276 CanonicalForm G= F; 277 int j= 0; 278 for (CFListIterator i= factors; i.hasItem(); i++, j++) 279 { 280 if (i.getItem().isZero()) 281 { 282 index[j]= 0; 283 continue; 284 } 285 tmp= i.getItem(); 286 if (fdivides (tmp, G, tmp2)) 287 { 288 G= tmp2; 289 tmp /=content (tmp, 1); 290 result.append (tmp); 291 index[j]= 1; 292 } 293 else 294 index[j]= 0; 295 } 296 F= G; 297 return result; 298 }
Note: See TracChangeset
for help on using the changeset viewer.