Changeset 4a81ec in git


Ignore:
Timestamp:
Sep 12, 1997, 9:20:02 AM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
0fbdd16f374f7f4570da62a453e2328e4d8a4b4c
Parents:
0479e09dbc0fb17be7ebce384df4ba0318ba20eb
Message:
* hannes/michael: libfac-0.3.0


git-svn-id: file:///usr/local/Singular/svn/trunk@708 2c84dea3-7e68-4137-9b89-c4e89433aadc
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.4 of libfac.
     1This is the file 00README.libfac for version prae 0.3.0 of libfac.
    22
    33######### What is libfac?
     
    9595any templates for libsingfac.a.
    9696
    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).
     97If 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
     100this will produce libfac.a and a binary called test. "test" is then used to
     101test some examples for factorization.
     102
     103B) 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.
    131107
    132108
     
    161137  is not yet implemented (but I'm working on it).
    162138  Don't trust the result you'll get in such a case!!!!!!
     139Since version 0.3.0 this problem is gone. (or should be :-) )
    163140
    164141o The performance of the irreducible characteristic series stuff heavily
     
    260237        o released May 30 1997
    261238
     239V0.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
     251V0.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:47 Singular Exp $
     1# $Id: Makefile.in,v 1.8 1997-09-12 07:19:31 Singular Exp $
    22#################################################
    33SHELL           = /bin/sh
     
    6363                factor/debug.h factor/timing.h factor/homogfactor.h \
    6464                factor/interrupt.h
    65 CHARSETINCL =   charset/csutil.h charset/charset.h charset/reorder.h
     65CHARSETINCL =   charset/csutil.h charset/charset.h charset/reorder.h \
     66                charset/alg_factor.h charset/algfactor.h
    6667
    6768OPTFACTOROBJ1 = OPTOBJ/SqrFree.o OPTOBJ/Factor.o OPTOBJ/MVMultiHensel.o \
    6869                OPTOBJ/Truefactor.o OPTOBJ/helpstuff.o OPTOBJ/version.o \
    69                 OPTOBJ/homogfactor.o
     70                OPTOBJ/homogfactor.o OPTOBJ/debug.o
    7071OPTFACTOROBJ2 = OPTOBJ/tmpl_inst.o
    7172OPTFACTOROBJ =  $(OPTFACTOROBJ2) $(OPTFACTOROBJ1)
    7273
    73 OPTCHARSETOBJ = OPTOBJ/csutil.o OPTOBJ/charset.o OPTOBJ/reorder.o
     74OPTCHARSETOBJ = OPTOBJ/csutil.o OPTOBJ/charset.o OPTOBJ/reorder.o \
     75                OPTOBJ/alg_factor.o OPTOBJ/algfactor.o
    7476
    7577DEBFACTOROBJ1 = DEBOBJ/SqrFree.o DEBOBJ/Factor.o DEBOBJ/MVMultiHensel.o \
    7678                DEBOBJ/Truefactor.o DEBOBJ/helpstuff.o DEBOBJ/version.o \
    77                 DEBOBJ/homogfactor.o
     79                DEBOBJ/homogfactor.o DEBOBJ/debug.o
    7880DEBFACTOROBJ2 = DEBOBJ/tmpl_inst.o
    7981DEBFACTOROBJ =  $(DEBFACTOROBJ2) $(DEBFACTOROBJ1)
    8082
    81 DEBCHARSETOBJ = DEBOBJ/csutil.o DEBOBJ/charset.o DEBOBJ/reorder.o
     83DEBCHARSETOBJ = DEBOBJ/csutil.o DEBOBJ/charset.o DEBOBJ/reorder.o \
     84                DEBOBJ/alg_factor.o DEBOBJ/algfactor.o
    8285
    8386##
     
    8790.SUFFIXES:      .cc .h .o
    8891
    89 all: ${TARGETNAME}
     92all: OPTOBJ DEBOBJ ${TARGETNAME}
     93
     94OPTOBJ:
     95        ${MKINSTALLDIRS} OPTOBJ
     96
     97DEBOBJ:
     98        ${MKINSTALLDIRS} DEBOBJ
    9099
    91100OPTOBJ/%.o: %.cc
     
    151160
    152161mostlyclean:
    153         $(RM)   test ${LIBFACNAME}.a ${SINGLIBFACNAME}.a \
     162        $(RM)   test testcs ${LIBFACNAME}.a ${SINGLIBFACNAME}.a \
    154163                ${LIBFACNAME-G}.a ${SINGLIBFACNAME-G}.a
    155164
    156165clean:  mostlyclean
    157         $(RM) charset/DEBOBJ/* OPTOBJ/*
    158166        $(RM) OPTOBJ/optdepend DEBOBJ/debdepend  \
    159167              DEBOBJ/*.o OPTOBJ/*.o
     
    175183                (cd tests ; factortest )
    176184
     185charsettest:    libfac  OPTOBJ/testcs.o
     186                $(CXX) -o testcs $(LDFLAGS) OPTOBJ/testcs.o $(LIBS)
     187
     188#charsettests:  charsettest
     189#               (cd tests ; charsettest )
     190
    177191tests:          factests
    178192
  • libfac/charset/alg_factor.cc

    r0479e09 r4a81ec  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 static char * rcsid = "$Id: alg_factor.cc,v 1.1.1.1 1997-09-11 10:58:22 Singular Exp $";
     5static char * rcsid = "$Id: alg_factor.cc,v 1.2 1997-09-12 07:19:37 Singular Exp $";
    66////////////////////////////////////////////////////////////
    77// FACTORY - Includes
     
    155155      temp= gcd(R, R.deriv(vf));
    156156      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; }
    158158      else { sqfreetest= 1; }
    159159      DEBOUTLN(cout, "sqrf_norm_sub: sqfreetest= ", sqfreetest);
     
    336336  DEBOUTLN(cout, "alg_factor: R= ", R);
    337337  Off(SW_RATIONAL);
    338   Factorlist = Factorize(R,1);
     338  Factorlist = Factorize(R);
    339339  On(SW_RATIONAL);
    340340  DEBOUTLN(cout, "alg_factor: Factorize(R)= ", Factorlist);
     
    410410        if ( x != 0 ){
    411411          divrem(ii.getItem(), gg, q,r);
    412           cout << ii.getItem() << " divided by " << gg << endl;
     412//        cout << ii.getItem() << " divided by " << gg << endl;
    413413          DEBOUTLN(cout, "q= ", q); DEBOUTLN(cout, "r= ", r);
    414414          ii.append(ii.getItem()+q*g); ii.remove(1);
     
    614614$Log: not supported by cvs2svn $
    615615*/
     616
  • libfac/charset/alg_factor.h

    r0479e09 r4a81ec  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 // $Id: alg_factor.h,v 1.1.1.1 1997-09-11 10:58:22 Singular Exp $
     5// $Id: alg_factor.h,v 1.2 1997-09-12 07:19:37 Singular Exp $
    66////////////////////////////////////////////////////////////
    77
  • libfac/charset/algfactor.cc

    r0479e09 r4a81ec  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 static char * rcsid = "$Id: algfactor.cc,v 1.1.1.1 1997-09-11 10:58:22 Singular Exp $";
     5static char * rcsid = "$Id: algfactor.cc,v 1.2 1997-09-12 07:19:38 Singular Exp $";
    66////////////////////////////////////////////////////////////
    77// FACTORY - Includes
  • libfac/charset/algfactor.h

    r0479e09 r4a81ec  
    33// emacs edit mode for this file is -*- C++ -*-
    44////////////////////////////////////////////////////////////
    5 // $Id: algfactor.h,v 1.1.1.1 1997-09-11 10:58:22 Singular Exp $
     5// $Id: algfactor.h,v 1.2 1997-09-12 07:19:39 Singular Exp $
    66////////////////////////////////////////////////////////////
    77
  • libfac/charset/charset.cc

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: charset.cc,v 1.2 1997-06-09 15:55:53 Singular Exp $";
     4static char * rcsid = "$Id: charset.cc,v 1.3 1997-09-12 07:19:40 Singular Exp $";
    55/////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    1212// Charset - Includes
    1313#include "csutil.h"
     14#include "algfactor.h"
     15#include "alg_factor.h"
     16// Some CC's need this:
     17#include "charset.h"
    1418
    1519#ifdef BASICSETDEBUG
     
    4751        b = lowestRank( QS );
    4852        cb = rank( b );
     53        DEBOUTLN(cout, "BasicSet: choose b  = ", b);
     54        DEBOUTLN(cout, "BasicSet: it's rank = ", cb);
    4955        BS=Union(CFList(b),BS);//BS.append( b );
    5056        if ( rank( b ) == 0 )
     
    6571}
    6672
    67  int
    68  checkok( const CFList & PS, CFList & FS2){
    69    CanonicalForm elem;
    70 
    71    for ( CFListIterator i=PS; i.hasItem(); i++){
    72      elem= i.getItem();
    73      for (CFListIterator j=FS2; j.hasItem(); j++){
    74        if (elem == j.getItem()){
     73int
     74checkok( 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()){
    7581        //      FS2= Difference(FS2,CFList(elem));
    7682        return 0;
    77        }
    78      }
    79    }
    80    return 1;
    81  }
     83      }
     84    }
     85  }
     86  return 1;
     87}
    8288
    8389#ifdef MCHARSETNDEBUG
     
    147153}
    148154
     155
     156CFList
     157mcharset( 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
    149168// the "original" extended characteristic set
    150169CFList
     
    311330}
    312331
     332static int
     333choosefrom(){
     334int choice;
     335    cout << "choose from qhi! ->";
     336    cin >> choice;
     337return choice;
     338}
     339
    313340static ListCFList
    314341msort( const ListCFList & list_to_sort ){
     
    333360
    334361ListCFList
    335 IrrCharSeries( const CFList &PS ){
     362IrrCharSeries( const CFList &PS, int opt ){
    336363  CanonicalForm reducible,reducible2;
    337364  CFList qs,cs,factorset,is,ts;
    338365  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
    340370
    341371  DEBOUTMSG(cout, rcsid);
     372//  cout << getCharacteristic() << endl;
    342373  for ( CFListIterator Ps=PS; Ps.hasItem(); Ps++ )
    343374    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;
    345381  while ( ! qhi.isEmpty() ) {
    346382    qhi=sort(qhi);
    347383    DEBOUTLN(cout, "qhi is: ", qhi);
     384#ifdef EXPERIMENTAL
     385    choice=choosefrom();
     386    cout <<"/n Choose " << choice << endl;
     387    qs= getItemNr(choice, qhi);
     388#else
    348389    qs=qhi.getFirst();
     390#endif
    349391    DEBOUTLN(cout, "qs  is: ", qs);
    350392    DEBOUTLN(cout, "ppi is: ", ppi);
     
    454496  }
    455497  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; }
    457503  }
    458504  else{ return ListCFList() ; }
     
    474520  CFList ts,as;
    475521  CanonicalForm elem;
    476   int ind=1,nr=0;
     522  int ind=1,nr=0, success=-1;
     523  CFListIterator i;
    477524
    478525  ja = 0;
    479526  DEBOUTLN(cout, "irras: called with: AS= ", AS);
    480   for ( CFListIterator i=AS; i.hasItem(); i++ ){
     527  for ( i=AS; i.hasItem(); i++ ){
    481528    elem = i.getItem();
    482529    nr += 1;
    483530    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);
    486538    // INTERRUPTHANDLER
    487539    if ( interrupt_handle() ) return CFList() ;
    488540    // INTERRUPTHANDLER
    489 
    490541    qs.removeFirst();
    491     DEBOUTLN(cout, "  = ", qs);
    492     //    if ( num(qs.getFirst().factor() / LC(qs.getFirst().factor())) !=
    493     //         num(elem / LC(elem))){
    494542    if ( (qs.length() >= 2 ) || (qs.getFirst().exp() > 1)){
    495543      DEBOUTLN(cout, "irras: Setting ind=0, ja= ", nr);
    496544      ja=nr; ind=0; reducible= elem;
    497       // return(qs); // ist das nicht genauso gut?
    498545      break;
    499546    }
    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    }
    505555    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      }
    513581    }
    514582  }
  • libfac/charset/charset.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: charset.h,v 1.2 1997-06-09 15:55:53 Singular Exp $
     4// $Id: charset.h,v 1.3 1997-09-12 07:19:41 Singular Exp $
    55////////////////////////////////////////////////////////////
    66
     
    1313CFList     BasicSet( const CFList &PS );
    1414CFList     CharSet( const CFList &PS );
     15CFList     mcharset( const CFList &PS, PremForm & Remembern );
     16int        checkok( const CFList & PS, CFList & FS2);
    1517/*BEGINPUBLIC*/
    1618CFList     MCharSetN( const CFList &PS, PremForm & Remembern );
    17 ListCFList IrrCharSeries( const CFList &PS );
     19ListCFList IrrCharSeries( const CFList &PS, int opt=0 );
    1820/*ENDPUBLIC*/
    1921
  • libfac/charset/csutil.cc

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: csutil.cc,v 1.2 1997-06-09 15:55:54 Singular Exp $";
     4static char * rcsid = "$Id: csutil.cc,v 1.3 1997-09-12 07:19:41 Singular Exp $";
    55/////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    1010#include <Factor.h>
    1111#include <SqrFree.h>
     12#include <helpstuff.h>
     13#include <homogfactor.h>
    1214// Charset - Includes
    1315#include "csutil.h"
    1416
    1517static bool
    16 lowerRank ( const CanonicalForm & f, const CanonicalForm & g )
     18lowerRank ( const CanonicalForm & f, const CanonicalForm & g, int & ind )
    1719{
    1820  int df, dg;
    1921  Variable vf = f.mvar(), vg = g.mvar();
    2022   
    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  }
    3435  return false;
    3536}
     
    4041  CFListIterator i = F;
    4142  CanonicalForm f;
     43  int ind=0;
    4244  if ( ! i.hasItem() )  return f;
    4345  f = i.getItem(); ++i;
    4446  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    }
    4664    ++i;
    4765  }
     
    85103CanonicalForm
    86104Prem ( 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;
    88106  int df, dg;
    89107  bool reord;
    90108  Variable vf, vg, v;
    91  
     109
    92110  if ( (vf = f.mvar()) < (vg = g.mvar()) ) return f;
    93111  else {
     
    103121      reord=true;
    104122    }
    105     cg = LC( gg, v );
    106123    dg = degree( gg, v );
    107124    df = degree( ff, v );
     
    111128      // cout << "Start gcd..." << endl;
    112129      test = gcd(l,LC(ff));
    113       // cout << "End gcd..." << endl;
     130      //cout << "gcd(" << l << "," << LC(ff) << ")= " << test << endl;
    114131      lu = l/test; lv = LC(ff)/test;
    115132      t = power(v,df-dg) * gg * lv;
     
    119136      df = degree( ff, v );
    120137    }
    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
     148static CanonicalForm
     149Sprem ( 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
     200CanonicalForm
     201divide( 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
     211static CanonicalForm
     212myfitting( 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;
    124233}
    125234
     
    131240//cout << "   PREM: Prem(" << rem << "," ;
    132241    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);
    139245}
    140246
     
    142248Prem( const CFList &AS, const CFList &L ){
    143249  CFList Output;
     250
    144251  for ( CFListIterator i=AS; i.hasItem(); i++ )
    145252    Output = Union(CFList(Prem(i.getItem(),L)), Output);
     253
    146254  return Output;
     255}
     256
     257static CanonicalForm
     258premasb( 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
     278CFList
     279remsetb( 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;
    147287}
    148288
     
    208348    testlist.append(CanonicalForm(Variable(J)));
    209349  }
     350 
     351  //  testlist = Union(Remembern.FS1, testlist); // add candidates
    210352
    211353  // remove already removed factors
     
    213355    testelem = j.getItem();
    214356    while ( 1 ){
    215       test = divremt(r,testelem,a,b);
     357      test = mydivremt(r,testelem,a,b);
    216358      if ( test && b == r.genZero() ) r = a;
    217359      else break;
    218360    }
    219361  }
    220  
     362
    221363  // Let's look if we have other canditates to remove
    222364  for ( j = testlist ; j.hasItem(); j++ ){
    223365    testelem = j.getItem();
     366//    if ( testelem != r && testelem != r.mvar() ){
    224367    if ( testelem != r ){
    225368      while ( 1 ){
    226369        test = divremt(r,testelem,a,b);
    227       test = divremt(r,testelem,a,b);
    228       if ( test && b == r.genZero() ) r = a;
    229370        if ( test && b == r.genZero() ){
    230             Remembern.FS2= Union(Remembern.FS2, CFList(testelem));
    231               r = a;
    232               if ( r == 1 ) break;
     371          Remembern.FS2= Union(Remembern.FS2, CFList(testelem));
     372          r = a;
     373          if ( r == 1 ) break;
    233374        }
    234375        else break;
     
    236377    }
    237378  }
     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;
    238383}
    239384
     
    253398      elem = j.getItem().factor();
    254399      if ( getNumVars(elem) > 0 )
    255         qs= Union(qs, CFList(num(elem/lc(elem))));
     400        qs= Union(qs, CFList(myfitting(elem)));
    256401    }
    257402  }
     
    267412  else {
    268413    leadcoeff = LC(f,lvar(f));
    269     if ( leadcoeff != 0 )
    270       return num(leadcoeff/lc(leadcoeff));
    271     else return leadcoeff;
     414    //    if ( leadcoeff != 0 )
     415    return myfitting(leadcoeff); //num(leadcoeff/lc(leadcoeff));
     416    //    else return leadcoeff;
    272417  }
    273418}
     
    352497//CF pfactor( ..... )
    353498
    354 //////////////////////////////////////////
    355 // for IrrCharSeries
     499// //////////////////////////////////////////
     500// // for IrrCharSeries
    356501
    357502#ifdef IRRCHARSERIESDEBUG
  • libfac/charset/csutil.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: csutil.h,v 1.2 1997-06-09 15:55:55 Singular Exp $
     4// $Id: csutil.h,v 1.3 1997-09-12 07:19:42 Singular Exp $
    55////////////////////////////////////////////////////////////
    66
     
    5454CFList         Prem( const CFList &AS, const CFList &L );
    5555/*ENDPUBLIC*/
     56CanonicalForm  divide( const CanonicalForm & ff, const CanonicalForm & f, const CFList & as);
     57CFList         remsetb( const CFList & ps, const CFList & as);
    5658CanonicalForm  lowestRank( const CFList & F );
    5759
     
    6466int            irreducible( const CFList & AS);
    6567CFList         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 );
     68void           select( const ListCFList & ppi, int length, ListCFList & ppi1,
     69                       ListCFList & ppi2);
     70bool           same( const CFList &A, const CFList &B );
     71bool           member( const CFList & cs, const ListCFList & pi );
    6972bool           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);
     73ListCFList     MyUnion( const ListCFList & a, const ListCFList &b );
     74ListCFList     MyDifference( const ListCFList & a, const CFList &b);
     75ListCFList     Minus( const ListCFList & a, const ListCFList &b);
    7376#endif /* INCL_CSUTIL_H */
    7477
  • libfac/charset/debug.cc

    r0479e09 r4a81ec  
    11/* Copyright 1997 Michael Messollen. All rights reserved. */
    22////////////////////////////////////////////////////////////
    3 // static char * rcsid = "$Id: debug.cc,v 1.1.1.1 1997-09-11 10:58:22 Singular Exp $ ";
     3// static char * rcsid = "$Id: debug.cc,v 1.2 1997-09-12 07:19:43 Singular Exp $ ";
    44////////////////////////////////////////////////////////////
    55static int deb_level;
  • libfac/charset/reorder.cc

    r0479e09 r4a81ec  
    1212/////////////////////////////////////////////////////////////
    1313// emacs edit mode for this file is -*- C++ -*-
    14 static char * rcsid = "$Id: reorder.cc,v 1.2 1997-06-09 15:55:56 Singular Exp $";
     14static char * rcsid = "$Id: reorder.cc,v 1.3 1997-09-12 07:19:44 Singular Exp $";
    1515////////////////////////////////////////////////////////////
    1616// FACTORY - Includes
     
    1818// Factor - Includes
    1919#include <tmpl_inst.h>
     20#include "homogfactor.h"
    2021// Charset - Includes
    21 #include "homogfactor.h"
     22
     23// some CC's need this:
     24#include "reorder.h"
    2225
    2326#ifdef REORDERDEBUG
     
    349352}
    350353
     354static CFFList
     355swapvar( 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
    351363// a library function: we reorganize the global variable ordering
    352364CFList
     
    368380}
    369381
     382CFFList
     383reorder( 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
    370400ListCFList
    371401reorder(const Varlist & betterorder, const ListCFList & Q){
  • libfac/charset/reorder.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: reorder.h,v 1.2 1997-06-09 15:55:56 Singular Exp $
     4// $Id: reorder.h,v 1.3 1997-09-12 07:19:45 Singular Exp $
    55////////////////////////////////////////////////////////////
    66#ifndef INCL_REORDER_H
     
    3838//
    3939CFList reorder( const Varlist & betterorder, const CFList & PS);
     40CFFList reorder( const Varlist & betterorder, const CFFList & PS);
    4041ListCFList reorder(const Varlist & betterorder, const ListCFList & Q);
    4142/*ENDPUBLIC*/
  • libfac/configure

    r0479e09 r4a81ec  
    521521libfac_name="\"Factorization and characteristic sets library\""
    522522
    523 libfac_version="0.2.4"
    524 
    525 libfac_date="\"May 30 1997\""
     523libfac_version="0.3.0"
     524
     525libfac_date="\"Sep 11 1997\""
    526526
    527527libfac_author="\"M. Messollen\""
     
    556556if test "$with_Singular" = yes; then
    557557  cat >> confdefs.h <<\EOF
    558 #define HAVE_SINGULAR 1
     558#define SINGULAR 1
     559EOF
     560
     561  cat >> confdefs.h <<\EOF
     562#define NOSTREAMIO 1
    559563EOF
    560564
     
    586590LDFLAGS="-L. ${LDFLAGS}"
    587591
    588 if test "$with_debug" = yes; then
    589   CXXFLAGS="-g"
    590 else
    591   CXXFLAGS="-O"
    592   cat >> confdefs.h <<\EOF
     592if 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
    593599#define NDEBUG 1
    594600EOF
    595  
     601
     602  fi 
    596603fi
    597604
     
    645652#endif
    646653EOF
    647 if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
     654if { 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
    648655  ac_cv_prog_gxx=yes
    649656else
     
    694701  CXXCPP="${CXX-g++} -E"
    695702  cat > conftest.$ac_ext <<EOF
    696 #line 697 "configure"
     703#line 704 "configure"
    697704#include "confdefs.h"
    698705#include <stdlib.h>
    699706EOF
    700707ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    701 { (eval echo configure:702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     708{ (eval echo configure:709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    702709ac_err=`grep -v '^ *+' conftest.out`
    703710if test -z "$ac_err"; then
     
    808815else
    809816  cat > conftest.$ac_ext <<EOF
    810 #line 811 "configure"
     817#line 818 "configure"
    811818#include "confdefs.h"
    812819#include <factory.h>
    813820EOF
    814821ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    815 { (eval echo configure:816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     822{ (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    816823ac_err=`grep -v '^ *+' conftest.out`
    817824if test -z "$ac_err"; then
     
    841848else
    842849  cat > conftest.$ac_ext <<EOF
    843 #line 844 "configure"
     850#line 851 "configure"
    844851#include "confdefs.h"
    845852
     
    891898; return 0; }
    892899EOF
    893 if { (eval echo configure:894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     900if { (eval echo configure:901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    894901  rm -rf conftest*
    895902  ac_cv_c_const=yes
     
    917924for ac_kw in inline __inline__ __inline; do
    918925  cat > conftest.$ac_ext <<EOF
    919 #line 920 "configure"
     926#line 927 "configure"
    920927#include "confdefs.h"
    921928
     
    925932; return 0; }
    926933EOF
    927 if { (eval echo configure:928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     934if { (eval echo configure:935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    928935  rm -rf conftest*
    929936  ac_cv_c_inline=$ac_kw; break
     
    950957
    951958if 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
    956965  fi
    957966  CXXTEMPLFLAGS="-fno-implicit-templates"
  • libfac/configure.in

    r0479e09 r4a81ec  
    1515libfac_name="\"Factorization and characteristic sets library\""
    1616AC_SUBST(libfac_version)
    17 libfac_version="0.2.4"
     17libfac_version="0.3.0"
    1818AC_SUBST(libfac_date)
    19 libfac_date="\"May 30 1997\""
     19libfac_date="\"Sep 11 1997\""
    2020AC_SUBST(libfac_author)
    2121libfac_author="\"M. Messollen\""
     
    4646
    4747if test "$with_Singular" = yes; then
    48   AC_DEFINE(HAVE_SINGULAR)
     48  AC_DEFINE(SINGULAR)
     49  AC_DEFINE(NOSTREAMIO)
    4950  if test "$with_debug" = yes; then
    5051     targetname="libsingfac-g"
     
    7778LDFLAGS="-L. ${LDFLAGS}"
    7879
    79 if test "$with_debug" = yes; then
    80   CXXFLAGS="-g"
    81 else
    82   CXXFLAGS="-O"
    83   AC_DEFINE(NDEBUG) 
     80if 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 
    8488fi
    8589
     
    126130dnl
    127131if 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
    132138  fi
    133139  CXXTEMPLFLAGS="-fno-implicit-templates"
  • libfac/factor.h

    r0479e09 r4a81ec  
    2020
    2121//// Note: InternalSqrFree does only the work needed for factorization.
    22 // int SqrFreeTest( const CanonicalForm & r, int opt=1) ;
    2322// CFFList SqrFree( const CanonicalForm & f ) ;
    24 CFFList InternalSqrFree( const CanonicalForm & f ) ;
    2523
    2624typedef List<CFList> ListCFList;
     
    5048CFList         Prem( const CFList &AS, const CFList &L );
    5149CFList     MCharSetN( const CFList &PS, PremForm & Remembern );
    52 ListCFList IrrCharSeries( const CFList &PS );
     50ListCFList IrrCharSeries( const CFList &PS, int opt=0 );
    5351
    5452// the next three give you a heuristically optimal reorderd list of the
     
    7977//
    8078CFList reorder( const Varlist & betterorder, const CFList & PS);
     79CFFList reorder( const Varlist & betterorder, const CFFList & PS);
    8180ListCFList reorder(const Varlist & betterorder, const ListCFList & Q);
    8281
     82
    8383#endif /* FACTOR_H */
  • libfac/factor/Factor.cc

    r0479e09 r4a81ec  
    11/* Copyright 1996 Michael Messollen. All rights reserved. */
    22///////////////////////////////////////////////////////////////////////////////
    3 static char * rcsid = "$Id: Factor.cc,v 1.2 1997-06-09 15:55:58 Singular Exp $ ";
     3static char * rcsid = "$Id: Factor.cc,v 1.3 1997-09-12 07:19:46 Singular Exp $ ";
    44static 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.";
    55///////////////////////////////////////////////////////////////////////////////
     
    1414#include "homogfactor.h"
    1515#include "interrupt.h"
     16// some CC's need this:
     17#include "Factor.h"
     18
     19#ifdef SINGULAR
     20#  define HAVE_SINGULAR
     21#endif
    1622
    1723#ifdef FACTORDEBUG
     
    3036TIMING_DEFINE_PRINT(truefactor_time);
    3137
    32 extern int libfac_interruptflag;
    33 #ifdef HAVE_SINGULAR
    34 extern void WerrorS(char *);
    35 #endif
    3638
    3739///////////////////////////////////////////////////////////////
     
    139141// Return the list of factors.                               //
    140142///////////////////////////////////////////////////////////////
    141 CFFList
     143static CFFList
    142144not_monic( const CFFList & TheList, const CanonicalForm & ltt, const CanonicalForm & F, int levelF){
    143145  CFFList Returnlist,IntermediateList;
     
    210212          else {
    211213#ifdef HAVE_SINGULAR
     214            extern void WerrorS(char *);
    212215            WerrorS("libfac: ERROR: not_monic1: case lt is a sum.");
    213216#else
     
    227230        else {
    228231#ifdef HAVE_SINGULAR
     232          extern void WerrorS(char *);
    229233          WerrorS("libfac: ERROR: not_monic2: case lt is a sum.");
    230234#else
     
    308312// field getCharacteristik()^Extension.                      //
    309313///////////////////////////////////////////////////////////////
    310 static CanonicalForm
     314CanonicalForm
    311315generate_mipo( int degree_of_Extension , const Variable & Extension ){
    312316  FFRandom gen;
     
    316320    else {
    317321#ifdef HAVE_SINGULAR
     322    extern void WerrorS(char *);
    318323    WerrorS("libfac: evaluate: Extension not inFF() or inGF() !");
    319324#else
     
    387392    else {
    388393#ifdef HAVE_SINGULAR
     394      extern void WerrorS(char *);
    389395      WerrorS("libfac: spezializePoly ERROR: Working over given extension-field not yet implemented!");
    390396#else
     
    421427  else {
    422428#ifdef HAVE_SINGULAR
     429    extern void WerrorS(char *);
    423430    WerrorS("libfac: evaluate: Extension not inFF() or inGF() !");
    424431#else
     
    428435    FFRandom gen; }}
    429436  REvaluation k(1,n,gen);
     437  k.nextpoint();
    430438  for ( int i=1; i<=maxtries ; i++){
    431     //    k.nextpoint();
     439    // k.nextpoint();
    432440    SFormList Substitutionlist;
    433441    for ( int j=1; j<=n; j++ )
     
    496504///////////////////////////////////////////////////////////////
    497505CFFList
    498 Factorized( const CanonicalForm & F, const Variable & alpha, int Mainvar=0){
     506Factorized( const CanonicalForm & F, const Variable & alpha, int Mainvar){
    499507  CanonicalForm f,lt,ff,ffuni;
    500508  Variable Extension=alpha;
     
    599607    if (success == 0 ){ // No spezialisation could be found
    600608#ifdef HAVE_SINGULAR
     609      extern void WerrorS(char *);
    601610      WerrorS("libfac: Factorize: ERROR: Not able to find a valid specialization!");   
    602611#else
     
    684693///////////////////////////////////////////////////////////////
    685694CFFList
    686 Factorize( const CanonicalForm & F, int is_SqrFree=0 ){
     695Factorize( const CanonicalForm & F, int is_SqrFree ){
    687696  CFFList Outputlist,SqrFreeList,Intermediatelist,Outputlist2;
    688697  ListIterator<CFFactor> i,j;
     
    700709  if ( getCharacteristic() == 0 ) { // char == 0
    701710    TIMING_START(factorize_time);
     711    //cout << "Factoring in char=0 of " << F << " = " << Outputlist << endl;
    702712    Outputlist= factorize(F);
    703     //  cout << "Factoring in char=0 of " << F << " = " << Outputlist << endl;
    704713    // Factorization in char=0 doesn't sometimes return at least two elements!!!
    705714    if ( getNumVars(Outputlist.getFirst().factor()) != 0 )
  • libfac/factor/Factor.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: Factor.h,v 1.2 1997-06-09 15:55:59 Singular Exp $
     4// $Id: Factor.h,v 1.3 1997-09-12 07:19:47 Singular Exp $
    55///////////////////////////////////////////////////////////////////////////////
    66#ifndef FACTOR_H
    77#define FACTOR_H
     8CanonicalForm generate_mipo( int degree_of_Extension , const Variable & Extension );
    89CFFList Factorized( const CanonicalForm & F, const Variable & alpha, int Mainvar=0);
    910/*BEGINPUBLIC*/
  • libfac/factor/MVMultiHensel.cc

    r0479e09 r4a81ec  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1.2 1997-06-09 15:56:00 Singular Exp $";
     4// static char * rcsid = "$Id: MVMultiHensel.cc,v 1.3 1997-09-12 07:19:48 Singular Exp $";
    55///////////////////////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    99#include "tmpl_inst.h"
    1010#include "helpstuff.h"
     11// some CC's need this:
     12#include "MVMultiHensel.h"
     13
     14#ifdef SINGULAR
     15#  define HAVE_SINGULAR
     16#endif
    1117
    1218#ifdef HENSELDEBUG
  • libfac/factor/MVMultiHensel.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: MVMultiHensel.h,v 1.2 1997-06-09 15:56:00 Singular Exp $
     4// $Id: MVMultiHensel.h,v 1.3 1997-09-12 07:19:48 Singular Exp $
    55/////////////////////////////////////////////////////////////
    66#ifndef MULTIHENSEL_H
  • libfac/factor/SqrFree.cc

    r0479e09 r4a81ec  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 static char * rcsid = "$Id: SqrFree.cc,v 1.2 1997-06-09 15:56:02 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.";
     4static char * rcsid = "$Id: SqrFree.cc,v 1.3 1997-09-12 07:19:50 Singular Exp $";
     5static 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.";
    66///////////////////////////////////////////////////////////////////////////////
    77// FACTORY - Includes
     
    1010#include "tmpl_inst.h"
    1111#include "helpstuff.h"
     12// some CC's need this:
     13#include "SqrFree.h"
     14
     15#ifdef SINGULAR
     16#  define HAVE_SINGULAR
     17#endif
    1218
    1319#ifdef SQRFREEDEBUG
     
    2228TIMING_DEFINE_PRINT(gcd_time);
    2329
    24 #ifdef HAVE_SINGULAR
    25 extern void WerrorS(char *);
    26 #endif 
    27 
    28 // forward declaration:
    29 CFFList SqrFree( const CanonicalForm & r );
    30 CFFList InternalSqrFree( const CanonicalForm & r );
    3130
    3231static inline CFFactor
     
    5251PthRoot( const CanonicalForm & f ){
    5352  CanonicalForm RES, R = f;
    54   int n= getNumVars(R), p= getCharacteristic();
     53  int n= max(level(R),getNumVars(R)), p= getCharacteristic();
    5554 
    5655  if (n==0){ // constant
     
    7877///////////////////////////////////////////////////////////////
    7978int
    80 SqrFreeTest( const CanonicalForm & r, int opt=1){
     79SqrFreeTest( const CanonicalForm & r, int opt){
    8180  CanonicalForm f=r, g;
    8281  int n=level(f);
     
    126125  }
    127126#ifdef HAVE_SINGULAR
     127  extern void WerrorS(char *);
    128128  WerrorS("libfac: ERROR: SqrFreeTest: we should never fall trough here!");
    129129#else
     
    197197      g=swapvar(f,k,n) ; g = g.deriv();
    198198      if ( ! g.isZero() ){ // can`t be Pth root
    199         CFFList Outputlist2= SqrFreed(swapvar(f,k,n));
     199        CFFList Outputlist2= SqrFreed(swapvar(f,k,n)); 
    200200        for (CFFListIterator inter=Outputlist2; inter.hasItem(); inter++){
    201201          Outputlist= myappend(Outputlist, CFFactor(swapvar(inter.getItem().factor(),k,n), inter.getItem().exp()));
     
    252252  }
    253253#ifdef HAVE_SINGULAR
     254  extern void WerrorS(char *);
    254255  WerrorS("libfac: ERROR: SqrFreed: we should never fall trough here!");
    255256#else
  • libfac/factor/SqrFree.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: SqrFree.h,v 1.2 1997-06-09 15:56:03 Singular Exp $
     4// $Id: SqrFree.h,v 1.3 1997-09-12 07:19:51 Singular Exp $
    55///////////////////////////////////////////////////////////////////////////////
    66#ifndef SQRFREE_H
     
    88
    99/*BEGINPUBLIC*/
    10 // int SqrFreeTest( const CanonicalForm & r, int opt=1) ;
    1110// CFFList SqrFree( const CanonicalForm & f ) ;
     11/*ENDPUBLIC*/
    1212CFFList InternalSqrFree( const CanonicalForm & f ) ;
    13 /*ENDPUBLIC*/
    14 int SqrFreeTest( const CanonicalForm & r, int opt=1) ;
     13int     SqrFreeTest( const CanonicalForm & r, int opt=1) ;
    1514CFFList SqrFree( const CanonicalForm & f ) ;
    1615#endif /* SQRFREE_H */
  • libfac/factor/Truefactor.cc

    r0479e09 r4a81ec  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 //static char * rcsid = "@(#) $Id: Truefactor.cc,v 1.2 1997-06-09 15:56:04 Singular Exp $";
     4//static char * rcsid = "@(#) $Id: Truefactor.cc,v 1.3 1997-09-12 07:19:52 Singular Exp $";
    55///////////////////////////////////////////////////////////////////////////////
    66// Factory - Includes
     
    99#include "tmpl_inst.h"
    1010#include "helpstuff.h"
     11// some CC's need this:
     12#include "Truefactor.h"
     13
     14#ifdef SINGULAR
     15#  define HAVE_SINGULAR
     16#endif
    1117
    1218#ifdef TRUEFACTORDEBUG
     
    1925#include "timing.h"
    2026
    21 #ifdef HAVE_SINGULAR
    22 extern void WerrorS(char *);
    23 #endif
    2427///////////////////////////////////////////////////////////////
    2528// generate all different k-subsets of the set with n        //
     
    233236// Check if poly f is in Fp (returns true) or in Fp(a)       //
    234237///////////////////////////////////////////////////////////////
    235 bool
     238static bool
    236239is_in_Fp( const CanonicalForm & f ){
    237240  if ( f.inCoeffDomain() )
     
    278281    if ( PossibleFactors.length() < n ) { // a little check
    279282#ifdef HAVE_SINGULAR
     283      extern void WerrorS(char *);
    280284      WerrorS("libfac: ERROR: TakeNorms less then two items remaining!");
    281285#else
     
    320324      else{
    321325#ifdef HAVE_SINGULAR
     326        extern void WerrorS(char *);
    322327        WerrorS("libfac: TakeNorms: somethings wrong with remaining factors!");
    323328#else
  • libfac/factor/Truefactor.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: Truefactor.h,v 1.2 1997-06-09 15:56:05 Singular Exp $
     4// $Id: Truefactor.h,v 1.3 1997-09-12 07:19:53 Singular Exp $
    55///////////////////////////////////////////////////////////////////////////////
    66#ifndef TRUEFACTOR_H
  • libfac/factor/class.cc

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "@(#) $Id: class.cc,v 1.2 1997-06-09 15:56:05 Singular Exp $";
     4// static char * rcsid = "@(#) $Id: class.cc,v 1.3 1997-09-12 07:19:53 Singular Exp $";
    55////////////////////////////////////////////////////////////
    66
     
    3333}
    3434
     35#ifndef NOSTREAMIO
    3536template <class T>
    3637void Substitution<T>::print ( ostream& s ) const
     
    3839        s << "(" << factor() << ")^" << exp();
    3940}
     41#endif
    4042
    4143////////////////////////////////////////////////////////////
  • libfac/factor/class.h

    r0479e09 r4a81ec  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: class.h,v 1.3 1997-08-01 10:51:28 Singular Exp $
     4// $Id: class.h,v 1.4 1997-09-12 07:19:54 Singular Exp $
    55///////////////////////////////////////////////////////////////////////////////
    66#ifndef INCL_CLASS_H
     
    1212#include <iostream.h>
    1313#endif
    14 
    1514
    1615template <class T>
     
    4140        return os;
    4241    }
    43 #endif   
     42#endif
    4443};
    4544
     
    5352/*
    5453$Log: not supported by cvs2svn $
    55 Revision 1.2  1997/06/09 15:56:06  Singular
    56 * hannes/michael: libfac 0.2.4
    57 
    5854Revision 1.2  1997/04/25 22:21:26  michael
    5955Version for libfac-0.2.1
  • libfac/factor/debug.cc

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: debug.cc,v 1.2 1997-06-09 15:56:07 Singular Exp $ ";
     4// static char * rcsid = "$Id: debug.cc,v 1.3 1997-09-12 07:19:55 Singular Exp $ ";
    55////////////////////////////////////////////////////////////
    66static int deb_level;
  • libfac/factor/debug.h

    r0479e09 r4a81ec  
    11/* Copyright 1996 Michael Messollen. All rights reserved. */
    22////////////////////////////////////////////////////////////
    3 // static char * rcsid = "$Id: debug.h,v 1.2 1997-06-09 15:56:08 Singular Exp $" ;
     3// static char * rcsid = "$Id: debug.h,v 1.3 1997-09-12 07:19:55 Singular Exp $" ;
    44////////////////////////////////////////////////////////////
    55// It is possible to include this file multiple times for different
     
    4545(stream << deb_level_msg, stream.flush())
    4646#define DEBOUT(stream,msg,object) \
    47 (stream << msg << object, stream.flush())
     47(stream << deb_level_msg << msg << object, stream.flush())
    4848#define DEBOUTLN(stream,msg,object) \
    4949(stream << deb_level_msg << msg << object << endl)
  • libfac/factor/helpstuff.cc

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: helpstuff.cc,v 1.2 1997-06-09 15:56:08 Singular Exp $";
     4// static char * rcsid = "$Id: helpstuff.cc,v 1.3 1997-09-12 07:19:56 Singular Exp $";
    55////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    88// Factor - Includes
    99#include "tmpl_inst.h"
     10// some CC's need this:
     11#include "helpstuff.h"
    1012
    1113bool
     
    1820  else { b=aa; }
    1921  return retvalue;
     22}
     23
     24void
     25mydivrem( 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; }
    2032}
    2133
     
    6072
    6173int
    62 Powerup( const int base , const int exp=1){
     74Powerup( const int base , const int exp){
    6375  int retvalue=1;
    6476  if ( exp == 0 )  return retvalue ;
  • libfac/factor/helpstuff.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: helpstuff.h,v 1.2 1997-06-09 15:56:09 Singular Exp $
     4// $Id: helpstuff.h,v 1.3 1997-09-12 07:19:57 Singular Exp $
    55////////////////////////////////////////////////////////////
    66#ifndef HELPSTUFF_H
    77#define HELPSTUFF_H
    88bool mydivremt ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
     9void mydivrem( const CanonicalForm& f, const CanonicalForm& g, CanonicalForm& a, CanonicalForm& b );
    910///////////////////////////////////////////////////////////////
    1011// Now some procedures used in MVMultiHensel and in Truefactors
  • libfac/factor/homogfactor.cc

    r0479e09 r4a81ec  
    11/* Copyright 1997 Michael Messollen. All rights reserved. */
    22////////////////////////////////////////////////////////////
    3 // static char * rcsid = "$Id: homogfactor.cc,v 1.2 1997-06-09 15:56:10 Singular Exp $ ";
     3// static char * rcsid = "$Id: homogfactor.cc,v 1.3 1997-09-12 07:19:57 Singular Exp $ ";
    44////////////////////////////////////////////////////////////
    55// FACTORY - Includes
     
    88#include "tmpl_inst.h"
    99#include "Factor.h"
     10// some CC's need it:
     11#include "homogfactor.h"
    1012
    1113#ifdef HFACTORDEBUG
  • libfac/factor/homogfactor.h

    r0479e09 r4a81ec  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: homogfactor.h,v 1.2 1997-06-09 15:56:10 Singular Exp $
     4// $Id: homogfactor.h,v 1.3 1997-09-12 07:19:58 Singular Exp $
    55///////////////////////////////////////////////////////////////////////////////
    66#ifndef HFACTOR_H
    77#define HFACTOR_H
    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 );
     8CFList  get_Terms( const CanonicalForm & f );
     9bool    is_homogeneous( const CanonicalForm & f);
     10CFFList HomogFactor( const CanonicalForm & g, const Variable  & minpoly, const int Mainvar );
    1111#endif /* HFACTOR_H */
    1212
  • libfac/factor/timing.h

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: timing.h,v 1.2 1997-06-09 15:56:12 Singular Exp $";
     4// static char * rcsid = "$Id: timing.h,v 1.3 1997-09-12 07:19:59 Singular Exp $";
    55////////////////////////////////////////////////////////////
    66// It is possible to include this file multiple times for different
  • libfac/factor/tmpl_inst.cc

    r0479e09 r4a81ec  
    22////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: tmpl_inst.cc,v 1.2 1997-06-09 15:56:12 Singular Exp $
     4// $Id: tmpl_inst.cc,v 1.3 1997-09-12 07:20:00 Singular Exp $
    55////////////////////////////////////////////////////////////
    66
     
    8282template class Array<Variable>;
    8383
     84// for database
     85#ifdef HAVE_DATABASE
     86template class List<CFFList>;
     87template class ListIterator<CFFList>;
     88#endif /* HAVE_DATABASE */
    8489////////////////////////////////////////////////////////////
    8590/*
  • libfac/factor/tmpl_inst.h

    r0479e09 r4a81ec  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: tmpl_inst.h,v 1.2 1997-06-09 15:56:14 Singular Exp $
     4// $Id: tmpl_inst.h,v 1.3 1997-09-12 07:20:01 Singular Exp $
    55///////////////////////////////////////////////////////////////////////////////
    66#ifndef TMPL_INST_H
     
    3737typedef Array<int> Intarray;
    3838
    39 typedef Array<CFArray> CCFArray ;
    40 typedef Array<CCFArray> CCCFArray ;
     39#ifdef HAVE_DATABASE
     40typedef List<CFFList> ListCFFList;
     41typedef ListIterator<CFFList> ListCFFListIterator;
     42#endif
     43
     44//typedef Array<CFArray> CCFArray ;
     45//typedef Array<CCFArray> CCCFArray ;
    4146
    4247#endif /* TMPL_INST_H */
  • libfac/factor/version.cc

    r0479e09 r4a81ec  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // $Id: version.cc,v 1.2 1997-06-09 15:56:14 Singular Exp $
     4// $Id: version.cc,v 1.3 1997-09-12 07:20:02 Singular Exp $
    55static char * rcsid = "@(#) libfac version 0.2.4 [May 29 1997] (C) 1996-97 M. Messollen";
    66///////////////////////////////////////////////////////////////////////////////
    77
    88char * libfac_name = "Factorization and characteristic sets library";
    9 char * libfac_version = "0.2.4";
    10 char * libfac_date = "May 30 1997";
     9char * libfac_version = "0.3.0";
     10char * libfac_date = "Sep 11 1997";
    1111char * libfac_author = "M. Messollen";
    1212
  • libfac/header.tpl

    r0479e09 r4a81ec  
    2626.INCLUDE factor/helpstuff.h
    2727.INCLUDE factor/tmpl_inst.h
     28.INCLUDE factor/homogfactor.h
     29.INCLUDE factor/debug.h
     30.INCLUDE factor/timing.h
    2831
    2932////////////////////////////////////////
     
    3437.INCLUDE charset/reorder.h
    3538
     39.INCLUDE charset/algfactor.h
     40
    3641#endif /* FACTOR_H */
  • libfac/test.cc

    r0479e09 r4a81ec  
    1 //static char rcsid[] = "$Id: test.cc,v 1.2 1997-06-09 15:55:50 Singular Exp $";
     1//static char rcsid[] = "$Id: test.cc,v 1.3 1997-09-12 07:19:34 Singular Exp $";
    22///////////////////////////////////////////////////////////////////////////////
    33// Factor - Includes
  • libfac/testcs.cc

    r0479e09 r4a81ec  
    1 // $Id: testcs.cc,v 1.1.1.1 1997-09-11 10:58:16 Singular Exp $
     1// $Id: testcs.cc,v 1.2 1997-09-12 07:19:35 Singular Exp $
    22
    33#include <factory.h>
Note: See TracChangeset for help on using the changeset viewer.