Changeset 4a81ec in git
- Timestamp:
- Sep 12, 1997, 9:20:02 AM (26 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 0fbdd16f374f7f4570da62a453e2328e4d8a4b4c
- Parents:
- 0479e09dbc0fb17be7ebce384df4ba0318ba20eb
- Location:
- libfac
- Files:
-
- 4 deleted
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
libfac/00README
r0479e09 r4a81ec 1 This is the file 00README.libfac for version 0.2.4of libfac.1 This is the file 00README.libfac for version prae 0.3.0 of libfac. 2 2 3 3 ######### What is libfac? … … 95 95 any templates for libsingfac.a. 96 96 97 B) Using Makefile.dist (this is not recommended; maybe you have to edit a lot 98 to reflect your systems configuration.) 99 copy Makefile.dist to Makefile 100 Edit the factoryversion and the path to the factory library in the top Makefile 101 (in this directory). 102 currently: factoryversion=1.2b 103 (I have tested with factoryversion 1.1 & 1.2beta & 1.2c; earlier versions 104 *don't* work) 105 106 type: 107 make 108 to generate a testprogram (test). You'll get a non-interactive debugging 109 version of test, which is half as fast as an optimized version. 110 You get an optimized version of test by typing: 111 make opttest 112 113 If you type 114 make tests 115 116 a program (test) will be generated and a bunch of test-examples will 117 be tested. 118 119 If you only need the library ( it will be produced anyway) just type 120 make libfac 121 for the optimized version (libfac.a) or 122 make libfac-g 123 for the debugging version (libfac-g.a). 124 125 The include file for the libraries is called "factor.h" and is shipped 126 with this version. 127 If you have perl you can generate "factor.h" with: 128 ./bin/makeheader header.tpl factor.h 129 in the top directory (Perhaps you have to edit the path to perl in 130 ./bin/makeheader). 97 If you want to produce a test file, type: 98 configure [--with-debug] [--libdir=path-to-libcf.a] [--includedir=path-to-factory.h] 99 make tests 100 this will produce libfac.a and a binary called test. "test" is then used to 101 test some examples for factorization. 102 103 B) Using Makefile.dist 104 **** Since version 0.3.0 this is no longer supported **** 105 **** Get an earlier version and patch Makefile.dist for your needs, **** 106 **** or, better, use configure. 131 107 132 108 … … 161 137 is not yet implemented (but I'm working on it). 162 138 Don't trust the result you'll get in such a case!!!!!! 139 Since version 0.3.0 this problem is gone. (or should be :-) ) 163 140 164 141 o The performance of the irreducible characteristic series stuff heavily … … 260 237 o released May 30 1997 261 238 239 V0.3.0a o changed configure.in: will not override CFLAGS or CXXFLAGS if set in 240 the environment 241 o added new functionality in charset/algfacor.{cc/h} : 242 now we should be able to factorize over any field needed for the 243 charset-algorithm. (Internal note: perhaps there are still problems 244 for the char=0 case because of the factory implementation vs. gmp) 245 o for this, changed charset/csutil.{cc/h} and charset/charset.{cc/h} 246 o include #include <file.h> in file.cc for some CC's 247 o Internal note: need more interrupt handles enabled; 248 set up test examples for char=0 and char>0; 249 o released Jun 25 1997 250 251 V0.3.0b o implemented Tragers algorithm; this is now the default used in 252 charsets (file: charsets/alg_factor.cc) 253 o for char=0 case there are some problems with factory; 254 for char=p there seems to be an internal factory memory-problem in 255 some cases 256 o released Sep 11 1997 -
libfac/Makefile.in
r0479e09 r4a81ec 1 # $Id: Makefile.in,v 1. 7 1997-06-09 15:55:47Singular Exp $1 # $Id: Makefile.in,v 1.8 1997-09-12 07:19:31 Singular Exp $ 2 2 ################################################# 3 3 SHELL = /bin/sh … … 63 63 factor/debug.h factor/timing.h factor/homogfactor.h \ 64 64 factor/interrupt.h 65 CHARSETINCL = charset/csutil.h charset/charset.h charset/reorder.h 65 CHARSETINCL = charset/csutil.h charset/charset.h charset/reorder.h \ 66 charset/alg_factor.h charset/algfactor.h 66 67 67 68 OPTFACTOROBJ1 = OPTOBJ/SqrFree.o OPTOBJ/Factor.o OPTOBJ/MVMultiHensel.o \ 68 69 OPTOBJ/Truefactor.o OPTOBJ/helpstuff.o OPTOBJ/version.o \ 69 OPTOBJ/homogfactor.o 70 OPTOBJ/homogfactor.o OPTOBJ/debug.o 70 71 OPTFACTOROBJ2 = OPTOBJ/tmpl_inst.o 71 72 OPTFACTOROBJ = $(OPTFACTOROBJ2) $(OPTFACTOROBJ1) 72 73 73 OPTCHARSETOBJ = OPTOBJ/csutil.o OPTOBJ/charset.o OPTOBJ/reorder.o 74 OPTCHARSETOBJ = OPTOBJ/csutil.o OPTOBJ/charset.o OPTOBJ/reorder.o \ 75 OPTOBJ/alg_factor.o OPTOBJ/algfactor.o 74 76 75 77 DEBFACTOROBJ1 = DEBOBJ/SqrFree.o DEBOBJ/Factor.o DEBOBJ/MVMultiHensel.o \ 76 78 DEBOBJ/Truefactor.o DEBOBJ/helpstuff.o DEBOBJ/version.o \ 77 DEBOBJ/homogfactor.o 79 DEBOBJ/homogfactor.o DEBOBJ/debug.o 78 80 DEBFACTOROBJ2 = DEBOBJ/tmpl_inst.o 79 81 DEBFACTOROBJ = $(DEBFACTOROBJ2) $(DEBFACTOROBJ1) 80 82 81 DEBCHARSETOBJ = DEBOBJ/csutil.o DEBOBJ/charset.o DEBOBJ/reorder.o 83 DEBCHARSETOBJ = DEBOBJ/csutil.o DEBOBJ/charset.o DEBOBJ/reorder.o \ 84 DEBOBJ/alg_factor.o DEBOBJ/algfactor.o 82 85 83 86 ## … … 87 90 .SUFFIXES: .cc .h .o 88 91 89 all: ${TARGETNAME} 92 all: OPTOBJ DEBOBJ ${TARGETNAME} 93 94 OPTOBJ: 95 ${MKINSTALLDIRS} OPTOBJ 96 97 DEBOBJ: 98 ${MKINSTALLDIRS} DEBOBJ 90 99 91 100 OPTOBJ/%.o: %.cc … … 151 160 152 161 mostlyclean: 153 $(RM) test ${LIBFACNAME}.a ${SINGLIBFACNAME}.a \162 $(RM) test testcs ${LIBFACNAME}.a ${SINGLIBFACNAME}.a \ 154 163 ${LIBFACNAME-G}.a ${SINGLIBFACNAME-G}.a 155 164 156 165 clean: mostlyclean 157 $(RM) charset/DEBOBJ/* OPTOBJ/*158 166 $(RM) OPTOBJ/optdepend DEBOBJ/debdepend \ 159 167 DEBOBJ/*.o OPTOBJ/*.o … … 175 183 (cd tests ; factortest ) 176 184 185 charsettest: libfac OPTOBJ/testcs.o 186 $(CXX) -o testcs $(LDFLAGS) OPTOBJ/testcs.o $(LIBS) 187 188 #charsettests: charsettest 189 # (cd tests ; charsettest ) 190 177 191 tests: factests 178 192 -
libfac/charset/alg_factor.cc
r0479e09 r4a81ec 3 3 // emacs edit mode for this file is -*- C++ -*- 4 4 //////////////////////////////////////////////////////////// 5 static char * rcsid = "$Id: alg_factor.cc,v 1. 1.1.1 1997-09-11 10:58:22Singular Exp $";5 static char * rcsid = "$Id: alg_factor.cc,v 1.2 1997-09-12 07:19:37 Singular Exp $"; 6 6 //////////////////////////////////////////////////////////// 7 7 // FACTORY - Includes … … 155 155 temp= gcd(R, R.deriv(vf)); 156 156 DEBOUTLN(cout, "sqrf_norm_sub: temp= ", temp); 157 if (degree(temp ) != 0 || temp == temp.genZero() ){ sqfreetest= 0; }157 if (degree(temp,vf) != 0 || temp == temp.genZero() ){ sqfreetest= 0; } 158 158 else { sqfreetest= 1; } 159 159 DEBOUTLN(cout, "sqrf_norm_sub: sqfreetest= ", sqfreetest); … … 336 336 DEBOUTLN(cout, "alg_factor: R= ", R); 337 337 Off(SW_RATIONAL); 338 Factorlist = Factorize(R ,1);338 Factorlist = Factorize(R); 339 339 On(SW_RATIONAL); 340 340 DEBOUTLN(cout, "alg_factor: Factorize(R)= ", Factorlist); … … 410 410 if ( x != 0 ){ 411 411 divrem(ii.getItem(), gg, q,r); 412 cout << ii.getItem() << " divided by " << gg << endl;412 // cout << ii.getItem() << " divided by " << gg << endl; 413 413 DEBOUTLN(cout, "q= ", q); DEBOUTLN(cout, "r= ", r); 414 414 ii.append(ii.getItem()+q*g); ii.remove(1); … … 614 614 $Log: not supported by cvs2svn $ 615 615 */ 616 -
libfac/charset/alg_factor.h
r0479e09 r4a81ec 3 3 // emacs edit mode for this file is -*- C++ -*- 4 4 //////////////////////////////////////////////////////////// 5 // $Id: alg_factor.h,v 1. 1.1.1 1997-09-11 10:58:22Singular Exp $5 // $Id: alg_factor.h,v 1.2 1997-09-12 07:19:37 Singular Exp $ 6 6 //////////////////////////////////////////////////////////// 7 7 -
libfac/charset/algfactor.cc
r0479e09 r4a81ec 3 3 // emacs edit mode for this file is -*- C++ -*- 4 4 //////////////////////////////////////////////////////////// 5 static char * rcsid = "$Id: algfactor.cc,v 1. 1.1.1 1997-09-11 10:58:22Singular Exp $";5 static char * rcsid = "$Id: algfactor.cc,v 1.2 1997-09-12 07:19:38 Singular Exp $"; 6 6 //////////////////////////////////////////////////////////// 7 7 // FACTORY - Includes -
libfac/charset/algfactor.h
r0479e09 r4a81ec 3 3 // emacs edit mode for this file is -*- C++ -*- 4 4 //////////////////////////////////////////////////////////// 5 // $Id: algfactor.h,v 1. 1.1.1 1997-09-11 10:58:22Singular Exp $5 // $Id: algfactor.h,v 1.2 1997-09-12 07:19:39 Singular Exp $ 6 6 //////////////////////////////////////////////////////////// 7 7 -
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 } -
libfac/charset/charset.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: charset.h,v 1. 2 1997-06-09 15:55:53Singular Exp $4 // $Id: charset.h,v 1.3 1997-09-12 07:19:41 Singular Exp $ 5 5 //////////////////////////////////////////////////////////// 6 6 … … 13 13 CFList BasicSet( const CFList &PS ); 14 14 CFList CharSet( const CFList &PS ); 15 CFList mcharset( const CFList &PS, PremForm & Remembern ); 16 int checkok( const CFList & PS, CFList & FS2); 15 17 /*BEGINPUBLIC*/ 16 18 CFList MCharSetN( const CFList &PS, PremForm & Remembern ); 17 ListCFList IrrCharSeries( const CFList &PS );19 ListCFList IrrCharSeries( const CFList &PS, int opt=0 ); 18 20 /*ENDPUBLIC*/ 19 21 -
libfac/charset/csutil.cc
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 static char * rcsid = "$Id: csutil.cc,v 1. 2 1997-06-09 15:55:54Singular Exp $";4 static char * rcsid = "$Id: csutil.cc,v 1.3 1997-09-12 07:19:41 Singular Exp $"; 5 5 ///////////////////////////////////////////////////////////// 6 6 // FACTORY - Includes … … 10 10 #include <Factor.h> 11 11 #include <SqrFree.h> 12 #include <helpstuff.h> 13 #include <homogfactor.h> 12 14 // Charset - Includes 13 15 #include "csutil.h" 14 16 15 17 static bool 16 lowerRank ( const CanonicalForm & f, const CanonicalForm & g )18 lowerRank ( const CanonicalForm & f, const CanonicalForm & g, int & ind ) 17 19 { 18 20 int df, dg; 19 21 Variable vf = f.mvar(), vg = g.mvar(); 20 22 21 if ( f.inCoeffDomain() ) return true;//( vg > vf ); 22 else 23 if ( g.inCoeffDomain() ) return false; 24 else 25 if ( vf < vg ) return true; 26 else 27 if ( vf == vg ) { 28 df = degree( f ); dg = degree( g ); 29 if ( df < dg ) return true; 30 else 31 if ( df == dg ) return lowerRank( LC( f ), LC( g ) ); 32 else return false; 33 } 23 if ( f.inCoeffDomain() ) { 24 if ( g.inCoeffDomain() ) ind= 1; 25 return true;//( vg > vf ); 26 } 27 else if ( g.inCoeffDomain() ) return false; 28 else if ( vf < vg ) return true; 29 else if ( vf == vg ) { 30 df = degree( f ); dg = degree( g ); 31 if ( df < dg ) return true; 32 else if ( df == dg ) return lowerRank( LC( f ), LC( g ) , ind); 33 else return false; 34 } 34 35 return false; 35 36 } … … 40 41 CFListIterator i = F; 41 42 CanonicalForm f; 43 int ind=0; 42 44 if ( ! i.hasItem() ) return f; 43 45 f = i.getItem(); ++i; 44 46 while ( i.hasItem() ) { 45 if ( lowerRank( i.getItem(), f ) ) f = i.getItem(); 47 //cout << "comparing " << f << " and " << i.getItem() 48 // << " == " << lowerRank( i.getItem(), f, ind ) << endl; 49 if ( lowerRank( i.getItem(), f, ind ) ) { 50 if ( ind ){ 51 CFList Itemlist= get_Terms(i.getItem()); 52 CFList Flist= get_Terms(f); 53 54 // Have to further compare number of terms! 55 //cout << "compare terms! f= " << Flist.length() << " item= " 56 // << Itemlist.length() <<endl; 57 if ( Itemlist.length() < Flist.length()) f = i.getItem(); 58 ind=0; 59 } 60 else{ 61 f = i.getItem(); 62 } 63 } 46 64 ++i; 47 65 } … … 85 103 CanonicalForm 86 104 Prem ( const CanonicalForm &f, const CanonicalForm &g ){ 87 CanonicalForm ff, gg, cg, l, test, lu, lv, t;105 CanonicalForm ff, gg, l, test, lu, lv, t, retvalue; 88 106 int df, dg; 89 107 bool reord; 90 108 Variable vf, vg, v; 91 109 92 110 if ( (vf = f.mvar()) < (vg = g.mvar()) ) return f; 93 111 else { … … 103 121 reord=true; 104 122 } 105 cg = LC( gg, v );106 123 dg = degree( gg, v ); 107 124 df = degree( ff, v ); … … 111 128 // cout << "Start gcd..." << endl; 112 129 test = gcd(l,LC(ff)); 113 // cout << "End gcd..."<< endl;130 //cout << "gcd(" << l << "," << LC(ff) << ")= " << test << endl; 114 131 lu = l/test; lv = LC(ff)/test; 115 132 t = power(v,df-dg) * gg * lv; … … 119 136 df = degree( ff, v ); 120 137 } 121 if ( reord ) return swapvar( ff, vg, v ); 122 else return ff; 123 } 138 if ( reord ) { 139 retvalue= swapvar( ff, vg, v ); 140 } 141 else { 142 retvalue= ff; 143 } 144 return retvalue; 145 } 146 } 147 148 static CanonicalForm 149 Sprem ( const CanonicalForm &f, const CanonicalForm &g, CanonicalForm & m, CanonicalForm & q ){ 150 CanonicalForm ff, gg, l, test, retvalue; 151 int df, dg,n; 152 bool reord; 153 Variable vf, vg, v; 154 155 if ( (vf = f.mvar()) < (vg = g.mvar()) ) { 156 m=CanonicalForm(0); q=CanonicalForm(0); 157 return f; 158 } 159 else { 160 if ( vf == vg ) { 161 ff = f; gg = g; 162 reord = false; 163 v = vg; // == x 164 } 165 else { 166 v = Variable(level(f.mvar()) + 1); 167 ff = swapvar(f,vg,v); // == r 168 gg = swapvar(g,vg,v); // == v 169 reord=true; 170 } 171 dg = degree( gg, v ); // == dv 172 df = degree( ff, v ); // == dr 173 if (dg <= df) {l=LC(gg); gg = gg -LC(gg)*power(v,dg);} 174 else { l = 1; } 175 n= 0; 176 while ( ( dg <= df ) && ( ff != ff.genZero()) ){ 177 test= power(v,df-dg) * gg * LC(ff); 178 if ( df == 0 ){ff= ff.genZero();} 179 else {ff= ff - LC(ff)*power(v,df);} 180 ff = l*ff-test; 181 df= degree(ff,v); 182 n++; 183 } 184 if ( reord ) { 185 retvalue= swapvar( ff, vg, v ); 186 } 187 else { 188 retvalue= ff; 189 } 190 m= power(l,n); 191 if ( divides(g,m*f-retvalue) ) 192 q= (m*f-retvalue)/g; 193 else { 194 q= CanonicalForm(0); 195 } 196 return retvalue; 197 } 198 } 199 200 CanonicalForm 201 divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as){ 202 CanonicalForm r,m,q; 203 204 r= Sprem(ff,f,m,q); 205 //cout << "r= " << r << " , m= " << m << " , q= " << q << endl; 206 r= Prem(q,as); 207 //cout << "r= " << r << endl; 208 return r; 209 } 210 211 static CanonicalForm 212 myfitting( const CanonicalForm &f ){ 213 CanonicalForm rem=f; 214 215 if ( rem!=0 ){ 216 if ( getCharacteristic() > 0 ) 217 return num((rem/lc(rem))); 218 else{ 219 On(SW_RATIONAL); 220 CanonicalForm temp= mapinto(rem); 221 // cout << "temp= " << temp << endl; 222 // cout << "lc(temp)= " << lc(temp) << endl; 223 // cout << "temp/lc(temp)= " << temp/lc(temp) << endl; 224 // cout << "num(rem/lc(rem))= " << num(rem/lc(rem)) << endl; 225 temp= common_den(temp/lc(temp))*(temp/lc(temp)); 226 Off(SW_RATIONAL); 227 rem= mapinto(temp); 228 return rem; 229 } 230 } 231 else 232 return rem; 124 233 } 125 234 … … 131 240 //cout << " PREM: Prem(" << rem << "," ; 132 241 rem = Prem( rem, i.getItem() ); 133 //cout << i.getItem() << ") = " << rem << endl; 134 } 135 if ( rem!=0 ) 136 return num(rem/lc(rem)); 137 else 138 return rem; 242 //cout << " PREM: Prem(" << rem << "," << i.getItem() << ") = " << rem << endl; 243 } 244 return myfitting(rem); 139 245 } 140 246 … … 142 248 Prem( const CFList &AS, const CFList &L ){ 143 249 CFList Output; 250 144 251 for ( CFListIterator i=AS; i.hasItem(); i++ ) 145 252 Output = Union(CFList(Prem(i.getItem(),L)), Output); 253 146 254 return Output; 255 } 256 257 static CanonicalForm 258 premasb( const CanonicalForm & f, const CFList & as){ 259 CanonicalForm remd=f; 260 CFList AS=as; 261 262 if ( as.length() > 1 ){ 263 AS.removeFirst(); // get rid of first elem 264 CanonicalForm elem; 265 while ( ! AS.isEmpty() ){ // thats true for at least the first iteration 266 elem= AS.getLast(); 267 remd= Prem(remd,elem); 268 AS.removeLast(); 269 } 270 } 271 CanonicalForm a,b; 272 if ( mydivremt(remd, as.getFirst(), a,b )){ remd= remd.genZero();} 273 else { remd= Prem(remd, as.getFirst()); } 274 275 return remd; 276 } 277 278 CFList 279 remsetb( const CFList & ps, const CFList & as){ 280 CFList output; 281 CanonicalForm elem; 282 for (CFListIterator i=ps; i.hasItem(); i++){ 283 elem= premasb(i.getItem(),as); 284 if ( elem != elem.genZero() ) output.append(elem); 285 } 286 return output; 147 287 } 148 288 … … 208 348 testlist.append(CanonicalForm(Variable(J))); 209 349 } 350 351 // testlist = Union(Remembern.FS1, testlist); // add candidates 210 352 211 353 // remove already removed factors … … 213 355 testelem = j.getItem(); 214 356 while ( 1 ){ 215 test = divremt(r,testelem,a,b);357 test = mydivremt(r,testelem,a,b); 216 358 if ( test && b == r.genZero() ) r = a; 217 359 else break; 218 360 } 219 361 } 220 362 221 363 // Let's look if we have other canditates to remove 222 364 for ( j = testlist ; j.hasItem(); j++ ){ 223 365 testelem = j.getItem(); 366 // if ( testelem != r && testelem != r.mvar() ){ 224 367 if ( testelem != r ){ 225 368 while ( 1 ){ 226 369 test = divremt(r,testelem,a,b); 227 test = divremt(r,testelem,a,b);228 if ( test && b == r.genZero() ) r = a;229 370 if ( test && b == r.genZero() ){ 230 231 232 371 Remembern.FS2= Union(Remembern.FS2, CFList(testelem)); 372 r = a; 373 if ( r == 1 ) break; 233 374 } 234 375 else break; … … 236 377 } 237 378 } 379 // cout << "Remembern.FS1 = " << Remembern.FS1 << endl; 380 // cout << "Remembern.FS2 = " << Remembern.FS2 << endl; 381 // Remembern.FS1 = Difference(Remembern.FS1, Remembern.FS2); 382 // cout << " New Remembern.FS1 = " << Remembern.FS1 << endl; 238 383 } 239 384 … … 253 398 elem = j.getItem().factor(); 254 399 if ( getNumVars(elem) > 0 ) 255 qs= Union(qs, CFList( num(elem/lc(elem))));400 qs= Union(qs, CFList(myfitting(elem))); 256 401 } 257 402 } … … 267 412 else { 268 413 leadcoeff = LC(f,lvar(f)); 269 if ( leadcoeff != 0 )270 returnnum(leadcoeff/lc(leadcoeff));271 else return leadcoeff;414 // if ( leadcoeff != 0 ) 415 return myfitting(leadcoeff); //num(leadcoeff/lc(leadcoeff)); 416 // else return leadcoeff; 272 417 } 273 418 } … … 352 497 //CF pfactor( ..... ) 353 498 354 // ////////////////////////////////////////355 // for IrrCharSeries499 // ////////////////////////////////////////// 500 // // for IrrCharSeries 356 501 357 502 #ifdef IRRCHARSERIESDEBUG -
libfac/charset/csutil.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: csutil.h,v 1. 2 1997-06-09 15:55:55Singular Exp $4 // $Id: csutil.h,v 1.3 1997-09-12 07:19:42 Singular Exp $ 5 5 //////////////////////////////////////////////////////////// 6 6 … … 54 54 CFList Prem( const CFList &AS, const CFList &L ); 55 55 /*ENDPUBLIC*/ 56 CanonicalForm divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as); 57 CFList remsetb( const CFList & ps, const CFList & as); 56 58 CanonicalForm lowestRank( const CFList & F ); 57 59 … … 64 66 int irreducible( const CFList & AS); 65 67 CFList select( const ListCFList & PS); 66 void select( const ListCFList & ppi, int length, ListCFList & ppi1, ListCFList & ppi2); 67 bool same( const CFList &A, const CFList &B ); 68 bool member( const CFList & cs, const ListCFList & pi ); 68 void select( const ListCFList & ppi, int length, ListCFList & ppi1, 69 ListCFList & ppi2); 70 bool same( const CFList &A, const CFList &B ); 71 bool member( const CFList & cs, const ListCFList & pi ); 69 72 bool subset( const CFList &PS, const CFList &CS ); 70 ListCFList MyUnion( const ListCFList & a, const ListCFList &b );71 ListCFList MyDifference( const ListCFList & a, const CFList &b);72 ListCFList Minus( const ListCFList & a, const ListCFList &b);73 ListCFList MyUnion( const ListCFList & a, const ListCFList &b ); 74 ListCFList MyDifference( const ListCFList & a, const CFList &b); 75 ListCFList Minus( const ListCFList & a, const ListCFList &b); 73 76 #endif /* INCL_CSUTIL_H */ 74 77 -
libfac/charset/debug.cc
r0479e09 r4a81ec 1 1 /* Copyright 1997 Michael Messollen. All rights reserved. */ 2 2 //////////////////////////////////////////////////////////// 3 // static char * rcsid = "$Id: debug.cc,v 1. 1.1.1 1997-09-11 10:58:22Singular Exp $ ";3 // static char * rcsid = "$Id: debug.cc,v 1.2 1997-09-12 07:19:43 Singular Exp $ "; 4 4 //////////////////////////////////////////////////////////// 5 5 static int deb_level; -
libfac/charset/reorder.cc
r0479e09 r4a81ec 12 12 ///////////////////////////////////////////////////////////// 13 13 // emacs edit mode for this file is -*- C++ -*- 14 static char * rcsid = "$Id: reorder.cc,v 1. 2 1997-06-09 15:55:56Singular Exp $";14 static char * rcsid = "$Id: reorder.cc,v 1.3 1997-09-12 07:19:44 Singular Exp $"; 15 15 //////////////////////////////////////////////////////////// 16 16 // FACTORY - Includes … … 18 18 // Factor - Includes 19 19 #include <tmpl_inst.h> 20 #include "homogfactor.h" 20 21 // Charset - Includes 21 #include "homogfactor.h" 22 23 // some CC's need this: 24 #include "reorder.h" 22 25 23 26 #ifdef REORDERDEBUG … … 349 352 } 350 353 354 static CFFList 355 swapvar( const CFFList & PS, const Variable & x, const Variable & y){ 356 CFFList ps; 357 358 for (CFFListIterator i= PS; i.hasItem(); i++) 359 ps.append(CFFactor(swapvar(i.getItem().factor(),x,y),i.getItem().exp())); 360 return ps; 361 } 362 351 363 // a library function: we reorganize the global variable ordering 352 364 CFList … … 368 380 } 369 381 382 CFFList 383 reorder( const Varlist & betterorder, const CFFList & PS){ 384 int i=1, n = betterorder.length(); 385 Intarray v(1,n); 386 CFFList ps=PS; 387 388 //initalize: 389 for (VarlistIterator j = betterorder; j.hasItem(); j++){ 390 v[i]= level(j.getItem()); i++; 391 } 392 DEBOUTLN(cout, "reorder: Original ps= ", ps); 393 // reorder: 394 for (i=1; i <= n; i++) 395 ps=swapvar(ps,Variable(v[i]),Variable(n+i)); 396 DEBOUTLN(cout, "reorder: Reorganized ps= ", ps); 397 return ps; 398 } 399 370 400 ListCFList 371 401 reorder(const Varlist & betterorder, const ListCFList & Q){ -
libfac/charset/reorder.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: reorder.h,v 1. 2 1997-06-09 15:55:56Singular Exp $4 // $Id: reorder.h,v 1.3 1997-09-12 07:19:45 Singular Exp $ 5 5 //////////////////////////////////////////////////////////// 6 6 #ifndef INCL_REORDER_H … … 38 38 // 39 39 CFList reorder( const Varlist & betterorder, const CFList & PS); 40 CFFList reorder( const Varlist & betterorder, const CFFList & PS); 40 41 ListCFList reorder(const Varlist & betterorder, const ListCFList & Q); 41 42 /*ENDPUBLIC*/ -
libfac/configure
r0479e09 r4a81ec 521 521 libfac_name="\"Factorization and characteristic sets library\"" 522 522 523 libfac_version="0. 2.4"524 525 libfac_date="\" May 301997\""523 libfac_version="0.3.0" 524 525 libfac_date="\"Sep 11 1997\"" 526 526 527 527 libfac_author="\"M. Messollen\"" … … 556 556 if test "$with_Singular" = yes; then 557 557 cat >> confdefs.h <<\EOF 558 #define HAVE_SINGULAR 1 558 #define SINGULAR 1 559 EOF 560 561 cat >> confdefs.h <<\EOF 562 #define NOSTREAMIO 1 559 563 EOF 560 564 … … 586 590 LDFLAGS="-L. ${LDFLAGS}" 587 591 588 if test "$with_debug" = yes; then 589 CXXFLAGS="-g" 590 else 591 CXXFLAGS="-O" 592 cat >> confdefs.h <<\EOF 592 if test "${CXXFLAGS+set}" != set; then 593 ac_cxxflags_set=no 594 if test "$with_debug" = yes; then 595 CXXFLAGS="-g" 596 else 597 CXXFLAGS="-O" 598 cat >> confdefs.h <<\EOF 593 599 #define NDEBUG 1 594 600 EOF 595 601 602 fi 596 603 fi 597 604 … … 645 652 #endif 646 653 EOF 647 if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:6 48: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then654 if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:655: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then 648 655 ac_cv_prog_gxx=yes 649 656 else … … 694 701 CXXCPP="${CXX-g++} -E" 695 702 cat > conftest.$ac_ext <<EOF 696 #line 697"configure"703 #line 704 "configure" 697 704 #include "confdefs.h" 698 705 #include <stdlib.h> 699 706 EOF 700 707 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" 701 { (eval echo configure:70 2: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }708 { (eval echo configure:709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } 702 709 ac_err=`grep -v '^ *+' conftest.out` 703 710 if test -z "$ac_err"; then … … 808 815 else 809 816 cat > conftest.$ac_ext <<EOF 810 #line 81 1"configure"817 #line 818 "configure" 811 818 #include "confdefs.h" 812 819 #include <factory.h> 813 820 EOF 814 821 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" 815 { (eval echo configure:8 16: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }822 { (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } 816 823 ac_err=`grep -v '^ *+' conftest.out` 817 824 if test -z "$ac_err"; then … … 841 848 else 842 849 cat > conftest.$ac_ext <<EOF 843 #line 8 44"configure"850 #line 851 "configure" 844 851 #include "confdefs.h" 845 852 … … 891 898 ; return 0; } 892 899 EOF 893 if { (eval echo configure: 894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then900 if { (eval echo configure:901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then 894 901 rm -rf conftest* 895 902 ac_cv_c_const=yes … … 917 924 for ac_kw in inline __inline__ __inline; do 918 925 cat > conftest.$ac_ext <<EOF 919 #line 92 0"configure"926 #line 927 "configure" 920 927 #include "confdefs.h" 921 928 … … 925 932 ; return 0; } 926 933 EOF 927 if { (eval echo configure:9 28: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then934 if { (eval echo configure:935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then 928 935 rm -rf conftest* 929 936 ac_cv_c_inline=$ac_kw; break … … 950 957 951 958 if test ${GXX} = yes; then 952 if test "$with_debug" = yes; then 953 CXXFLAGS="-O -g" 954 else 955 CXXFLAGS="-O3 " 959 if test "$ac_cxxflags_set" = no; then 960 if test "$with_debug" = yes; then 961 CXXFLAGS="-O -g" 962 else 963 CXXFLAGS="-O3 " 964 fi 956 965 fi 957 966 CXXTEMPLFLAGS="-fno-implicit-templates" -
libfac/configure.in
r0479e09 r4a81ec 15 15 libfac_name="\"Factorization and characteristic sets library\"" 16 16 AC_SUBST(libfac_version) 17 libfac_version="0. 2.4"17 libfac_version="0.3.0" 18 18 AC_SUBST(libfac_date) 19 libfac_date="\" May 301997\""19 libfac_date="\"Sep 11 1997\"" 20 20 AC_SUBST(libfac_author) 21 21 libfac_author="\"M. Messollen\"" … … 46 46 47 47 if test "$with_Singular" = yes; then 48 AC_DEFINE(HAVE_SINGULAR) 48 AC_DEFINE(SINGULAR) 49 AC_DEFINE(NOSTREAMIO) 49 50 if test "$with_debug" = yes; then 50 51 targetname="libsingfac-g" … … 77 78 LDFLAGS="-L. ${LDFLAGS}" 78 79 79 if test "$with_debug" = yes; then 80 CXXFLAGS="-g" 81 else 82 CXXFLAGS="-O" 83 AC_DEFINE(NDEBUG) 80 if test "${CXXFLAGS+set}" != set; then 81 ac_cxxflags_set=no 82 if test "$with_debug" = yes; then 83 CXXFLAGS="-g" 84 else 85 CXXFLAGS="-O" 86 AC_DEFINE(NDEBUG) 87 fi 84 88 fi 85 89 … … 126 130 dnl 127 131 if test ${GXX} = yes; then 128 if test "$with_debug" = yes; then 129 CXXFLAGS="-O -g" 130 else 131 CXXFLAGS="-O3 " 132 if test "$ac_cxxflags_set" = no; then 133 if test "$with_debug" = yes; then 134 CXXFLAGS="-O -g" 135 else 136 CXXFLAGS="-O3 " 137 fi 132 138 fi 133 139 CXXTEMPLFLAGS="-fno-implicit-templates" -
libfac/factor.h
r0479e09 r4a81ec 20 20 21 21 //// Note: InternalSqrFree does only the work needed for factorization. 22 // int SqrFreeTest( const CanonicalForm & r, int opt=1) ;23 22 // CFFList SqrFree( const CanonicalForm & f ) ; 24 CFFList InternalSqrFree( const CanonicalForm & f ) ;25 23 26 24 typedef List<CFList> ListCFList; … … 50 48 CFList Prem( const CFList &AS, const CFList &L ); 51 49 CFList MCharSetN( const CFList &PS, PremForm & Remembern ); 52 ListCFList IrrCharSeries( const CFList &PS );50 ListCFList IrrCharSeries( const CFList &PS, int opt=0 ); 53 51 54 52 // the next three give you a heuristically optimal reorderd list of the … … 79 77 // 80 78 CFList reorder( const Varlist & betterorder, const CFList & PS); 79 CFFList reorder( const Varlist & betterorder, const CFFList & PS); 81 80 ListCFList reorder(const Varlist & betterorder, const ListCFList & Q); 82 81 82 83 83 #endif /* FACTOR_H */ -
libfac/factor/Factor.cc
r0479e09 r4a81ec 1 1 /* Copyright 1996 Michael Messollen. All rights reserved. */ 2 2 /////////////////////////////////////////////////////////////////////////////// 3 static char * rcsid = "$Id: Factor.cc,v 1. 2 1997-06-09 15:55:58Singular Exp $ ";3 static char * rcsid = "$Id: Factor.cc,v 1.3 1997-09-12 07:19:46 Singular Exp $ "; 4 4 static char * errmsg = "\nYou found a bug!\nPlease inform (Michael Messollen) michael@math.uni-sb.de \nPlease include above information and your input (the ideal/polynomial and characteristic) in your bug-report.\nThank you."; 5 5 /////////////////////////////////////////////////////////////////////////////// … … 14 14 #include "homogfactor.h" 15 15 #include "interrupt.h" 16 // some CC's need this: 17 #include "Factor.h" 18 19 #ifdef SINGULAR 20 # define HAVE_SINGULAR 21 #endif 16 22 17 23 #ifdef FACTORDEBUG … … 30 36 TIMING_DEFINE_PRINT(truefactor_time); 31 37 32 extern int libfac_interruptflag;33 #ifdef HAVE_SINGULAR34 extern void WerrorS(char *);35 #endif36 38 37 39 /////////////////////////////////////////////////////////////// … … 139 141 // Return the list of factors. // 140 142 /////////////////////////////////////////////////////////////// 141 CFFList143 static CFFList 142 144 not_monic( const CFFList & TheList, const CanonicalForm & ltt, const CanonicalForm & F, int levelF){ 143 145 CFFList Returnlist,IntermediateList; … … 210 212 else { 211 213 #ifdef HAVE_SINGULAR 214 extern void WerrorS(char *); 212 215 WerrorS("libfac: ERROR: not_monic1: case lt is a sum."); 213 216 #else … … 227 230 else { 228 231 #ifdef HAVE_SINGULAR 232 extern void WerrorS(char *); 229 233 WerrorS("libfac: ERROR: not_monic2: case lt is a sum."); 230 234 #else … … 308 312 // field getCharacteristik()^Extension. // 309 313 /////////////////////////////////////////////////////////////// 310 staticCanonicalForm314 CanonicalForm 311 315 generate_mipo( int degree_of_Extension , const Variable & Extension ){ 312 316 FFRandom gen; … … 316 320 else { 317 321 #ifdef HAVE_SINGULAR 322 extern void WerrorS(char *); 318 323 WerrorS("libfac: evaluate: Extension not inFF() or inGF() !"); 319 324 #else … … 387 392 else { 388 393 #ifdef HAVE_SINGULAR 394 extern void WerrorS(char *); 389 395 WerrorS("libfac: spezializePoly ERROR: Working over given extension-field not yet implemented!"); 390 396 #else … … 421 427 else { 422 428 #ifdef HAVE_SINGULAR 429 extern void WerrorS(char *); 423 430 WerrorS("libfac: evaluate: Extension not inFF() or inGF() !"); 424 431 #else … … 428 435 FFRandom gen; }} 429 436 REvaluation k(1,n,gen); 437 k.nextpoint(); 430 438 for ( int i=1; i<=maxtries ; i++){ 431 // 439 // k.nextpoint(); 432 440 SFormList Substitutionlist; 433 441 for ( int j=1; j<=n; j++ ) … … 496 504 /////////////////////////////////////////////////////////////// 497 505 CFFList 498 Factorized( const CanonicalForm & F, const Variable & alpha, int Mainvar =0){506 Factorized( const CanonicalForm & F, const Variable & alpha, int Mainvar){ 499 507 CanonicalForm f,lt,ff,ffuni; 500 508 Variable Extension=alpha; … … 599 607 if (success == 0 ){ // No spezialisation could be found 600 608 #ifdef HAVE_SINGULAR 609 extern void WerrorS(char *); 601 610 WerrorS("libfac: Factorize: ERROR: Not able to find a valid specialization!"); 602 611 #else … … 684 693 /////////////////////////////////////////////////////////////// 685 694 CFFList 686 Factorize( const CanonicalForm & F, int is_SqrFree =0){695 Factorize( const CanonicalForm & F, int is_SqrFree ){ 687 696 CFFList Outputlist,SqrFreeList,Intermediatelist,Outputlist2; 688 697 ListIterator<CFFactor> i,j; … … 700 709 if ( getCharacteristic() == 0 ) { // char == 0 701 710 TIMING_START(factorize_time); 711 //cout << "Factoring in char=0 of " << F << " = " << Outputlist << endl; 702 712 Outputlist= factorize(F); 703 // cout << "Factoring in char=0 of " << F << " = " << Outputlist << endl;704 713 // Factorization in char=0 doesn't sometimes return at least two elements!!! 705 714 if ( getNumVars(Outputlist.getFirst().factor()) != 0 ) -
libfac/factor/Factor.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: Factor.h,v 1. 2 1997-06-09 15:55:59Singular Exp $4 // $Id: Factor.h,v 1.3 1997-09-12 07:19:47 Singular Exp $ 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 #ifndef FACTOR_H 7 7 #define FACTOR_H 8 CanonicalForm generate_mipo( int degree_of_Extension , const Variable & Extension ); 8 9 CFFList Factorized( const CanonicalForm & F, const Variable & alpha, int Mainvar=0); 9 10 /*BEGINPUBLIC*/ -
libfac/factor/MVMultiHensel.cc
r0479e09 r4a81ec 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1. 2 1997-06-09 15:56:00Singular Exp $";4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1.3 1997-09-12 07:19:48 Singular Exp $"; 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 // FACTORY - Includes … … 9 9 #include "tmpl_inst.h" 10 10 #include "helpstuff.h" 11 // some CC's need this: 12 #include "MVMultiHensel.h" 13 14 #ifdef SINGULAR 15 # define HAVE_SINGULAR 16 #endif 11 17 12 18 #ifdef HENSELDEBUG -
libfac/factor/MVMultiHensel.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: MVMultiHensel.h,v 1. 2 1997-06-09 15:56:00Singular Exp $4 // $Id: MVMultiHensel.h,v 1.3 1997-09-12 07:19:48 Singular Exp $ 5 5 ///////////////////////////////////////////////////////////// 6 6 #ifndef MULTIHENSEL_H -
libfac/factor/SqrFree.cc
r0479e09 r4a81ec 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 static char * rcsid = "$Id: SqrFree.cc,v 1. 2 1997-06-09 15:56:02Singular Exp $";5 static char * errmsg = "\nYou found a bug!\nPlease inform (Michael Messollen) michael@math.uni-sb.de . n Please include above information and your input (the ideal/polynomial and characteristic) in your bug-report.\nThank you.";4 static char * rcsid = "$Id: SqrFree.cc,v 1.3 1997-09-12 07:19:50 Singular Exp $"; 5 static char * errmsg = "\nYou found a bug!\nPlease inform (Michael Messollen) michael@math.uni-sb.de .\n Please include above information and your input (the ideal/polynomial and characteristic) in your bug-report.\nThank you."; 6 6 /////////////////////////////////////////////////////////////////////////////// 7 7 // FACTORY - Includes … … 10 10 #include "tmpl_inst.h" 11 11 #include "helpstuff.h" 12 // some CC's need this: 13 #include "SqrFree.h" 14 15 #ifdef SINGULAR 16 # define HAVE_SINGULAR 17 #endif 12 18 13 19 #ifdef SQRFREEDEBUG … … 22 28 TIMING_DEFINE_PRINT(gcd_time); 23 29 24 #ifdef HAVE_SINGULAR25 extern void WerrorS(char *);26 #endif27 28 // forward declaration:29 CFFList SqrFree( const CanonicalForm & r );30 CFFList InternalSqrFree( const CanonicalForm & r );31 30 32 31 static inline CFFactor … … 52 51 PthRoot( const CanonicalForm & f ){ 53 52 CanonicalForm RES, R = f; 54 int n= getNumVars(R), p= getCharacteristic();53 int n= max(level(R),getNumVars(R)), p= getCharacteristic(); 55 54 56 55 if (n==0){ // constant … … 78 77 /////////////////////////////////////////////////////////////// 79 78 int 80 SqrFreeTest( const CanonicalForm & r, int opt =1){79 SqrFreeTest( const CanonicalForm & r, int opt){ 81 80 CanonicalForm f=r, g; 82 81 int n=level(f); … … 126 125 } 127 126 #ifdef HAVE_SINGULAR 127 extern void WerrorS(char *); 128 128 WerrorS("libfac: ERROR: SqrFreeTest: we should never fall trough here!"); 129 129 #else … … 197 197 g=swapvar(f,k,n) ; g = g.deriv(); 198 198 if ( ! g.isZero() ){ // can`t be Pth root 199 CFFList Outputlist2= SqrFreed(swapvar(f,k,n)); 199 CFFList Outputlist2= SqrFreed(swapvar(f,k,n)); 200 200 for (CFFListIterator inter=Outputlist2; inter.hasItem(); inter++){ 201 201 Outputlist= myappend(Outputlist, CFFactor(swapvar(inter.getItem().factor(),k,n), inter.getItem().exp())); … … 252 252 } 253 253 #ifdef HAVE_SINGULAR 254 extern void WerrorS(char *); 254 255 WerrorS("libfac: ERROR: SqrFreed: we should never fall trough here!"); 255 256 #else -
libfac/factor/SqrFree.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: SqrFree.h,v 1. 2 1997-06-09 15:56:03Singular Exp $4 // $Id: SqrFree.h,v 1.3 1997-09-12 07:19:51 Singular Exp $ 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 #ifndef SQRFREE_H … … 8 8 9 9 /*BEGINPUBLIC*/ 10 // int SqrFreeTest( const CanonicalForm & r, int opt=1) ;11 10 // CFFList SqrFree( const CanonicalForm & f ) ; 11 /*ENDPUBLIC*/ 12 12 CFFList InternalSqrFree( const CanonicalForm & f ) ; 13 /*ENDPUBLIC*/ 14 int SqrFreeTest( const CanonicalForm & r, int opt=1) ; 13 int SqrFreeTest( const CanonicalForm & r, int opt=1) ; 15 14 CFFList SqrFree( const CanonicalForm & f ) ; 16 15 #endif /* SQRFREE_H */ -
libfac/factor/Truefactor.cc
r0479e09 r4a81ec 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 //static char * rcsid = "@(#) $Id: Truefactor.cc,v 1. 2 1997-06-09 15:56:04Singular Exp $";4 //static char * rcsid = "@(#) $Id: Truefactor.cc,v 1.3 1997-09-12 07:19:52 Singular Exp $"; 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 // Factory - Includes … … 9 9 #include "tmpl_inst.h" 10 10 #include "helpstuff.h" 11 // some CC's need this: 12 #include "Truefactor.h" 13 14 #ifdef SINGULAR 15 # define HAVE_SINGULAR 16 #endif 11 17 12 18 #ifdef TRUEFACTORDEBUG … … 19 25 #include "timing.h" 20 26 21 #ifdef HAVE_SINGULAR22 extern void WerrorS(char *);23 #endif24 27 /////////////////////////////////////////////////////////////// 25 28 // generate all different k-subsets of the set with n // … … 233 236 // Check if poly f is in Fp (returns true) or in Fp(a) // 234 237 /////////////////////////////////////////////////////////////// 235 bool238 static bool 236 239 is_in_Fp( const CanonicalForm & f ){ 237 240 if ( f.inCoeffDomain() ) … … 278 281 if ( PossibleFactors.length() < n ) { // a little check 279 282 #ifdef HAVE_SINGULAR 283 extern void WerrorS(char *); 280 284 WerrorS("libfac: ERROR: TakeNorms less then two items remaining!"); 281 285 #else … … 320 324 else{ 321 325 #ifdef HAVE_SINGULAR 326 extern void WerrorS(char *); 322 327 WerrorS("libfac: TakeNorms: somethings wrong with remaining factors!"); 323 328 #else -
libfac/factor/Truefactor.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: Truefactor.h,v 1. 2 1997-06-09 15:56:05Singular Exp $4 // $Id: Truefactor.h,v 1.3 1997-09-12 07:19:53 Singular Exp $ 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 #ifndef TRUEFACTOR_H -
libfac/factor/class.cc
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // static char * rcsid = "@(#) $Id: class.cc,v 1. 2 1997-06-09 15:56:05Singular Exp $";4 // static char * rcsid = "@(#) $Id: class.cc,v 1.3 1997-09-12 07:19:53 Singular Exp $"; 5 5 //////////////////////////////////////////////////////////// 6 6 … … 33 33 } 34 34 35 #ifndef NOSTREAMIO 35 36 template <class T> 36 37 void Substitution<T>::print ( ostream& s ) const … … 38 39 s << "(" << factor() << ")^" << exp(); 39 40 } 41 #endif 40 42 41 43 //////////////////////////////////////////////////////////// -
libfac/factor/class.h
r0479e09 r4a81ec 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: class.h,v 1. 3 1997-08-01 10:51:28Singular Exp $4 // $Id: class.h,v 1.4 1997-09-12 07:19:54 Singular Exp $ 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 #ifndef INCL_CLASS_H … … 12 12 #include <iostream.h> 13 13 #endif 14 15 14 16 15 template <class T> … … 41 40 return os; 42 41 } 43 #endif 42 #endif 44 43 }; 45 44 … … 53 52 /* 54 53 $Log: not supported by cvs2svn $ 55 Revision 1.2 1997/06/09 15:56:06 Singular56 * hannes/michael: libfac 0.2.457 58 54 Revision 1.2 1997/04/25 22:21:26 michael 59 55 Version for libfac-0.2.1 -
libfac/factor/debug.cc
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // static char * rcsid = "$Id: debug.cc,v 1. 2 1997-06-09 15:56:07Singular Exp $ ";4 // static char * rcsid = "$Id: debug.cc,v 1.3 1997-09-12 07:19:55 Singular Exp $ "; 5 5 //////////////////////////////////////////////////////////// 6 6 static int deb_level; -
libfac/factor/debug.h
r0479e09 r4a81ec 1 1 /* Copyright 1996 Michael Messollen. All rights reserved. */ 2 2 //////////////////////////////////////////////////////////// 3 // static char * rcsid = "$Id: debug.h,v 1. 2 1997-06-09 15:56:08Singular Exp $" ;3 // static char * rcsid = "$Id: debug.h,v 1.3 1997-09-12 07:19:55 Singular Exp $" ; 4 4 //////////////////////////////////////////////////////////// 5 5 // It is possible to include this file multiple times for different … … 45 45 (stream << deb_level_msg, stream.flush()) 46 46 #define DEBOUT(stream,msg,object) \ 47 (stream << msg << object, stream.flush())47 (stream << deb_level_msg << msg << object, stream.flush()) 48 48 #define DEBOUTLN(stream,msg,object) \ 49 49 (stream << deb_level_msg << msg << object << endl) -
libfac/factor/helpstuff.cc
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // static char * rcsid = "$Id: helpstuff.cc,v 1. 2 1997-06-09 15:56:08Singular Exp $";4 // static char * rcsid = "$Id: helpstuff.cc,v 1.3 1997-09-12 07:19:56 Singular Exp $"; 5 5 //////////////////////////////////////////////////////////// 6 6 // FACTORY - Includes … … 8 8 // Factor - Includes 9 9 #include "tmpl_inst.h" 10 // some CC's need this: 11 #include "helpstuff.h" 10 12 11 13 bool … … 18 20 else { b=aa; } 19 21 return retvalue; 22 } 23 24 void 25 mydivrem( const CanonicalForm& f, const CanonicalForm& g, CanonicalForm& a, CanonicalForm& b ){ 26 bool retvalue; 27 CanonicalForm aa,bb; 28 retvalue = divremt(f,g,a,bb); 29 aa= f-g*a; 30 if ( aa==bb ) { b=bb; } 31 else { b=aa; } 20 32 } 21 33 … … 60 72 61 73 int 62 Powerup( const int base , const int exp =1){74 Powerup( const int base , const int exp){ 63 75 int retvalue=1; 64 76 if ( exp == 0 ) return retvalue ; -
libfac/factor/helpstuff.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: helpstuff.h,v 1. 2 1997-06-09 15:56:09Singular Exp $4 // $Id: helpstuff.h,v 1.3 1997-09-12 07:19:57 Singular Exp $ 5 5 //////////////////////////////////////////////////////////// 6 6 #ifndef HELPSTUFF_H 7 7 #define HELPSTUFF_H 8 8 bool mydivremt ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& ); 9 void mydivrem( const CanonicalForm& f, const CanonicalForm& g, CanonicalForm& a, CanonicalForm& b ); 9 10 /////////////////////////////////////////////////////////////// 10 11 // Now some procedures used in MVMultiHensel and in Truefactors -
libfac/factor/homogfactor.cc
r0479e09 r4a81ec 1 1 /* Copyright 1997 Michael Messollen. All rights reserved. */ 2 2 //////////////////////////////////////////////////////////// 3 // static char * rcsid = "$Id: homogfactor.cc,v 1. 2 1997-06-09 15:56:10Singular Exp $ ";3 // static char * rcsid = "$Id: homogfactor.cc,v 1.3 1997-09-12 07:19:57 Singular Exp $ "; 4 4 //////////////////////////////////////////////////////////// 5 5 // FACTORY - Includes … … 8 8 #include "tmpl_inst.h" 9 9 #include "Factor.h" 10 // some CC's need it: 11 #include "homogfactor.h" 10 12 11 13 #ifdef HFACTORDEBUG -
libfac/factor/homogfactor.h
r0479e09 r4a81ec 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: homogfactor.h,v 1. 2 1997-06-09 15:56:10Singular Exp $4 // $Id: homogfactor.h,v 1.3 1997-09-12 07:19:58 Singular Exp $ 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 #ifndef HFACTOR_H 7 7 #define HFACTOR_H 8 CFList get_Terms( const CanonicalForm & f );9 bool is_homogeneous( const CanonicalForm & f);10 CFFList 8 CFList get_Terms( const CanonicalForm & f ); 9 bool is_homogeneous( const CanonicalForm & f); 10 CFFList HomogFactor( const CanonicalForm & g, const Variable & minpoly, const int Mainvar ); 11 11 #endif /* HFACTOR_H */ 12 12 -
libfac/factor/timing.h
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // static char * rcsid = "$Id: timing.h,v 1. 2 1997-06-09 15:56:12Singular Exp $";4 // static char * rcsid = "$Id: timing.h,v 1.3 1997-09-12 07:19:59 Singular Exp $"; 5 5 //////////////////////////////////////////////////////////// 6 6 // It is possible to include this file multiple times for different -
libfac/factor/tmpl_inst.cc
r0479e09 r4a81ec 2 2 //////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: tmpl_inst.cc,v 1. 2 1997-06-09 15:56:12Singular Exp $4 // $Id: tmpl_inst.cc,v 1.3 1997-09-12 07:20:00 Singular Exp $ 5 5 //////////////////////////////////////////////////////////// 6 6 … … 82 82 template class Array<Variable>; 83 83 84 // for database 85 #ifdef HAVE_DATABASE 86 template class List<CFFList>; 87 template class ListIterator<CFFList>; 88 #endif /* HAVE_DATABASE */ 84 89 //////////////////////////////////////////////////////////// 85 90 /* -
libfac/factor/tmpl_inst.h
r0479e09 r4a81ec 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: tmpl_inst.h,v 1. 2 1997-06-09 15:56:14Singular Exp $4 // $Id: tmpl_inst.h,v 1.3 1997-09-12 07:20:01 Singular Exp $ 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 #ifndef TMPL_INST_H … … 37 37 typedef Array<int> Intarray; 38 38 39 typedef Array<CFArray> CCFArray ; 40 typedef Array<CCFArray> CCCFArray ; 39 #ifdef HAVE_DATABASE 40 typedef List<CFFList> ListCFFList; 41 typedef ListIterator<CFFList> ListCFFListIterator; 42 #endif 43 44 //typedef Array<CFArray> CCFArray ; 45 //typedef Array<CCFArray> CCCFArray ; 41 46 42 47 #endif /* TMPL_INST_H */ -
libfac/factor/version.cc
r0479e09 r4a81ec 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // $Id: version.cc,v 1. 2 1997-06-09 15:56:14Singular Exp $4 // $Id: version.cc,v 1.3 1997-09-12 07:20:02 Singular Exp $ 5 5 static char * rcsid = "@(#) libfac version 0.2.4 [May 29 1997] (C) 1996-97 M. Messollen"; 6 6 /////////////////////////////////////////////////////////////////////////////// 7 7 8 8 char * libfac_name = "Factorization and characteristic sets library"; 9 char * libfac_version = "0. 2.4";10 char * libfac_date = " May 301997";9 char * libfac_version = "0.3.0"; 10 char * libfac_date = "Sep 11 1997"; 11 11 char * libfac_author = "M. Messollen"; 12 12 -
libfac/header.tpl
r0479e09 r4a81ec 26 26 .INCLUDE factor/helpstuff.h 27 27 .INCLUDE factor/tmpl_inst.h 28 .INCLUDE factor/homogfactor.h 29 .INCLUDE factor/debug.h 30 .INCLUDE factor/timing.h 28 31 29 32 //////////////////////////////////////// … … 34 37 .INCLUDE charset/reorder.h 35 38 39 .INCLUDE charset/algfactor.h 40 36 41 #endif /* FACTOR_H */ -
libfac/test.cc
r0479e09 r4a81ec 1 //static char rcsid[] = "$Id: test.cc,v 1. 2 1997-06-09 15:55:50Singular Exp $";1 //static char rcsid[] = "$Id: test.cc,v 1.3 1997-09-12 07:19:34 Singular Exp $"; 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // Factor - Includes -
libfac/testcs.cc
r0479e09 r4a81ec 1 // $Id: testcs.cc,v 1. 1.1.1 1997-09-11 10:58:16Singular Exp $1 // $Id: testcs.cc,v 1.2 1997-09-12 07:19:35 Singular Exp $ 2 2 3 3 #include <factory.h>
Note: See TracChangeset
for help on using the changeset viewer.