Changeset 4a81ec in git for libfac/charset


Ignore:
Timestamp:
Sep 12, 1997, 9:20:02 AM (27 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
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/charset
Files:
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • 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*/
Note: See TracChangeset for help on using the changeset viewer.