Changeset 49f1f45 in git


Ignore:
Timestamp:
Nov 20, 2007, 11:08:40 AM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
62f8cca6dc508c925bc4d657aea450dafba04fb9
Parents:
b1d37f6a1e89cd93b4ecab9f73e8d297d77180c0
Message:
*hannes: EZGCD for char p


git-svn-id: file:///usr/local/Singular/svn/trunk@10429 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
factory
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • factory/GNUmakefile.in

    rb1d37f r49f1f45  
    11# @configure_input@
    2 # $Id: GNUmakefile.in,v 1.52 2007-11-14 16:00:28 Singular Exp $
     2# $Id: GNUmakefile.in,v 1.53 2007-11-20 10:08:02 Singular Exp $
    33
    44#
     
    161161                fac_util.cc \
    162162                ffops.cc \
     163                ffreval.cc \
    163164                gf_tabutil.cc \
    164165                gfops.cc \
     
    229230                fac_util.h \
    230231                ffops.h \
     232                ffreval.h \
    231233                ftmpl_array.h \
    232234                ftmpl_factor.h \
  • factory/cf_defs.h

    rb1d37f r49f1f45  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_defs.h,v 1.12 2007-10-31 08:40:52 Singular Exp $ */
     2/* $Id: cf_defs.h,v 1.13 2007-11-20 10:08:02 Singular Exp $ */
    33
    44#ifndef INCL_CF_DEFS_H
     
    3434const int SW_FAC_QUADRATICLIFT = 5;
    3535const int SW_USE_EZGCD = 6;
    36 const int SW_USE_SPARSEMOD = 7;
    37 const int SW_USE_NTL=8;
    38 const int SW_USE_NTL_GCD_0=9;
    39 const int SW_USE_NTL_GCD_P=10;
    40 const int SW_USE_NTL_SORT=11;
    41 const int SW_USE_CHINREM_GCD=12;
    42 const int SW_USE_GCD_P=13;
     36const int SW_USE_EZGCD_P = 7;
     37const int SW_USE_SPARSEMOD = 8;
     38const int SW_USE_NTL=9;
     39const int SW_USE_NTL_GCD_0=10;
     40const int SW_USE_NTL_GCD_P=11;
     41const int SW_USE_NTL_SORT=12;
     42const int SW_USE_CHINREM_GCD=13;
     43const int SW_USE_GCD_P=14;
    4344//}}}
    4445
  • factory/cf_gcd.cc

    rb1d37f r49f1f45  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_gcd.cc,v 1.54 2007-10-31 08:40:52 Singular Exp $ */
     2/* $Id: cf_gcd.cc,v 1.55 2007-11-20 10:08:03 Singular Exp $ */
    33
    44#include <config.h>
     
    1515#include "fac_util.h"
    1616#include "ftmpl_functions.h"
     17#include "ffreval.h"
    1718
    1819#ifdef HAVE_NTL
     
    490491  if( gcd_avoid_mtaildegree ( fc, gc, d1 ) )
    491492      return d1;
     493  bool fc_isUnivariate=fc.isUnivariate();
    492494  if ( getCharacteristic() != 0 )
    493495  {
    494     if (isOn(SW_USE_GCD_P))
     496    if (isOn( SW_USE_EZGCD_P ) && (!fc_isUnivariate))
     497    {
     498      if ( pe == 1 )
     499        fc = fin_ezgcd( fc, gc );
     500      else if ( pe > 0 )// no variable at position 1
     501      {
     502        fc = replacevar( fc, Variable(pe), Variable(1) );
     503        gc = replacevar( gc, Variable(pe), Variable(1) );
     504        fc = replacevar( fin_ezgcd( fc, gc ), Variable(1), Variable(pe) );
     505      }
     506      else
     507      {
     508        pe = -pe;
     509        fc = swapvar( fc, Variable(pe), Variable(1) );
     510        gc = swapvar( gc, Variable(pe), Variable(1) );
     511        fc = swapvar( fin_ezgcd( fc, gc ), Variable(1), Variable(pe) );
     512      }
     513    }
     514    else if (isOn(SW_USE_GCD_P))
    495515    {
    496516      fc=newGCD(fc,gc);
     
    505525    }
    506526  }
    507   else if (!fc.isUnivariate())
     527  else if (!fc_isUnivariate)
    508528  {
    509529    if ( isOn( SW_USE_EZGCD ) )
  • factory/cf_gcd_charp.cc

    rb1d37f r49f1f45  
    1 #include <factory.h>
     1#include "config.h"
     2#include <stdio.h>
    23#ifndef NOSTREAMIO
    3 #include <stdio.h>
    44#include <iostream.h>
    55#endif
    66#include <math.h>
     7#include <cf_factory.h>
     8#include <variable.h>
     9#include <canonicalform.h>
     10#include <cf_iter.h>
     11#include <cf_random.h>
     12#include <cf_algorithm.h>
     13#include <cf_map.h>
    714
    815static CanonicalForm contentWRT(const CanonicalForm & F, const int lev);
    9 static int degWRT(const CanonicalForm & F, const int lev);
     16static int degWRT(CanonicalForm F, const int lev);
    1017static CanonicalForm lcoefWRT( const CanonicalForm & F, const int lev);
    1118static CanonicalForm newtonInterp(CFList &alpha, CFList &u, const Variable & x);
     
    2027
    2128
    22 static CanonicalForm
     29static CanonicalForm
     30contentWRT0(const CanonicalForm & F, const int lev, const int lev0)
     31// Computes the content of a polynomial, considering the variables of level
     32// larger than lev as as parameters.
     33{
     34  if(F.inBaseDomain() || (F.mvar().level() <= lev))
     35  {
     36    return(1);
     37  }
     38  else
     39  {
     40    if (F.isUnivariate())
     41    {
     42      return(F);
     43    }
     44    else
     45    {
     46      CanonicalForm pol;
     47      CFIterator i = CFIterator(F);
     48      CanonicalForm c = 0;
     49      for(; i.hasTerms(); i++)
     50      {
     51        CanonicalForm cc=i.coeff();
     52        if (cc.level() > lev0)
     53          pol = contentWRT0(cc, lev, lev0-1 );
     54        else
     55          pol = contentWRT(cc, lev -1);
     56        c = gcd(c, pol);
     57        if(c.isOne())
     58        {
     59          return c;
     60        }
     61      }
     62      return c;
     63    }
     64  }
     65}
     66
     67static CanonicalForm
    2368contentWRT(const CanonicalForm & F, const int lev)
    2469// Computes the content of a polynomial, considering the variables of level
    2570// larger than lev as as parameters.
    2671{
     72  //if (lev <0)
     73  //  cout << "contentWRT:" <<F << " " << lev <<"\n";//printf("level=%d\n",lev);
    2774  //int debug = 0;
    2875  //if(debug == 1)cout << "contentWRT input - F:  " << F << " lev: " << lev << endl;
    29   CanonicalForm pol;
    30   if(F.mvar().level() <= lev){
     76  if(F.inBaseDomain() || (F.mvar().level() <= lev))
     77  {
    3178    //if(debug == 1)cout << "output 1:" << F << endl;
    3279    return(1);
    33   } else {
    34     if (F.isUnivariate() == 1){
     80  }
     81  else
     82  {
     83    if (F.isUnivariate())
     84    {
    3585      //if(debug == 1)cout << "output 2:" << F << endl;
    3686      return(F);
    37     } else {
    38       CFIterator i = CFIterator(F, lev);
     87    }
     88    else
     89    {
     90      CanonicalForm pol;
     91      CFIterator i = CFIterator(F);
    3992      CanonicalForm c = 0;
    40       for(; i.hasTerms(); i++){
    41         pol = contentWRT(i.coeff(), lev - 1);
     93      for(; i.hasTerms(); i++)
     94      {
     95        CanonicalForm cc=i.coeff();
     96        if (cc.level() > lev)
     97          pol = contentWRT0(cc, lev, cc.level());
     98        else
     99          pol = contentWRT(i.coeff(), lev - 1);
    42100        //if(debug == 1)cout << "c: " << c << " - pol : " << pol << endl;
    43101        c = gcd(c, pol);
    44102        //if(debug == 1)cout << "c temp:" << c << endl;
    45         if(c.isOne()){
     103        if(c.isOne())
     104        {
    46105          //if(debug == 1)cout << "output 3:" << c << endl;
    47106          return c;
     
    55114
    56115// Degree of F wrt all variables of level smaller than or equal to lev
    57 static int
    58 degWRT(const CanonicalForm & F, const int lev)
     116static int degWRT(CanonicalForm F, const int lev)
     117{
     118  int deg = F.degree(lev);
     119  for(int i = lev; i >= 1; i--)
     120  {
     121    F = F.LC(i);
     122    deg = deg + F.degree(i - 1);
     123  }
     124  return deg;
     125}
     126
     127// Leading coefficient of F wrt all variables of level smaller than or equal to lev.
     128static CanonicalForm lcoefWRT(const CanonicalForm & F, const int lev)
    59129{
    60130  CanonicalForm FL;
    61131  FL = F;
    62132
    63   int deg = FL.degree(lev);
    64   for(int i = lev; i >= 1; i--){
     133  for(int i = lev; i >= 1; i--)
     134  {
    65135    FL = FL.LC(i);
    66     deg = deg + FL.degree(i - 1);
    67   }
    68   return deg;
    69 }
    70 
    71 // Leading coefficient of F wrt all variables of level smaller than or equal to lev.
     136  }
     137  return FL;
     138}
     139
     140
    72141static CanonicalForm
    73 lcoefWRT(const CanonicalForm & F, const int lev)
    74 {
    75   CanonicalForm FL;
    76   FL = F;
    77  
    78   for(int i = lev; i >= 1; i--){
    79     FL = FL.LC(i);
    80   }
    81   return FL;
    82 }
    83 
    84 
    85 static CanonicalForm
    86142newtonInterp(const CanonicalForm alpha, const CanonicalForm u, const CanonicalForm newtonPoly, const CanonicalForm oldInterPoly, const Variable & x)
    87143// Newton interpolation - Incremental algorithm.
    88144// Given a list of values alpha_i and a list of polynomials u_i, 1 <= i <= n,
    89 // computes the interpolation polynomial assuming that 
    90 // the polynomials in u are the results of evaluating the variabe x 
     145// computes the interpolation polynomial assuming that
     146// the polynomials in u are the results of evaluating the variabe x
    91147// of the unknown polynomial at the alpha values.
    92 // This incremental version receives only the values of alpha_n and u_n and 
     148// This incremental version receives only the values of alpha_n and u_n and
    93149// the previous interpolation polynomial for points 1 <= i <= n-1, and computes
    94150// the polynomial interpolating in all the points.
     
    97153  /*
    98154  int debug = 0;
    99   if(debug){
     155  if(debug)
     156  {
    100157    cout << "newtonInterpIncremental input - variable " << x <<endl;
    101158    cout << "newtonInterpIncremental input - alpha:" << alpha << " - u: " << u << endl;
     
    114171
    115172// Univariate GCD
    116 // Naive implementation of Euclidean Algorithm. 
     173// Naive implementation of Euclidean Algorithm.
    117174// Should be used only for GCD of univariate polys over finite fields,
    118175// where there is no coefficient growth.
    119 static CanonicalForm
    120 simpleGCD(const CanonicalForm & A, const CanonicalForm & B)
     176static CanonicalForm simpleGCD(const CanonicalForm & A, const CanonicalForm & B)
    121177{
    122178  //int debug = 0;
    123179  CanonicalForm P1, P2;
    124180  /*
    125   if(debug == 1){
     181  if(debug == 1)
     182  {
    126183    cout << "simpleGCD input" << endl;
    127184    cout << "A: " << A << endl;
     
    129186  }
    130187  */
    131   if (A.degree() > B.degree()){
     188  if (A.degree() > B.degree())
     189  {
    132190    P1 = A;
    133191    P2 = B;
    134   } else {
     192  }
     193  else
     194  {
    135195    P1 = B;
    136196    P2 = A;
     
    150210
    151211
    152 static CanonicalForm
    153 GFPowDown(const CanonicalForm & A, int k)
     212static CanonicalForm GFPowDown(const CanonicalForm & A, int k)
    154213// Replaces all coefficients of A in the ground field by their k-th roots.
    155 // It assumes that the k-th roots exist. 
     214// It assumes that the k-th roots exist.
    156215// This procedure is used to map down a polynomial from an extension field.
    157216{
     
    166225      //cout << "i: " << i << endl;
    167226      //cout << "A[i]: " << A[i] << endl;
    168       if(A[i].inBaseDomain()){
     227      if(A[i].inBaseDomain())
     228      {
    169229        //cout << "GFPowDown - inBaseDomain" << endl;
    170230        g = getGFGenerator();
     
    175235          j++;
    176236        }
    177         if(j == fieldSize + 1)return(-1);
     237        if(j == fieldSize + 1)  return(-1);
    178238        result = result + power(g, j) * power(A.mvar(), i);
    179239        //cout << "power(A[i], k): " << power(A[i], k) << endl;
    180240        //cout << "result: " << result << endl;
    181       } else {
    182         //cout << "not inBaseDomain" << endl; 
     241      }
     242      else
     243      {
     244        //cout << "not inBaseDomain" << endl;
    183245        result = result + GFPowDown(A[i], k) * power(A.mvar(), i);;
    184246        // power(pol[i], k) * power(A.mvar(), i);
     
    190252}
    191253
    192 static CanonicalForm
    193 GFPowUp(const CanonicalForm & A, int k)
     254static CanonicalForm GFPowUp(const CanonicalForm & A, int k)
    194255// Raises all coefficients of A in the ground field to the power k.
    195256// Used for maping a polynomial to an extension field.
    196257{
     258  //cout << "A:" << A <<"\n";
    197259  CanonicalForm result = 0;
    198260  int i;
     
    203265      //cout << "i: " << i << endl;
    204266      //cout << "A[i]: " << A[i] << endl;
    205       if(A[i].inBaseDomain()){
     267      if(A[i].inBaseDomain())
     268      {
    206269        //cout << "inBaseDomain" << endl;
    207270        result = result + power(A[i], k) * power(A.mvar(), i);
    208271        //cout << "power(A[i], k): " << power(A[i], k) << endl;
    209272        //cout << "result: " << result << endl;
    210       } else {
    211         //cout << "not inBaseDomain" << endl; 
     273      }
     274      else
     275      {
     276        //cout << "not inBaseDomain" << endl;
    212277        result = result + GFPowUp(A[i], k) * power(A.mvar(), i);;
    213278      }
    214279    }
    215280  }
     281  //cout << "result:" << result <<"\n";
    216282  return(result);
    217283}
    218284
    219 CanonicalForm
    220 GFMapUp(const CanonicalForm & A, int k)
     285CanonicalForm GFMapUp(const CanonicalForm & A, int k)
    221286// Maps all coefficients of A to the base domain, asumming A is in GF(p^k).
     287// The current base domain must be GF(p^j), with j a multiple of k.
     288{
     289  int p = getCharacteristic();
     290  int expon = getGFDegree();
     291  int extExp = expon / k;
     292    // Assumes that we are using Conway polynomials
     293  return(GFPowUp(A, extExp));
     294}
     295
     296CanonicalForm GFMapDown(const CanonicalForm & A, int k)
     297// Maps all coefficients of A from the base domain to GF(p^k).
    222298// The current base domain must be GF(p^j), with j a multiple of k.
    223299{
     
    225301  int expon = getGFDegree();
    226302  //cout << "Expon: " << expon << endl;
    227   int extExp = (pow(p, expon) - 1) / (pow(p, k) - 1); // Assumes that we are using Conway polynomials
    228   return(GFPowUp(A, extExp));
    229 }
    230 
    231 CanonicalForm
    232 GFMapDown(const CanonicalForm & A, int k)
    233 // Maps all coefficients of A from the base domain to GF(p^k).
    234 // The current base domain must be GF(p^j), with j a multiple of k.
    235 {
    236   int p = getCharacteristic();
    237   int expon = getGFDegree();
    238   //cout << "Expon: " << expon << endl;
    239   int extExp = (pow(p, expon) - 1) / (pow(p, k) - 1); // Assumes that we are using Conway polynomials
     303  int extExp = expon / k;
     304    // Assumes that we are using Conway polynomials
    240305  return(GFPowDown(A, extExp));
    241306}
    242307
    243 CanonicalForm
    244 newGCD(CanonicalForm A, CanonicalForm B)
     308CanonicalForm newGCD(CanonicalForm A, CanonicalForm B)
    245309// Computes the GCD of two polynomials over a prime field.
    246310// Based on Algorithm 7.2 from "Algorithms for Computer Algebra"
    247311{
    248   /*
    249   int debug = 0;
    250   if(debug){
    251     cout << "newGCD input" << endl;
    252     cout << "A: " << A << endl;
    253     cout << "B: " << B << endl;
    254   }
    255   */
    256 
    257   if(A*1 == 0){
     312  //int debug = 1;
     313  //if(debug)
     314  //{
     315  //  cout << "newGCD input" << endl;
     316  //  cout << "A: " << A << endl;
     317  //  cout << "B: " << B << endl;
     318  //}
     319
     320  if(A*1 == 0)
     321  {
    258322    //if(debug)cout << "A Zero!" << endl;
    259     return(B);
    260   }
    261   if(B*1 == 0){
     323    return(abs(B));
     324  }
     325  if(B*1 == 0)
     326  {
    262327    //if(debug)cout << "B Zero!" << endl;
    263     return(A);
    264   }
    265 
     328    return(abs(A));
     329  }
     330  if (A.inBaseDomain()) return A.genOne();
     331  if (B.inBaseDomain()) return B.genOne();
    266332
    267333  CanonicalForm pol;
    268334  int p = getCharacteristic();
    269   int k = getGFDegree();
    270   int fieldSize = pow(p, k);
    271 
    272   /*
    273   if(debug){
    274     cout << "p: " << p << endl;
    275     cout << "k: " << k << endl;
    276     cout << "fieldSize: " << fieldSize << endl;
    277     cout << "pow: " << pow(p, k) << endl;
    278   }
    279   */
    280 
     335  int k = 1;
     336  int fieldSize = p;
     337  if (CFFactory::gettype() == GaloisFieldDomain)
     338  {
     339    k=getGFDegree();
     340    fieldSize = pow(p, k);
     341  }
     342
     343  //if(debug)
     344  //{
     345  //  cout << "p: " << p << endl;
     346  //  cout << "k: " << k << endl;
     347  //  cout << "fieldSize: " << fieldSize << endl;
     348  //  cout << "pow: " << pow(p, k) << endl;
     349  //}
     350 
     351  CFMap M,N;
     352  compress(A,B,M,N);
     353  A=M(A);
     354  B=M(B);
    281355  // Compute the main variable (the largest in A and B)
    282   int mv;
    283   Variable x;
    284   x = A.mvar();
    285   mv = x.level();
    286   if(B.mvar().level() > mv) {
    287     x = A.mvar();
     356  Variable x = A.mvar();
     357  int mv = x.level();
     358  if(B.mvar().level() > mv)
     359  {
     360    x = B.mvar();
    288361    mv = x.level();
    289362  }
    290363  //cout << "main variable " << x << endl << endl;
    291364
    292     // Checks for univariate polynomial
     365  // Checks for univariate polynomial
    293366  if ( mv == 1 )
    294     {
     367  {
    295368    // This call can be replaced by a faster GCD algorithm
    296369    pol = simpleGCD(A, B); // Univariate GCD
    297370    //cout << "newGCD output 1: " << pol << endl;
    298     return pol;
     371    return N(pol);
    299372  }
    300373
    301374  CanonicalForm b;
    302375  CFArray bArray(0, fieldSize-1);    // Stores the bs already used
    303   int sizebArray = 0;
     376  int sizebArray;
    304377
    305378  GFRandom genGF;
     
    307380  int i, j;
    308381  int used;
    309  
     382
    310383  CanonicalForm c;    // gcd of the contents
    311384  CanonicalForm C;
     
    331404
    332405  CanonicalForm Ab, Bb, gb;  // A, B and g evaluated at b
    333  
     406
    334407  int m;          // degree of the gcd of Ab and Bb
    335408  int n = degWRT(Ap, mv - 1);
    336   if(degWRT(Bp, mv - 1) < n){
     409  if(degWRT(Bp, mv - 1) < n)
     410  {
    337411    n = degWRT(Bp, mv - 1);
    338412  }
    339  
     413
    340414  int fail = 0;
    341415  int goodb;
    342416  // The main loop
    343   do{
    344     // Searches for a good b. If there are no more possible b, the algorithm fails.
     417  //cout << "start loop\n";
     418  sizebArray = 0;
     419  do
     420  {
     421    // Searches for a good b.
     422    // If there are no more possible b, the algorithm fails.
    345423    goodb = 0;
    346     if(sizebArray == (fieldSize - 1)){
     424    if(sizebArray >= fieldSize-1)
     425    {
    347426      // An extension field is needed.
    348427      fail = 1;
    349     } else {
    350       do{
     428    }
     429    else
     430    {
     431      do
     432      {
    351433        // Searches for a new element of the ground field
    352         do{
     434        do
     435        {
    353436          // New element of the ground field
    354           if(k > 1){
     437          if(k > 1)
     438          {
    355439            b = genGF.generate();
    356           } else {
     440          }
     441          else
     442          {
    357443            b = genFF.generate();
    358444          }
     445          //cout << "try(" << sizebArray << "):" << b;
    359446          // Checks if this element was already used
    360447          used = 0;
    361           for(i = 0; i < sizebArray; i++){
     448          for(i = 0; i < sizebArray; i++)
     449          {
    362450            // Multiplication by 1 is used to prevent a bug which
    363451            // produces b=a^(q-1) as a random element.
    364             if((bArray[i]*1) == (b*1)){
     452            if((bArray[i]*1) == (b*1))
     453            {
    365454              used = 1;
     455              //cout << " used\n";
    366456            }
    367457          }
    368458          //if(debug==1)cout << "b: " << b << endl;
    369         } while(used == 1);
     459        }
     460        while(used == 1);
    370461        bArray[sizebArray] = b;
    371462        sizebArray++;
    372463        // b must not cancel the gcd of the leading coefficients
    373         if(g(b, mv) != 0){
     464        if(g(b, mv) != 0)
     465        {
    374466          goodb = 1;
     467          //  cout << " good\n";
    375468        }
    376469        else
    377         {
     470        {
     471          //  cout << " bad";
    378472          if(sizebArray == fieldSize - 1)
    379           {
     473          {
    380474            fail = 1;
     475            //cout << " out of elems " << sizebArray << "tried";
    381476          }
    382         }
    383       } while((goodb == 0) && (fail == 0));
    384     }
    385     if(fail == 1){
     477          //cout << "\n";
     478        }
     479      }
     480      while((goodb == 0) && (fail == 0));
     481    }
     482    if(fail)
     483    {
    386484      // Algorithm fails. An extension is needed.
    387      
     485
    388486      // Computes the exponent of the ring extension so as to have enough interpolation points.
    389487      int degMax;
    390       if(totaldegree(A) > totaldegree(B)){
     488      if(totaldegree(A) > totaldegree(B))
     489      {
    391490        degMax = totaldegree(A);
    392       } else {
     491      }
     492      else
     493      {
    393494        degMax = totaldegree(B);
    394495      }
    395       int expon = 1;
    396       while(pow(fieldSize, expon) < degMax){
     496      int expon = 2; // expon <= will not extend the field
     497      while(pow(fieldSize, expon) < degMax)
     498      {
    397499        expon++;
    398500      }
    399501      //if(debug)cout << "Not enough elements in the base field. An extension to " << p << "^" << k*expon << " is needed." << endl;
    400       if(k > 1){
    401         setCharacteristic(p, k * expon, 'b');
    402         CanonicalForm P1 = GFMapUp(A, k);
    403         CanonicalForm P2 = GFMapUp(B, k);
    404         pol = newGCD(P1, P2);
    405         pol = GFMapDown(pol, k);
    406         setCharacteristic(p, k, 'a');
    407         //if(debug)cout << "newGCD output 5: " << pol << endl;
    408         return pol;
    409       } else {
    410         setCharacteristic(p, k * expon, 'a');
    411         CanonicalForm P1 = A.mapinto();
    412         CanonicalForm P2 = B.mapinto();
    413         pol = newGCD(P1, P2);
    414         setCharacteristic(p);
    415         //if(debug)cout << "newGCD output 4: " << pol << endl;
    416         return(pol);
    417       }
    418     } else {
     502      if(k > 1)
     503      {
     504        if(pow(p,k * expon) < (1<<16))
     505        {
     506          setCharacteristic(p, k * expon, 'b');
     507          CanonicalForm P1 = GFMapUp(A, k);
     508          CanonicalForm P2 = GFMapUp(B, k);
     509          //cout << "newGCD(mapped):" << P1 << " , " << P2 <<"\n";
     510          pol = newGCD(P1, P2);
     511          pol = GFMapDown(pol, k);
     512          setCharacteristic(p, k, 'a');
     513          //if(debug)cout << "newGCD output 5: " << pol << endl;
     514          CanonicalForm temp=N(pol);
     515          temp/=temp.lc();
     516          return temp;
     517        }
     518        else
     519        {
     520          Off(SW_USE_GCD_P);
     521          CanonicalForm temp=N(gcd( A, B));
     522          On(SW_USE_GCD_P);
     523          return temp;
     524        }
     525      }
     526      else
     527      {
     528        if(pow(p,k * expon) < (1<<16))
     529        {
     530          setCharacteristic(p, k * expon, 'a');
     531          CanonicalForm P1 = A.mapinto();
     532          CanonicalForm P2 = B.mapinto();
     533          pol = newGCD(P1, P2);
     534          setCharacteristic(p);
     535          //if(debug)cout << "newGCD output 4: " << pol << endl;
     536          CanonicalForm temp=N(pol);
     537          temp/=temp.lc();
     538          return temp;
     539        }
     540        else
     541        {
     542          Off(SW_USE_GCD_P);
     543          CanonicalForm temp=N(gcd( A, B));
     544          On(SW_USE_GCD_P);
     545          return temp;
     546        }
     547      }
     548    }
     549    else
     550    {
    419551      // Evaluate the polynomials in b
    420552      Ab = Ap(b, mv);
     
    429561      Cb /= Cblc;
    430562      // Test for unlucky homomorphism
    431       if(m < n){
     563      if(m < n)
     564      {
    432565        // The degree decreased, we have to start it all over.
    433566        H = Cb;
    434567        newtonPoly = newtonPoly * (x - b);
    435568        n = m;
    436       } else if(m == n) {
     569      }
     570      else if(m == n)
     571      {
    437572        // Good b
    438573        H = newtonInterp(b, Cb, newtonPoly, H, x);
    439574        newtonPoly = newtonPoly * (x - b);
    440         if(lcoefWRT(H, mv - 1) == g){
     575        if(lcoefWRT(H, mv - 1) == g)
     576        {
    441577          C = H / contentWRT(H, mv - 1);  // primpart
    442           if(fdivides(C, B) && fdivides(C, B))
    443           {
     578          if(fdivides(C, A) && fdivides(C, B))
     579          {
    444580            //if(debug)cout << "newGCD output 2: " << c * C<< endl;
    445             return(c * C);
     581            return N(c * C);
    446582          }
    447           else
    448           {
     583          else
     584          {
    449585            if(m == 0)
    450             {
     586            {
    451587              //if(debug)cout << "newGCD output 3: " << c << endl;
    452               return(c);
     588              return N(c);
    453589            }
    454590          }
     
    473609  cout << "setCharacteristic(2, 4, 'a')" << endl;
    474610  setCharacteristic(2, 4, 'a');
    475  
     611
    476612  int k = getGFDegree();
    477613  int p = getCharacteristic();
  • factory/cf_reval.h

    rb1d37f r49f1f45  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_reval.h,v 1.5 2005-11-18 10:03:49 pohl Exp $ */
     2/* $Id: cf_reval.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    33
    44#ifndef INCL_CF_REVAL_H
     
    1515class REvaluation : public Evaluation
    1616{
    17 private:
     17protected: // neeeded in FFREvaluation
    1818    CFRandom * gen;
    1919public:
  • factory/cf_switches.cc

    rb1d37f r49f1f45  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_switches.cc,v 1.8 2007-09-26 09:17:40 Singular Exp $ */
     2/* $Id: cf_switches.cc,v 1.9 2007-11-20 10:08:03 Singular Exp $ */
    33
    44//{{{ docu
     
    3636#endif
    3737  On(SW_USE_EZGCD);
     38  //On(SW_USE_EZGCD_P); // still testing
    3839}
    3940//}}}
  • factory/cf_switches.h

    rb1d37f r49f1f45  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_switches.h,v 1.11 2007-10-31 08:40:53 Singular Exp $ */
     2/* $Id: cf_switches.h,v 1.12 2007-11-20 10:08:03 Singular Exp $ */
    33
    44#ifndef INCL_CF_SWITCHES_H
     
    1919//
    2020//}}}
    21 const int CFSwitchesMax = 14;
     21const int CFSwitchesMax = 15;
    2222//}}}
    2323
  • factory/winnt/factory.h

    rb1d37f r49f1f45  
    1 /* ../factory/winnt/factory.h automatically generated by makeheader from ../factory/factory.template */
     1/* winnt/factory.h automatically generated by makeheader from factory.template */
    22/* emacs edit mode for this file is -*- C++ -*- */
    3 /* $Id: factory.h,v 1.5 1997-12-09 16:37:34 schmidt Exp $ */
     3/* $Id: factory.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    44
    55#ifndef INCL_FACTORY_H
     
    2626
    2727#ifndef NOSTREAMIO
     28#ifdef HAVE_IOSTREAM
     29#include <iostream>
     30#define OSTREAM std::ostream
     31#define ISTREAM std::istream
     32#elif defined(HAVE_IOSTREAM_H)
    2833#include <iostream.h>
     34#define OSTREAM ostream
     35#define ISTREAM istream
     36#endif
    2937#endif /* ! NOSTREAMIO */
    3038
    3139#ifdef SINGULAR
    32 extern "C" {
     40#include "cf_gmp.h"
     41#else
    3342#include <gmp.h>
    34 }
    3543#endif /* SINGULAR */
    3644
    3745#ifdef macintosh
    38 #include <::templates:ftmpl_array.h>
    39 #include <::templates:ftmpl_factor.h>
    40 #include <::templates:ftmpl_list.h>
    41 #include <::templates:ftmpl_matrix.h>
     46#include <:templates:ftmpl_array.h>
     47#include <:templates:ftmpl_factor.h>
     48#include <:templates:ftmpl_list.h>
     49#include <:templates:ftmpl_matrix.h>
    4250#else
    4351#include <templates/ftmpl_array.h>
     
    4755#endif
    4856
    49 /* stuff included from ../factory/cf_globals.h */
     57/* stuff included from ./cf_globals.h */
    5058
    5159
     
    5462
    5563
    56 /* stuff included from ../factory/cf_primes.h */
     64/* stuff included from ./cf_primes.h */
    5765
    5866
     
    7078
    7179
    72 /* stuff included from ../factory/cf_defs.h */
     80/* stuff included from ./cf_defs.h */
    7381
    7482
     
    99107const int SW_USE_EZGCD = 6;
    100108const int SW_USE_SPARSEMOD = 7;
    101 //}}}
    102 
    103 
    104 /* stuff included from ../factory/variable.h */
     109const int SW_USE_NTL=8;
     110const int SW_USE_NTL_GCD_0=9;
     111const int SW_USE_NTL_GCD_P=10;
     112const int SW_USE_NTL_SORT=11;
     113const int SW_USE_CHINREM_GCD=12;
     114const int SW_USE_GCD_P=13;
     115//}}}
     116
     117
     118/* stuff included from ./variable.h */
    105119
    106120
     
    153167    }
    154168#ifndef NOSTREAMIO
    155     friend ostream & operator << ( ostream & os, const Variable & v );
     169    friend OSTREAM & operator << ( OSTREAM & os, const Variable & v );
    156170#endif /* NOSTREAMIO */
    157     friend Variable rootOf( const CanonicalForm &, char name = '@' );
    158 };
     171    friend void swap_levels();
     172    friend Variable rootOf( const CanonicalForm &, char name );
     173};
     174Variable rootOf( const CanonicalForm &, char name = '@' );
    159175
    160176inline int level( const Variable & v ) { return v.level(); }
     
    166182char getDefaultExtName();
    167183
    168 
    169 /* stuff included from ../factory/canonicalform.h */
     184int ExtensionLevel();
     185
     186
     187/* stuff included from ./canonicalform.h */
     188
     189
     190#undef CF_INLINE
     191#define CF_INLINE
     192#undef CF_NO_INLINE
     193#define CF_NO_INLINE
     194
     195
     196class InternalCF;
     197
     198inline int is_imm ( const InternalCF * const ptr )
     199{
     200    // returns 0 if ptr is not immediate       
     201    return ( ((int)((long)ptr)) & 3 );
     202}
    170203
    171204
     
    173206
    174207static int cf_is_initialized_now = initCanonicalForm();
    175 
    176 class InternalCF;
    177208
    178209//{{{ class CanonicalForm
     
    183214public:
    184215    // constructors, destructors, selectors
    185     CanonicalForm();
    186     CanonicalForm( const CanonicalForm& );
    187     CanonicalForm( InternalCF* );
    188     CanonicalForm( const int );
    189     CanonicalForm( const Variable & );
    190     CanonicalForm( const Variable &, int );
    191     CanonicalForm( const char * ); // use with caution - does only handle integers !!!
    192 
    193     ~CanonicalForm();
     216    CF_INLINE CanonicalForm();
     217    CF_INLINE CanonicalForm( const CanonicalForm& );
     218    CF_INLINE CanonicalForm( InternalCF* );
     219    CF_INLINE CanonicalForm( const int );
     220    CF_INLINE CanonicalForm( const Variable & );
     221    CF_INLINE CanonicalForm( const Variable &, int );
     222    CanonicalForm( const char *, const int base=10 ); // use with caution - does only handle integers !!!
     223
     224    CF_NO_INLINE ~CanonicalForm();
    194225
    195226    InternalCF* getval() const; // use with caution !!!
     
    198229
    199230    // predicates
    200     bool isOne() const;
    201     bool isZero() const;
    202     bool isImm() const;
     231    CF_NO_INLINE bool isOne() const;
     232    CF_NO_INLINE bool isZero() const;
     233    inline bool isImm() const { return is_imm( value ); };
    203234
    204235    bool inZ() const;
     
    215246    bool isFFinGF() const;
    216247    bool isUnivariate() const;
     248    bool isHomogeneous() const;
    217249
    218250    // conversion functions
     
    238270
    239271    // assignment operators
    240     CanonicalForm& operator = ( const CanonicalForm& );
    241     CanonicalForm& operator = ( const int );
     272    CF_NO_INLINE CanonicalForm& operator = ( const CanonicalForm& );
     273    CF_NO_INLINE CanonicalForm& operator = ( const int );
    242274
    243275    CanonicalForm& operator += ( const CanonicalForm& );
     
    269301
    270302    // arithmetic operators
    271     friend CanonicalForm operator - ( const CanonicalForm& );
    272 
    273     friend CanonicalForm operator + ( const CanonicalForm&, const CanonicalForm& );
    274     friend CanonicalForm operator - ( const CanonicalForm&, const CanonicalForm& );
    275     friend CanonicalForm operator * ( const CanonicalForm&, const CanonicalForm& );
    276     friend CanonicalForm operator / ( const CanonicalForm&, const CanonicalForm& );
    277     friend CanonicalForm operator % ( const CanonicalForm&, const CanonicalForm& );
    278 
    279     friend CanonicalForm div ( const CanonicalForm&, const CanonicalForm& );
    280     friend CanonicalForm mod ( const CanonicalForm&, const CanonicalForm& );
     303    friend CF_NO_INLINE CanonicalForm operator - ( const CanonicalForm& );
    281304
    282305    friend void divrem ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    283306    friend bool divremt ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    284307
     308    friend CanonicalForm bgcd ( const CanonicalForm &, const CanonicalForm & );
     309    friend CanonicalForm bextgcd ( const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm & );
     310
     311    // input/output
    285312#ifndef NOSTREAMIO
    286     void print( ostream&, char * ) const;
    287     friend ostream& operator << ( ostream&, const CanonicalForm& );
    288     friend istream& operator >> ( istream&, CanonicalForm& );
     313    void print( OSTREAM&, char * ) const;
     314    void print( OSTREAM& ) const;
     315    friend OSTREAM& operator << ( OSTREAM&, const CanonicalForm& );
     316    friend ISTREAM& operator >> ( ISTREAM&, CanonicalForm& );
    289317#endif /* NOSTREAMIO */
    290318
     
    298326//}}}
    299327
    300 // some useful functions
     328CF_INLINE CanonicalForm
     329operator + ( const CanonicalForm&, const CanonicalForm& );
     330
     331CF_NO_INLINE CanonicalForm
     332operator - ( const CanonicalForm&, const CanonicalForm& );
     333
     334CF_INLINE CanonicalForm
     335operator * ( const CanonicalForm&, const CanonicalForm& );
     336
     337CF_NO_INLINE CanonicalForm
     338operator / ( const CanonicalForm&, const CanonicalForm& );
     339
     340CF_NO_INLINE CanonicalForm
     341operator % ( const CanonicalForm&, const CanonicalForm& );
     342
     343CF_NO_INLINE CanonicalForm
     344div ( const CanonicalForm&, const CanonicalForm& );
     345
     346CF_NO_INLINE CanonicalForm
     347mod ( const CanonicalForm&, const CanonicalForm& );
     348
    301349
    302350//{{{ function declarations from canonicalform.cc
     351CanonicalForm blcm ( const CanonicalForm & f, const CanonicalForm & g );
     352
    303353CanonicalForm power ( const CanonicalForm & f, int n );
    304354
    305355CanonicalForm power ( const Variable & v, int n );
    306 
    307 bool divides ( const CanonicalForm & f, const CanonicalForm & g );
    308356//}}}
    309357
     
    313361CanonicalForm extgcd ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    314362
    315 CanonicalForm iextgcd ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    316 
    317363CanonicalForm lcm ( const CanonicalForm&, const CanonicalForm& );
    318364
     
    324370
    325371CanonicalForm icontent ( const CanonicalForm & f );
     372
     373CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x );
    326374//}}}
    327375
     
    386434level ( const CanonicalForm & f ) { return f.level(); }
    387435
    388 inline CanonicalForm
     436inline Variable
    389437mvar ( const CanonicalForm & f ) { return f.mvar(); }
    390438
     
    394442inline CanonicalForm
    395443den ( const CanonicalForm & f ) { return f.den(); }
     444
     445inline int
     446sign ( const CanonicalForm & a ) { return a.sign(); }
    396447
    397448inline CanonicalForm
     
    418469}
    419470
    420 inline CanonicalForm
    421 abs ( const CanonicalForm & f )
    422 {
    423     if ( f < 0 )
    424         return -f;
    425     else
    426         return f;
    427 }
    428 
    429471inline int
    430472headdegree ( const CanonicalForm & f ) { return totaldegree( head( f ) ); }
     473
     474
    431475//}}}
    432476
     
    456500
    457501
    458 /* stuff included from ../factory/cf_binom.h */
     502/* stuff included from ./cf_binom.h */
    459503
    460504
     
    462506
    463507
    464 /* stuff included from ../factory/cf_algorithm.h */
     508/* stuff included from ./cf_algorithm.h */
    465509
    466510
     
    472516void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x );
    473517
    474 CanonicalForm common_den ( const CanonicalForm & f );
     518CanonicalForm bCommonDen ( const CanonicalForm & f );
     519
     520bool fdivides ( const CanonicalForm & f, const CanonicalForm & g );
     521
     522CanonicalForm maxNorm ( const CanonicalForm & f );
     523
     524CanonicalForm euclideanNorm ( const CanonicalForm & f );
    475525//}}}
    476526
     
    479529
    480530void chineseRemainder ( const CFArray & x, const CFArray & q, CanonicalForm & xnew, CanonicalForm & qnew );
     531
     532CanonicalForm Farey ( const CanonicalForm & f, const CanonicalForm & q );
    481533//}}}
    482534
    483535//{{{ function declarations from cf_factor.cc
     536bool isPurePoly(const CanonicalForm & f);
     537
     538bool isPurePoly_m(const CanonicalForm & f);
     539
    484540CFFList factorize ( const CanonicalForm & f, bool issqrfree = false );
    485541
     
    489545
    490546bool isSqrFree ( const CanonicalForm & f );
     547
     548CanonicalForm homogenize( const CanonicalForm & f, const Variable & x);
     549CanonicalForm homogenize( const CanonicalForm & f, const Variable & x,
     550                                const Variable & v1, const Variable & v2);
     551Variable get_max_degree_Variable(const CanonicalForm & f);
     552CFList get_Terms( const CanonicalForm & f );
     553void getTerms( const CanonicalForm & f, const CanonicalForm & t, CFList & result );
     554
     555
    491556//}}}
    492557
     
    503568//}}}
    504569
    505 
    506 /* stuff included from ../factory/cf_eval.h */
     570//{{{ inline CanonicalForm abs ( const CanonicalForm & f )
     571//{{{ docu
     572//
     573// abs() - return absolute value of `f'.
     574//
     575// The absolute value is defined in terms of the function
     576// `sign()'.  If it reports negative sign for `f' than -`f' is
     577// returned, otherwise `f'.
     578//
     579// This behaviour is most useful for integers and rationals.  But
     580// it may be used to sign-normalize the leading coefficient of
     581// arbitrary polynomials, too.
     582//
     583// Type info:
     584// ----------
     585// f: CurrentPP
     586//
     587//}}}
     588inline CanonicalForm
     589abs ( const CanonicalForm & f )
     590{
     591    // it is not only more general to use `sign()' instead of a
     592    // direct comparison `f < 0', it is faster, too
     593    if ( sign( f ) < 0 )
     594        return -f;
     595    else
     596        return f;
     597}
     598//}}}
     599
     600
     601/* stuff included from ./cf_eval.h */
    507602
    508603
     
    525620    virtual void nextpoint();
    526621#ifndef NOSTREAMIO
    527     friend ostream& operator<< ( ostream& s, const Evaluation &e );
     622    friend OSTREAM& operator<< ( OSTREAM& s, const Evaluation &e );
    528623#endif /* NOSTREAMIO */
    529624};
    530625
    531626
    532 /* stuff included from ../factory/cf_generator.h */
     627/* stuff included from ./cf_generator.h */
    533628
    534629
     
    574669};
    575670
    576 class AlgExtGenerator : public CFGenerator
     671class AlgExtGenerator //??? : public CFGenerator
    577672{
    578673private:
    579674    Variable algext;
    580     CFGenerator **gens;
     675    FFGenerator **gensf;
     676    GFGenerator **gensg;
    581677    int n;
    582678    bool nomoreitems;
     
    603699
    604700
    605 /* stuff included from ../factory/cf_iter.h */
     701/* stuff included from ./cf_iter.h */
     702
     703
     704#undef CF_INLINE
     705#define CF_INLINE
     706#undef CF_NO_INLINE
     707#define CF_NO_INLINE
    606708
    607709
     
    625727    CFIterator& operator= ( const CanonicalForm& );
    626728
    627     CFIterator& operator++ ();
    628     CFIterator& operator++ ( int );
    629     int hasTerms () const;
    630     CanonicalForm coeff () const;
    631     int exp () const;
    632 };
    633 
    634 
    635 /* stuff included from ../factory/cf_random.h */
     729    CF_NO_INLINE CFIterator& operator++ ();
     730    CF_NO_INLINE CFIterator& operator++ ( int );
     731    CF_NO_INLINE int hasTerms () const;
     732    CF_NO_INLINE CanonicalForm coeff () const;
     733    CF_NO_INLINE int exp () const;
     734};
     735
     736
     737/* stuff included from ./cf_random.h */
    636738
    637739
     
    700802
    701803
    702 /* stuff included from ../factory/cf_irred.h */
     804/* stuff included from ./cf_irred.h */
    703805
    704806
     
    706808
    707809
    708 /* stuff included from ../factory/fac_util.h */
     810/* stuff included from ./fac_util.h */
    709811
    710812
     
    736838void divremainder( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & quot, CanonicalForm & rem, const modpk & pk );
    737839
    738 CanonicalForm maxCoeff( const CanonicalForm & f );
    739 
    740840bool Hensel ( const CanonicalForm & U, CFArray & G, const CFArray & lcG, const Evaluation & A, const modpk & bound, const Variable & x );
    741841
     
    753853
    754854
    755 /* stuff included from ../factory/cf_map.h */
     855/* stuff included from ./cf_map.h */
    756856
    757857
     
    789889    CanonicalForm subst () const { return S; }
    790890#ifndef NOSTREAMIO
    791     friend ostream & operator << ( ostream & s, const MapPair & p );
     891    void print( OSTREAM&) const;
     892    friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p );
    792893#endif /* NOSTREAMIO */
    793894};
     
    827928  CanonicalForm operator () ( const CanonicalForm & f ) const;
    828929#ifndef NOSTREAMIO
    829   friend ostream & operator << ( ostream & s, const CFMap & m );
     930  friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m );
    830931#endif /* NOSTREAMIO */
    831932};
     
    837938
    838939
    839 /* stuff included from ../factory/cf_reval.h */
     940/* stuff included from ./cf_reval.h */
    840941
    841942
     
    856957#ifdef SINGULAR
    857958
    858 /* stuff included from ../factory/gfops.h */
     959/* stuff included from ./gfops.h */
    859960
    860961
     
    864965
    865966
    866 /* stuff included from ../factory/singext.h */
     967/* stuff included from ./singext.h */
    867968
    868969
     
    871972MP_INT gmp_denominator ( const CanonicalForm & f );
    872973
     974int gf_value (const CanonicalForm & f );
     975
    873976CanonicalForm make_cf ( const MP_INT & n );
    874977
    875978CanonicalForm make_cf ( const MP_INT & n, const MP_INT & d, bool normalize );
    876979
     980CanonicalForm make_cf_from_gf ( const int z );
     981
    877982
    878983#endif /* SINGULAR */
    879984
     985#ifdef HAVE_BIFAC
     986/* stuff included from ./bifac.h */
     987
     988
     989CFFList AbsFactorize( const CanonicalForm  & a );
     990
     991class BIFAC
     992{
     993////////////////////////////////////////////////////////////////
     994  public:
     995//////////////////////////////////////////////////////////////// 
     996
     997  // === KONST-/ DESTRUKTOREN ====
     998  BIFAC         ( void );  // Konstruktor
     999  virtual ~BIFAC( void );  // DESTRUKTOR
     1000
     1001  // === Funktionen =======
     1002  void     bifac(CanonicalForm f, bool absolute=true);
     1003  CFFList  getFactors( void ){ return  gl_RL; };
     1004
     1005
     1006////////////////////////////////////////////////////////////////
     1007 private:
     1008////////////////////////////////////////////////////////////////
     1009
     1010  // === Funktionen =======
     1011  void   passedTime();
     1012  void   biGanzMachen(  CanonicalForm & f );
     1013  void   biNormieren( CanonicalForm & f ) ;
     1014  void   convertResult(  CanonicalForm & f, int ch, int sw);
     1015  int    findCharacteristic(CanonicalForm f);
     1016//  void   matrix_drucken( CFMatrix M );
     1017  long int  anz_terme(  CanonicalForm & f );
     1018
     1019  CFList matrix2basis(CFMatrix A, int dim, int m, int n, CanonicalForm f);
     1020  CFList basisOfG(CanonicalForm f);
     1021  CFMatrix createA (CFList G, CanonicalForm f);
     1022  CanonicalForm  create_g    (CFList G);
     1023  CFList         createRg    (CFList G, CanonicalForm f);
     1024  CFList         createEg    (CFList G, CanonicalForm f);
     1025  CFList         createEgUni (CFList G, CanonicalForm f);
     1026
     1027  void     unifac(CanonicalForm f, int grad);
     1028  CanonicalForm RationalFactor (CanonicalForm phi, CanonicalForm f, \
     1029                                CanonicalForm fx, CanonicalForm g);
     1030  void   RationalFactorizationOnly (CFFList Phis, CanonicalForm f, CanonicalForm g);
     1031  CFList getAbsoluteFactors (CanonicalForm f1, CanonicalForm phi);
     1032  void   AbsoluteFactorization (CFFList Phis, CanonicalForm f, CanonicalForm g);
     1033  void   bifacSqrFree( CanonicalForm f );
     1034  void   bifacMain(CanonicalForm f);
     1035 
     1036
     1037  // === Variable =======
     1038  CFFList gl_RL;    // where to store the rational factorization
     1039  CFList  gl_AL;    // where to store the absolute factorization
     1040  bool   absolute;  // Compute an absolute factorization as well?
     1041  int    exponent;  //
     1042};
     1043
     1044#endif /* HAVE_BIFAC */
     1045
    8801046#endif /* ! INCL_FACTORY_H */
  • factory/winnt/factoryconf.h

    rb1d37f r49f1f45  
    1 /* ../factory/winnt/factoryconf.h automatically generated by makeheader from ../factory/factoryconf.template */
     1/* winnt/factoryconf.h automatically generated by makeheader from factoryconf.template */
    22/* emacs edit mode for this file is -*- C -*- */
    3 /* $Id: factoryconf.h,v 1.5 1997-12-09 16:37:58 schmidt Exp $ */
     3/* $Id: factoryconf.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    44
    55#ifndef INCL_FACTORYCONF_H
     
    2020/* }}} */
    2121
    22 /* stuff included from ../factory/winnt/config.h */
     22/* stuff included from ./winnt/config.h */
    2323
    2424/* emacs edit mode for this file is -*- C -*- */
    25 /* $Id: factoryconf.h,v 1.5 1997-12-09 16:37:58 schmidt Exp $ */
     25/* $Id: factoryconf.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    2626
    2727#ifndef INCL_CONFIG_H
     
    102102#endif /* ! INCL_CONFIG_H */
    103103
    104 /* stuff included from ../factory/assert.h */
     104/* stuff included from ./assert.h */
    105105
    106106/* emacs edit mode for this file is -*- C -*- */
    107 /* $Id: factoryconf.h,v 1.5 1997-12-09 16:37:58 schmidt Exp $ */
     107/* $Id: factoryconf.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    108108
    109109/* This is for compatibility with standard assert.h */
     
    134134/* }}} */
    135135
     136#ifdef __cplusplus
     137extern "C" {
     138#endif
     139
    136140#include <stdio.h>
    137141#include <stdlib.h>
     142
     143#ifdef __cplusplus
     144}
     145#endif
    138146
    139147/* {{{ permanent macro definitions */
Note: See TracChangeset for help on using the changeset viewer.