Changeset 4a81ec in git for libfac/charset/charset.cc
- Timestamp:
- Sep 12, 1997, 9:20:02 AM (27 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 0fbdd16f374f7f4570da62a453e2328e4d8a4b4c
- Parents:
- 0479e09dbc0fb17be7ebce384df4ba0318ba20eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfac/charset/charset.cc
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 static char * rcsid = "$Id: charset.cc,v 1. 2 1997-06-09 15:55:53Singular Exp $";4 static char * rcsid = "$Id: charset.cc,v 1.3 1997-09-12 07:19:40 Singular Exp $"; 5 5 ///////////////////////////////////////////////////////////// 6 6 // FACTORY - Includes … … 12 12 // Charset - Includes 13 13 #include "csutil.h" 14 #include "algfactor.h" 15 #include "alg_factor.h" 16 // Some CC's need this: 17 #include "charset.h" 14 18 15 19 #ifdef BASICSETDEBUG … … 47 51 b = lowestRank( QS ); 48 52 cb = rank( b ); 53 DEBOUTLN(cout, "BasicSet: choose b = ", b); 54 DEBOUTLN(cout, "BasicSet: it's rank = ", cb); 49 55 BS=Union(CFList(b),BS);//BS.append( b ); 50 56 if ( rank( b ) == 0 ) … … 65 71 } 66 72 67 68 69 70 71 72 73 74 73 int 74 checkok( const CFList & PS, CFList & FS2){ 75 CanonicalForm elem; 76 77 for ( CFListIterator i=PS; i.hasItem(); i++){ 78 elem= i.getItem(); 79 for (CFListIterator j=FS2; j.hasItem(); j++){ 80 if (elem == j.getItem()){ 75 81 // FS2= Difference(FS2,CFList(elem)); 76 82 return 0; 77 78 79 80 81 83 } 84 } 85 } 86 return 1; 87 } 82 88 83 89 #ifdef MCHARSETNDEBUG … … 147 153 } 148 154 155 156 CFList 157 mcharset( const CFList &PS, PremForm & Remembern ){ 158 CFList cs= MCharSetN(PS, Remembern ); 159 CFList rs= remsetb(Difference(PS,cs),cs); 160 161 DEBOUTLN(cout, "mcharset: cs= ", cs); 162 DEBOUTLN(cout, "mcharset: rs= ", rs); 163 if ( rs.length() > 0 ) 164 cs= mcharset(Union(PS,Union(cs,rs)), Remembern); 165 return cs; 166 } 167 149 168 // the "original" extended characteristic set 150 169 CFList … … 311 330 } 312 331 332 static int 333 choosefrom(){ 334 int choice; 335 cout << "choose from qhi! ->"; 336 cin >> choice; 337 return choice; 338 } 339 313 340 static ListCFList 314 341 msort( const ListCFList & list_to_sort ){ … … 333 360 334 361 ListCFList 335 IrrCharSeries( const CFList &PS ){362 IrrCharSeries( const CFList &PS, int opt ){ 336 363 CanonicalForm reducible,reducible2; 337 364 CFList qs,cs,factorset,is,ts; 338 365 ListCFList pi,ppi,qqi,qsi,iss,qhi= ListCFList(PS); 339 int nr_of_iteration=0,ts2,highestlevel=0; 366 int nr_of_iteration=0,ts2,highestlevel=0; 367 #ifdef EXPERIMENTAL 368 int choice=1;; 369 #endif 340 370 341 371 DEBOUTMSG(cout, rcsid); 372 // cout << getCharacteristic() << endl; 342 373 for ( CFListIterator Ps=PS; Ps.hasItem(); Ps++ ) 343 374 if ( level(Ps.getItem() ) > highestlevel ) highestlevel = level(Ps.getItem()) ; 344 375 // for ( int xx=1; xx <= highestlevel; xx++) 376 // cout << Variable(xx) ; 377 // cout << endl; 378 // for ( CFListIterator Ps=PS; Ps.hasItem(); Ps++ ) 379 // cout << Ps.getItem() << ", " ;//<< endl; 380 // cout << endl; 345 381 while ( ! qhi.isEmpty() ) { 346 382 qhi=sort(qhi); 347 383 DEBOUTLN(cout, "qhi is: ", qhi); 384 #ifdef EXPERIMENTAL 385 choice=choosefrom(); 386 cout <<"/n Choose " << choice << endl; 387 qs= getItemNr(choice, qhi); 388 #else 348 389 qs=qhi.getFirst(); 390 #endif 349 391 DEBOUTLN(cout, "qs is: ", qs); 350 392 DEBOUTLN(cout, "ppi is: ", ppi); … … 454 496 } 455 497 if ( ! qsi.isEmpty() ){ 456 return contract( qsi ); 498 DEBOUTLN(cout, "qsi before contract= ", qsi); 499 if ( opt == 0 ){ 500 return contract( qsi ); 501 } 502 else { return qsi; } 457 503 } 458 504 else{ return ListCFList() ; } … … 474 520 CFList ts,as; 475 521 CanonicalForm elem; 476 int ind=1,nr=0; 522 int ind=1,nr=0, success=-1; 523 CFListIterator i; 477 524 478 525 ja = 0; 479 526 DEBOUTLN(cout, "irras: called with: AS= ", AS); 480 for ( CFListIteratori=AS; i.hasItem(); i++ ){527 for ( i=AS; i.hasItem(); i++ ){ 481 528 elem = i.getItem(); 482 529 nr += 1; 483 530 DEBOUT(cout, "irras: factoring: ", elem); 484 qs = Factorize(elem); 485 531 if ( degree(elem) > 1 ) // linear poly's are irreduzible 532 qs = Factorize(elem); 533 else{ 534 qs=(CFFactor(elem,1)); 535 qs.insert(CFFactor(CanonicalForm(1),1)); 536 } 537 DEBOUTLN(cout, " = ", qs); 486 538 // INTERRUPTHANDLER 487 539 if ( interrupt_handle() ) return CFList() ; 488 540 // INTERRUPTHANDLER 489 490 541 qs.removeFirst(); 491 DEBOUTLN(cout, " = ", qs);492 // if ( num(qs.getFirst().factor() / LC(qs.getFirst().factor())) !=493 // num(elem / LC(elem))){494 542 if ( (qs.length() >= 2 ) || (qs.getFirst().exp() > 1)){ 495 543 DEBOUTLN(cout, "irras: Setting ind=0, ja= ", nr); 496 544 ja=nr; ind=0; reducible= elem; 497 // return(qs); // ist das nicht genauso gut?498 545 break; 499 546 } 500 else{ as.append(elem) ; } 501 } 502 AS=as; // warum das? 503 if ( (ind == 1) && ( AS.length() > 1) ){ 504 if ( irreducible(AS) ) ja = 0; 547 // else{ as.append(elem) ; } 548 } 549 // cout << "ind= " << ind << endl; 550 if ( (ind == 1) ){ //&& ( as.length() > 1) ){ 551 if ( irreducible(AS) ){ // as quasilinear? => irreducible! 552 ja = 0; 553 DEBOUTLN(cout, "as is irreducible. as= ", AS); 554 } 505 555 else { 506 #ifdef HAVE_SINGULAR 507 extern void WerrorS(char *); 508 WerrorS("libfac: Factorization over algebraic function field required!"); 509 #else 510 cerr << "Factorization over algebraic function field required!" << endl; 511 #endif 512 ja = -1; 556 //#ifdef HAVE_SINGULAR 557 // extern void WerrorS(char *); 558 // WerrorS("libfac: Factoring over algebraic function field!"); 559 //#else 560 // cerr << "libfac: Factoring over algebraic function field!" << endl; 561 //#endif 562 i=AS; 563 for ( nr=1; nr< AS.length(); nr++){ 564 as.append(i.getItem()); 565 i++; 566 if ( degree(i.getItem()) > 1 ){// search for a non linear elem 567 elem=i.getItem(); 568 // cout << "f= " << elem << endl; 569 // cout << "as= " << as << endl; 570 qs= newfactoras(elem,as,success); 571 // cout << "irras:newfactoras qs= " << qs << endl; 572 // qs= factoras(elem,as,success); 573 // cout << "irras:factoras qs= " << qs << endl; 574 if ( qs.length() > 1 || qs.getFirst().exp() > 1 ){ //found elem is reducible 575 reducible=elem; 576 ja=nr+1; 577 break; 578 } 579 } 580 } 513 581 } 514 582 }
Note: See TracChangeset
for help on using the changeset viewer.