Changeset 405ebc in git
- Timestamp:
- Jun 27, 2001, 3:58:06 PM (23 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 409020f4846b2e67e3e541d8288ef4e479652c98
- Parents:
- c7bbf368257aae665cbcd55c9a3d18af43aa3dc0
- Location:
- libfac
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libfac/charset/alg_factor.cc
rc7bbf3 r405ebc 3 3 // emacs edit mode for this file is -*- C++ -*- 4 4 //////////////////////////////////////////////////////////// 5 static char * rcsid = "$Id: alg_factor.cc,v 1. 6 2001-06-21 14:57:04Singular Exp $";5 static char * rcsid = "$Id: alg_factor.cc,v 1.7 2001-06-27 13:58:05 Singular Exp $"; 6 6 //////////////////////////////////////////////////////////// 7 7 // FACTORY - Includes … … 30 30 TIMING_DEFINE_PRINT(newfactoras_time); 31 31 32 static Varlist 33 Var_is_in_AS(const Varlist & uord, const CFList & Astar); 34 32 35 int getAlgVar(const CanonicalForm &f, Variable &X) 33 36 { … … 177 180 DEBOUTLN(cout, "sqrf_norm_sub: R= ", R); 178 181 // sqfree check ; R is a polynomial in K[x] 179 if ( getCharacteristic() == 0 ){ 182 if ( getCharacteristic() == 0 ) 183 { 180 184 temp= gcd(R, R.deriv(vf)); 181 185 DEBOUTLN(cout, "sqrf_norm_sub: temp= ", temp); … … 355 359 356 360 DEBINCLEVEL(cout,"alg_factor"); 361 DEBOUTLN(cout, "alg_factor: f= ", f); 357 362 substlist= simpleextension(Astar, vminpoly, Rstar); 358 363 DEBOUTLN(cout, "alg_factor: substlist= ", substlist); … … 666 671 /* 667 672 $Log: not supported by cvs2svn $ 673 Revision 1.6 2001/06/21 14:57:04 Singular 674 *hannes/GP: Factorize, newfactoras, ... 675 668 676 Revision 1.5 2001/06/18 08:44:39 pfister 669 677 * hannes/GP/michael: factory debug, Factorize … … 685 693 686 694 */ 687 -
libfac/charset/algfactor.cc
rc7bbf3 r405ebc 3 3 // emacs edit mode for this file is -*- C++ -*- 4 4 //////////////////////////////////////////////////////////// 5 static char * rcsid = "$Id: algfactor.cc,v 1. 4 2001-06-21 14:57:04Singular Exp $";5 static char * rcsid = "$Id: algfactor.cc,v 1.5 2001-06-27 13:58:05 Singular Exp $"; 6 6 //////////////////////////////////////////////////////////// 7 7 // FACTORY - Includes … … 28 28 #include "timing.h" 29 29 TIMING_DEFINE_PRINT(newfactoras_time); 30 31 int hasVar(const CanonicalForm &f, const Variable &v); 30 32 31 33 static CFFList … … 146 148 // check trivial case: 147 149 if ( degree(f, order.getLast())==0 || degree(g, order.getLast())==0) 150 { 151 DEBOUTLN(cout, "algcd Result= ", 1); 148 152 return CanonicalForm(1); 149 153 } 150 154 151 155 CFList bs; bs.append(f); bs.append(g); … … 163 167 { 164 168 result= cs.getLast(); 165 result/=result.Lc(); 169 CanonicalForm c=vcontent(result,Variable(1)); 170 //CanonicalForm c=result.Lc(); 171 result/=c; 172 for(CFListIterator i=as;i.hasItem(); i++ ) 173 { 174 if(hasVar(result,i.getItem().mvar())) 175 { 176 c=vcontent(result,Variable(i.getItem().level()+1)); 177 result/=c; 178 } 179 } 166 180 } 167 181 else result= CanonicalForm(1); 168 DEBOUTLN(cout, " Result= ", result);182 DEBOUTLN(cout, "algcd Result= ", result); 169 183 return result; 170 184 } … … 340 354 DEBOUT(cout, ",", fp(substback,vf)); 341 355 DEBOUT(cout, ") over K_r wrt ", vf); 342 //cout << "algcd(" << g << "," << fp(substback,vf) << " as:" << as <<endl;343 356 fp= algcd(g,fp(substback,vf), as, oldord); 344 //cout << "algcd res:" << fp << endl;345 357 DEBOUTLN(cout, " = ", fp); 346 358 if ( degree(fp,vf) > 0 ){ //otherwise it's a constant … … 360 372 DEBOUT(cout, ",", fp(substback,vf)); 361 373 DEBOUT(cout, ") over K_r wrt ", vf); 362 //cout << "algcd(" << g << "," << fp(substback,vf) << " as:" << as <<endl;363 374 fp= algcd(g,fp(substback,vf), as, oldord); 364 //cout << "algcd res:" << fp << endl;365 375 DEBOUTLN(cout, " = ", fp); 366 376 if ( degree(fp,vf) > 0 ){ //otherwise it's a constant … … 438 448 /* 439 449 $Log: not supported by cvs2svn $ 450 Revision 1.4 2001/06/21 14:57:04 Singular 451 *hannes/GP: Factorize, newfactoras, ... 452 440 453 Revision 1.3 2001/06/18 08:44:40 pfister 441 454 * hannes/GP/michael: factory debug, Factorize -
libfac/charset/charset.cc
rc7bbf3 r405ebc 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 static char * rcsid = "$Id: charset.cc,v 1. 6 2000-03-08 12:54:35 obachmanExp $";4 static char * rcsid = "$Id: charset.cc,v 1.7 2001-06-27 13:58:06 Singular Exp $"; 5 5 ///////////////////////////////////////////////////////////// 6 6 // FACTORY - Includes … … 55 55 if ( PS.length() < 2 ) return PS; 56 56 while ( ! QS.isEmpty() ) { 57 58 59 60 61 62 63 64 65 66 67 68 69 70 57 b = lowestRank( QS ); 58 cb = rank( b ); 59 DEBOUTLN(cout, "BasicSet: choose b = ", b); 60 DEBOUTLN(cout, "BasicSet: it's rank = ", cb); 61 BS=Union(CFList(b),BS);//BS.append( b ); 62 if ( rank( b ) == 0 ) 63 return Union(PS, CFList(b)) ; // b should be the first elem! 64 else { 65 RS = CFList(); 66 // QS:= {q \in QS -{B} | q is reduced wrt b} 67 // We can process whole QS, because b is not reduced wrt. b 68 for ( CFListIterator i = QS; i.hasItem(); ++i ) 69 if ( degree( i.getItem(), cb ) < degree( b ) ) 70 //RS.append( i.getItem() ); 71 71 RS = Union(CFList(i.getItem()),RS); 72 73 72 QS = RS; 73 } 74 74 } 75 75 DEBOUTLN(cout, "BasicSet: returning bs= ", BS); … … 85 85 for (CFListIterator j=FS2; j.hasItem(); j++){ 86 86 if (elem == j.getItem()){ 87 //FS2= Difference(FS2,CFList(elem));88 87 // FS2= Difference(FS2,CFList(elem)); 88 return 0; 89 89 } 90 90 } … … 130 130 //PremForm Newremember=Remembern; 131 131 for ( CFListIterator i = D; i.hasItem(); ++i ) { 132 133 134 135 DEBOUTLN(cout,") = ", r); 132 CanonicalForm r = Prem( i.getItem(), CS ); 133 DEBOUT(cout,"MCharSetN: Prem(", i.getItem() ); 134 DEBOUT(cout, ",", CS); 135 DEBOUTLN(cout,") = ", r); 136 136 //cout << "MCharSetN: Prem("<< i.getItem() << "," << CS << ") = " << r << endl; 137 138 139 140 141 //Newremember = Oldremember; 142 143 137 if ( r != 0 ){ 138 //removefactor( r, Newremember ); 139 removefactor( r, Remembern ); 140 //Remembern.FS2 = Union(Remembern.FS2, Newremember.FS2); 141 //Newremember = Oldremember; 142 //if ( cls(r) > 0 ) 143 //RS=Union(CFList(r),RS);//RS.append( r ); 144 144 RS=Union(RS,CFList(r)); 145 145 } 146 146 } 147 147 if ( ! checkok(RS,Remembern.FS2)) return CFList(CanonicalForm(1)); … … 179 179 while ( ! RS.isEmpty() ) { 180 180 CS = BasicSet( QS ); 181 DEBOUTLN(cout, "CharSet: CS= ", CS); 181 182 RS = CFList(); 182 183 if ( rank( CS.getFirst() ) != 0 ) { 183 184 CFList D = Difference( QS, CS ); 184 185 for ( CFListIterator i = D; i.hasItem(); ++i ) { 185 186 186 CanonicalForm r = Prem( i.getItem(), CS ); 187 if ( r != 0 ) RS=Union(CFList(r),RS);//RS.append( r ); 187 188 } 188 189 QS = Union( QS, RS ); … … 202 203 CFList D = Difference( QS, CS ); 203 204 for ( CFListIterator i = D; i.hasItem(); ++i ) { 204 205 205 CanonicalForm r = Prem( i.getItem(), CS ); 206 if ( r != 0 ) RS=Union(CFList(r),RS);//RS.append( r ); 206 207 } 207 208 QS = Union(CS,Union( QS, RS )); … … 235 236 if ( ! member(iitem, mem)) 236 237 for ( ListCFListIterator j=i; j.hasItem(); j++){ 237 jitem=j.getItem(); 238 239 240 if ( contractsub(iitem, jitem) ){ 241 242 243 244 245 246 238 jitem=j.getItem(); 239 if ( ! same( iitem, jitem ) ) 240 if ( ! member(jitem, mem)) 241 if ( contractsub(iitem, jitem) ){ 242 ts.append(jitem); mem.append(jitem); 243 } 244 else 245 if ( contractsub(jitem, iitem) ){ 246 ts.append(iitem); 247 } 247 248 } 248 249 } … … 250 251 } 251 252 252 static ListCFList 253 static ListCFList 253 254 adjoin(const CFList & is, const CFList & qs, const ListCFList & qh ){ 254 255 ListCFList iss,qhi; … … 261 262 for ( i=is ; i.hasItem(); i++ ){ 262 263 elem=i.getItem(); 263 if ( cls(elem) > 0 ) iscopy=Union(CFList(elem),iscopy); 264 if ( cls(elem) > 0 ) iscopy=Union(CFList(elem),iscopy); 264 265 } 265 266 if ( iscopy.isEmpty() ) return iss; … … 271 272 if ( length > 0 ) 272 273 for ( j=qhi; j.hasItem(); j++ ) 273 if ( subset(j.getItem(),itt )) ind=1; 274 if ( subset(j.getItem(),itt )) ind=1; 274 275 if ( ind == 0 ) iss.append(itt); 275 276 } … … 277 278 } 278 279 279 static ListCFList 280 static ListCFList 280 281 adjoinb(const CFList & is, const CFList & qs, const ListCFList & qh ,const CFList & cs){ 281 282 ListCFList iss,qhi; … … 288 289 for ( i=is ; i.hasItem(); i++ ){ 289 290 elem=i.getItem(); 290 if ( cls(elem) > 0 ) iscopy=Union(CFList(elem),iscopy); 291 if ( cls(elem) > 0 ) iscopy=Union(CFList(elem),iscopy); 291 292 } 292 293 if ( iscopy.isEmpty() ) return iss; … … 298 299 if ( length > 0 ) 299 300 for ( j=qhi; j.hasItem(); j++ ) 300 if ( subset(j.getItem(),itt )) ind=1; 301 if ( subset(j.getItem(),itt )) ind=1; 301 302 if ( ind == 0 ) {iss.append(itt);} 302 303 } … … 313 314 for ( ListCFListIterator i=copy ; i.hasItem(); i++ ){ 314 315 elem = i.getItem(); 315 if ( elem.length() > l.length() ) { 316 if ( elem.length() > l.length() ) { 316 317 output = MyUnion( ListCFList(l), output); 317 318 l= elem; … … 325 326 326 327 #ifdef EXPERIMENTAL 327 static CFList 328 static CFList 328 329 getItemNr( int nr, const ListCFList & copy){ 329 330 int i =1; … … 349 350 ListCFList output; 350 351 351 cout << "Sort: list to sort is: " << list_to_sort << endl; 352 cout << "Sort: list to sort is: " << list_to_sort << endl; 352 353 for (int i=1; i<= number; i++){ 353 354 cout << " Next elem = "; cin >> nr; … … 370 371 CFList qs,cs,factorset,is,ts; 371 372 ListCFList pi,ppi,qqi,qsi,iss,qhi= ListCFList(PS); 372 int nr_of_iteration=0,ts2,highestlevel=0; 373 int nr_of_iteration=0,ts2,highestlevel=0; 373 374 #ifdef EXPERIMENTAL 374 375 int choice=1;; … … 426 427 // next is preliminary: should be ==0 427 428 if ( ts2 <= 0 ){ //irreducible 428 if ( ! subset(cs,qs) ){ 429 430 431 432 433 if ( ! member(cs,pi) ){ 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 else{ 467 468 469 470 471 472 429 if ( ! subset(cs,qs) ){ 430 DEBOUTMSG(cout, "cs is not a subset of qs"); 431 cs = charseta(Union(qs,cs)); 432 DEBOUTLN(cout, "new cs is: ", cs); 433 } 434 if ( ! member(cs,pi) ){ 435 pi = MyUnion(pi, ListCFList(cs)); 436 DEBOUTMSG(cout, "cs is not a member of pi"); 437 DEBOUTLN(cout, "pi is: ", pi); 438 if ( cls(cs.getFirst()) > 0 ){ 439 ts = irras(cs,ts2,reducible); 440 441 // INTERRUPTHANDLER 442 if ( interrupt_handle() ) return ListCFList() ; 443 // INTERRUPTHANDLER 444 445 DEBOUTLN(cout, "ts is: ", ts); 446 DEBOUTLN(cout, "ts2 is: ", ts2); 447 // next is preliminary: should be ==0 448 if ( ts2 <= 0 ){ //irreducible 449 qsi = MyUnion(qsi,ListCFList(cs)); 450 DEBOUTLN(cout, "qsi is: ", qsi); 451 if ( cs.length() == highestlevel ){ 452 DEBOUTLN(cout, "cs.length() == nops(ord) :", cs.length()); 453 is = factorps(factorset); 454 } 455 else{ 456 DEBOUT(cout,"cs.length() != nops(ord) :", cs.length()); 457 DEBOUTLN(cout, " nops(ord)= ", highestlevel); 458 is = Union(initalset1(cs),factorps(factorset)); 459 } 460 DEBOUTLN(cout, "is is: ", is); 461 iss = adjoin(is,qs,qqi); 462 DEBOUTLN(cout, "iss is: ", iss); 463 } 464 } 465 else{ iss = adjoin(factorps(factorset),qs,qqi); } 466 } 467 else{ 468 DEBOUTMSG(cout, "cs is a member of pi"); 469 iss = adjoin(factorps(factorset),qs,qqi); } 470 DEBOUTLN(cout, "iss is: ", iss); 471 DEBOUTLN(cout, " factorps(factorset)= ", factorps(factorset)); 472 DEBOUTLN(cout, " qs= ", qs); 473 DEBOUTLN(cout, " qqi= ", qqi); 473 474 } 474 475 // next is preliminary: should be !=0 475 476 if ( ts2 > 0 ){ 476 477 478 if ( ts2 > 1 ){ 479 480 481 482 483 484 485 486 487 488 489 490 } 491 } 492 else{ 493 iss = adjoin(factorps(factorset),qs,qqi); 477 is = factorps(factorset); 478 DEBOUTLN(cout, "is is: ", is); 479 if ( ts2 > 1 ){ 480 // setup cst: need it later for adjoinb 481 CFList cst; 482 for ( CFListIterator i=cs ; i.hasItem(); i++){ 483 if ( i.getItem() == reducible ) { break; } 484 else { cst.append(i.getItem()); } 485 } 486 is = Union(initalset1(cst), is); 487 iss = MyUnion(adjoin(is,qs,qqi), adjoinb(ts,qs,qqi,cst)); 488 } 489 else{ iss = adjoin(Union(is,ts),qs,qqi); } 490 DEBOUTLN(cout, "iss is: ", iss); 491 } 492 } 493 else{ 494 iss = adjoin(factorps(factorset),qs,qqi); 494 495 DEBOUTMSG(cout, "case: cs is a constant."); 495 496 DEBOUTLN(cout, " qs = ", qs); … … 501 502 DEBOUTLN(cout, "iss is: ", iss); 502 503 } 503 if ( ! qsi.isEmpty() ){ 504 if ( ! qsi.isEmpty() ){ 504 505 DEBOUTLN(cout, "qsi before contract= ", qsi); 505 506 if ( opt == 0 ){ 506 return contract( qsi ); 507 return contract( qsi ); 507 508 } 508 509 else { return qsi; } 509 510 } 510 511 else{ return ListCFList() ; } 511 } 512 } 512 513 513 514 // tests for characteristic sets … … 548 549 if ( (qs.length() >= 2 ) || (qs.getFirst().exp() > 1)){ 549 550 DEBOUTLN(cout, "irras: Setting ind=0, ja= ", nr); 550 ja=nr; ind=0; reducible= elem; 551 ja=nr; ind=0; reducible= elem; 551 552 break; 552 553 } … … 556 557 if ( (ind == 1) ){ //&& ( as.length() > 1) ){ 557 558 if ( irreducible(AS) ){ // as quasilinear? => irreducible! 558 ja = 0; 559 ja = 0; 559 560 DEBOUTLN(cout, "as is irreducible. as= ", AS); 560 561 } … … 562 563 i=AS; 563 564 for ( nr=1; nr< AS.length(); nr++){ 564 565 566 567 568 // 565 as.append(i.getItem()); 566 i++; 567 if ( degree(i.getItem()) > 1 ){// search for a non linear elem 568 elem=i.getItem(); 569 // cout << "f= " << elem << endl; 569 570 // cout << "as= " << as << endl; 570 571 // 572 // 573 // 574 575 576 577 578 579 580 571 qs= newfactoras(elem,as,success); 572 // cout << "irras:newfactoras qs= " << qs << endl; 573 // qs= factoras(elem,as,success); 574 // cout << "irras:factoras qs= " << qs << endl; 575 if ( qs.length() > 1 || qs.getFirst().exp() > 1 ){ //found elem is reducible 576 reducible=elem; 577 ja=nr+1; 578 break; 579 } 580 else 581 { 581 582 #ifdef SINGULAR 582 //WarnS("libfac: Factoring over algebraic function field required!");583 #else 583 WarnS("libfac: Factoring over algebraic function field required!"); 584 #else 584 585 #ifndef NOSTREAMIO 585 586 cerr << "libfac: Factoring over algebraic function field!" << endl; 586 587 #endif 587 588 #endif 588 589 589 } 590 } 590 591 } 591 592 } … … 598 599 /* 599 600 $Log: not supported by cvs2svn $ 601 Revision 1.6 2000/03/08 12:54:35 obachman 602 * comment out warning "libfac: Factoring over algebraic function 603 field required!" 604 600 605 Revision 1.5 2000/03/08 12:45:41 obachman 601 606 * fixed Singular includes -
libfac/factor/Truefactor.cc
rc7bbf3 r405ebc 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 //static char * rcsid = "@(#) $Id: Truefactor.cc,v 1. 5 2001-06-21 14:57:06 Singular Exp $";4 //static char * rcsid = "@(#) $Id: Truefactor.cc,v 1.6 2001-06-27 13:58:06 Singular Exp $"; 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 // Factory - Includes … … 41 41 if (hasAlgVar(i.coeff(),v)) return 1; 42 42 } 43 } 43 } 44 return 0; 45 } 46 47 int hasVar(const CanonicalForm &f, const Variable &v) 48 { 49 if (f.inBaseDomain()) return 0; 50 if (f.inCoeffDomain()) 51 { 52 if (f.mvar()==v) return 1; 53 return hasAlgVar(f.LC(),v); 54 } 55 if (f.inPolyDomain()) 56 { 57 if (f.mvar()==v) return 1; 58 if (hasVar(f.LC(),v)) return 1; 59 for( CFIterator i=f; i.hasTerms(); i++) 60 { 61 if (hasVar(i.coeff(),v)) return 1; 62 } 63 } 44 64 return 0; 45 65 } … … 50 70 if (f.inCoeffDomain()) 51 71 { 52 if (f.level()!=0) 72 if (f.level()!=0) 53 73 { 54 74 //cout << "hasAlgVar:" << f.mvar() <<endl; 55 75 return 1; 56 } 76 } 57 77 return hasAlgVar(f.LC()); 58 78 } … … 64 84 if (hasAlgVar(i.coeff())) return 1; 65 85 } 66 } 86 } 67 87 return 0; 68 88 } … … 72 92 // elements and return them in returnlist. // 73 93 /////////////////////////////////////////////////////////////// 74 static void 94 static void 75 95 combinat( int k, int n, List<IntList> & returnlist ){ 76 96 ListIntList ListofLists; … … 88 108 value = intermediate.getLast(); 89 109 if ( value != n ) 90 91 92 93 110 for ( j=value+1; j<=n; j++ ){ 111 intermediate2 = intermediate; intermediate2.append(j); 112 ListofLists.append( intermediate2 ); 113 } 94 114 } 95 115 returnlist = ListofLists; … … 100 120 // Return the CanonicalForm number nr in Factorlist. // 101 121 /////////////////////////////////////////////////////////////// 102 static CanonicalForm 122 static CanonicalForm 103 123 getItemNr(int nr, const CFFList & Factorlist ){ 104 124 ListIterator<CFFactor> i=Factorlist; … … 112 132 // Generate all sets of m factors out of LiftedFactors list. // 113 133 /////////////////////////////////////////////////////////////// 114 static CFFList 134 static CFFList 115 135 combine( int m, const CFFList & LiftedFactors ){ 116 136 CFFList result; … … 123 143 for ( IntListIterator k=j.getItem(); k.hasItem(); k++ ) 124 144 intermediate *= getItemNr(k.getItem(), LiftedFactors); 125 if (!hasAlgVar(intermediate)) 145 if (!hasAlgVar(intermediate)) 126 146 result.append(CFFactor(intermediate,1)); 127 147 } … … 132 152 // Remove element elem from the list L. // 133 153 /////////////////////////////////////////////////////////////// 134 static CFFList 154 static CFFList 135 155 Remove_from_List( const CFFList & L, const CanonicalForm & elem ){ 136 156 CFFList Returnlist; … … 139 159 DEBOUTLN(cout, " and elem= ",elem); 140 160 for ( ListIterator<CFFactor> i = L ; i.hasItem(); i++) 141 if ( i.getItem().factor() != elem ) 161 if ( i.getItem().factor() != elem ) 142 162 Returnlist.append( i.getItem() ); 143 163 … … 148 168 // Here we solve: G= F mod ( P, S^h ) // 149 169 /////////////////////////////////////////////////////////////// 150 static CanonicalForm 170 static CanonicalForm 151 171 Multmod_power( const CanonicalForm & F, const SFormList & Substituionlist, int h, int levelF){ 152 172 CanonicalForm G; … … 164 184 // degree in the main variable levelU exceeeds degU. // 165 185 /////////////////////////////////////////////////////////////// 166 static CFFList 186 static CFFList 167 187 Rightdegree( const CFFList & CombL, int degU, int levelU ){ 168 188 CFFList Returnlist; … … 186 206 // Math. Comp. V29 Nr131 (July 1975) p. 935-950 // 187 207 /////////////////////////////////////////////////////////////// 188 CFFList 208 CFFList 189 209 Truefactors( const CanonicalForm Ua, int levelU, const SFormList & SubstitutionList, const CFFList & PiList){ 190 210 CanonicalForm U=Ua,a,b,Y; … … 233 253 DEBOUTLN(cout," r = ", r); 234 254 DEBOUTLN(cout," degU= ", degU); 235 255 236 256 // Now do the real work! 237 // Test all the combinations of possible factors. 257 // Test all the combinations of possible factors. 238 258 239 259 onemore=1; … … 265 285 // if ( c && b == U.genZero()) { // Y divides U 266 286 if ( c && b.isZero() ){ 267 268 269 270 271 272 273 274 // Hier ist noch etwas faul; wir muessen (f=prod(f_i)) die f_i 275 276 277 278 279 287 DEBOUT(cout,"Truefactors: (step6): ",Y ); 288 DEBOUTLN(cout, " divides ",U); 289 U = a; 290 FAC.append(Y); // Y is a real factor 291 onemore = 0; 292 degU = degree(U, levelU)/2; // new degU 293 // L = L \ {factor} 294 // Hier ist noch etwas faul; wir muessen (f=prod(f_i)) die f_i 295 // entfernen und nicht f! 296 L = Remove_from_List( L, factor.factor() ); 297 r -= 1; 298 // delete from L any element with degree greater than degU 299 L = Rightdegree( L, degU, levelU ); 280 300 } 281 301 } … … 288 308 // Check if poly f is in Fp (returns true) or in Fp(a) // 289 309 /////////////////////////////////////////////////////////////// 290 static bool 310 static bool 291 311 is_in_Fp( const CanonicalForm & f ){ 292 312 if ( f.inCoeffDomain() ) … … 335 355 WerrorS("libfac: ERROR: TakeNorms less then two items remaining!"); 336 356 #else 337 cerr << "libfac: ERROR: TakeNorms less then two items remaining! " 338 357 cerr << "libfac: ERROR: TakeNorms less then two items remaining! " 358 << endl; 339 359 #endif 340 360 } … … 343 363 combinat(n, PossibleFactors.length(), CombinatList); 344 364 for ( j=CombinatList ; j.hasItem(); j++ ){ 345 346 347 348 if ( is_in_Fp( intermediate ) ){ 349 350 351 for ( k=j.getItem(); k.hasItem(); k++ ) 352 353 354 355 356 357 358 else { 359 //cout << "Schade!" << endl; 360 361 362 365 intermediate=1; 366 for ( k=j.getItem(); k.hasItem(); k++ ) 367 intermediate *= getItemNr( k.getItem(), PossibleFactors ); 368 if ( is_in_Fp( intermediate ) ){ 369 TrueFactors.append(intermediate); // found a true factor 370 CopyPossibleFactors=PossibleFactors; // save list 371 for ( k=j.getItem(); k.hasItem(); k++ ) 372 //remove combined factors from PossibleFactors 373 PossibleFactors=Remove_from_List(PossibleFactors, 374 getItemNr( k.getItem(), CopyPossibleFactors )); 375 n-=1; // look for the same number of combined factors: 376 break; 377 } 378 else { 379 //cout << "Schade!" << endl; 380 } 381 DEBOUT(cout, "Truefactor: Combined ", n); 382 DEBOUTLN(cout, " factors to: ", intermediate); 363 383 } 364 384 n += 1; 365 385 } 366 // All remaining factors in PossibleFactors multiplied 386 // All remaining factors in PossibleFactors multiplied 367 387 // should lie in Fp domain 368 388 if ( PossibleFactors.length() >=1 ){ 369 389 for ( i=PossibleFactors; i.hasItem(); i++ ) 370 390 intermediate *= i.getItem().factor(); 371 391 // a last check: 372 392 if ( is_in_Fp(intermediate) ){ 373 393 TrueFactors.append(CFFactor(intermediate,1)); 374 394 } 375 else{ 395 else{ 376 396 #ifdef HAVE_SINGULAR 377 397 WerrorS("libfac: TakeNorms: somethings wrong with remaining factors!"); 378 398 #else 379 cerr << "libfac: TakeNorms: somethings wrong with remaining factors!" 380 399 cerr << "libfac: TakeNorms: somethings wrong with remaining factors!" 400 << endl; 381 401 #endif 382 402 } … … 389 409 /* 390 410 $Log: not supported by cvs2svn $ 411 Revision 1.5 2001/06/21 14:57:06 Singular 412 *hannes/GP: Factorize, newfactoras, ... 413 391 414 Revision 1.4 1997/11/18 16:39:07 Singular 392 415 * hannes: moved WerrorS from C++ to C
Note: See TracChangeset
for help on using the changeset viewer.