Changeset 927b7e in git


Ignore:
Timestamp:
Jun 14, 2007, 4:16:35 PM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
d8a0328e6cfefb97612f39bd9789312acceee6a5
Parents:
cbc7e3a7ea564423342c0c92a78606ddf14433fb
Message:
*hannes: Factorize2 etc.


git-svn-id: file:///usr/local/Singular/svn/trunk@10109 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
libfac/factor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfac/factor/Factor.cc

    rcbc7e3 r927b7e  
    11/* Copyright 1996 Michael Messollen. All rights reserved. */
    22///////////////////////////////////////////////////////////////////////////////
    3 static char * rcsid = "$Id: Factor.cc,v 1.34 2007-06-02 10:21:57 Singular Exp $ ";
     3static char * rcsid = "$Id: Factor.cc,v 1.35 2007-06-14 14:16:35 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///////////////////////////////////////////////////////////////////////////////
     
    10431043CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly )
    10441044{
     1045#ifndef NDEBUG
     1046  printf("start Factorize2(int_flag=%d)\n",libfac_interruptflag);
     1047#endif
    10451048  CFFList G,H;
    10461049  CanonicalForm fac;
     
    10491052  libfac_interruptflag=0;
    10501053  CFFList iF=Factorize(F,minpoly);
    1051   libfac_interruptflag=0;
    1052   for ( i = iF; i.hasItem(); ++i )
    1053   {
    1054     d = i.getItem().exp();
    1055     fac = i.getItem().factor();
    1056     if (fdivides(fac,F))
    1057     {
    1058       if ((getNumVars(fac)==0)||(fac.degree()<=1))
     1054  if ((libfac_interruptflag==0)||(iF.isEmpty()))
     1055    H=iF;
     1056  else
     1057  {
     1058#ifndef NDEBUG
     1059    printf("variant 2(int_flag=%d)\n",libfac_interruptflag);
     1060#endif
     1061    libfac_interruptflag=0;
     1062    iF=Factorize(F);
     1063    if (libfac_interruptflag==0)
     1064    {
     1065      i = iF;
     1066      while( i.hasItem())
    10591067      {
     1068        d = i.getItem().exp();
     1069        fac = i.getItem().factor();
     1070        if (fdivides(fac,F))
     1071        {
     1072          if ((getNumVars(fac)==0)||(fac.degree()<=1))
     1073          {
    10601074#ifndef NOSTREAMIO
    10611075#ifndef NDEBUG
    1062         printf("append trivial factor\n");
    1063 #endif
    1064 #endif
    1065         H.append( CFFactor( fac, d));
    1066         do {F/=fac; d--; } while (d>0);
    1067       }
    1068       else
    1069       {
    1070         e=0;
    1071         while ((!fac.isZero())&& fdivides2(fac,F,minpoly) && (d>0))
    1072         {
     1076            printf("append trivial factor\n");
     1077#endif
     1078#endif
     1079            H.append( CFFactor( fac, d));
     1080            do {F/=fac; d--; } while (d>0);
     1081          }
     1082          else
     1083          {
     1084            G = Factorize( fac, minpoly);
     1085            if (libfac_interruptflag!=0)
     1086            {
     1087              libfac_interruptflag=0;
     1088              k = G;
     1089              while( k.hasItem())
     1090              {
     1091                fac = k.getItem().factor();
     1092                int dd = k.getItem().exp()*d;
     1093                e=0;
     1094                while ((!fac.isZero())&& fdivides2(fac,F,minpoly) && (dd>0))
     1095                {
    10731096#ifndef NOSTREAMIO
    10741097#ifndef NDEBUG
    1075           out_cf("factor:",fac,"\n");
    1076 #endif
    1077 #endif
    1078           e++;d--;
    1079           F/=fac;
    1080         }
    1081         if (e>0) H.append( CFFactor( fac , e ) );
    1082       }
    1083     }
    1084   }
    1085   libfac_interruptflag=0;
    1086   if (getNumVars(F)>0)
    1087   {
    1088     G = Factorize(F, minpoly);
    1089     libfac_interruptflag=0;
    1090     for ( k = G; k.hasItem(); ++k )
    1091     {
    1092       fac = k.getItem().factor();
    1093       d = k.getItem().exp();
    1094       e=0;
    1095       while ((!fac.isZero())&& fdivides2(fac,F,minpoly) &&(d>0))
    1096       {
    1097 #ifndef NOSTREAMIO
    1098 #ifndef NDEBUG
    1099         out_cf("factor:",fac,"\n");
    1100 #endif
    1101 #endif
    1102         e++; d--;
    1103         F/=fac;
    1104       }
    1105       if (e>0) H.append( CFFactor( fac , e ) );
    1106     }
    1107   }
    1108   if (getNumVars(F)>0)
    1109   {
    1110 #ifndef NOSTREAMIO
    1111 #ifndef NDEBUG
    1112     out_cf("retry:",F,"\n");
    1113 #endif
    1114 #endif
    1115     libfac_interruptflag=0;
    1116     iF=Factorize(F);
    1117     libfac_interruptflag=0;
    1118     for ( i = iF; i.hasItem(); ++i )
    1119     {
    1120       d = i.getItem().exp();
    1121       fac = i.getItem().factor();
    1122       if (fdivides2(fac,F,minpoly))
    1123       {
    1124         if ((getNumVars(fac)==0)||(fac.degree()<=1))
    1125         {
    1126 #ifndef NOSTREAMIO
    1127 #ifndef NDEBUG
    1128           printf("append trivial factor\n");
    1129 #endif
    1130 #endif
    1131           H.append( CFFactor( fac, d));
    1132           do {F/=fac; d--; } while (d>0);
    1133         }
    1134         else
    1135         {
    1136           G = Factorize( fac, minpoly);
    1137           libfac_interruptflag=0;
    1138           for ( k = G; k.hasItem(); ++k )
    1139           {
    1140             fac = k.getItem().factor();
    1141             int dd = k.getItem().exp()*d;
    1142             e=0;
    1143             while ((!fac.isZero())&& fdivides2(fac,F,minpoly) && (dd>0))
    1144             {
    1145 #ifndef NOSTREAMIO
    1146 #ifndef NDEBUG
    1147               out_cf("factor:",fac,"\n");
    1148 #endif
    1149 #endif
    1150               e++;dd--;
    1151               F/=fac;
     1098                  out_cf("factor:",fac,"\n");
     1099#endif
     1100#endif
     1101                  e++;dd--;
     1102                  F/=fac;
     1103                }
     1104                if (e>0) H.append( CFFactor( fac , e ) );
     1105                ++k;
     1106              }
    11521107            }
    1153             if (e>0) H.append( CFFactor( fac , e ) );
    11541108          }
    11551109        }
    1156       }
    1157     }
    1158   }
    1159   if (getNumVars(F)>0)
    1160   {
    1161 #ifndef NOSTREAMIO
     1110        ++i;
     1111      }
     1112    }
     1113  }
     1114  //Outputlist = newfactoras( F, as, 1);
     1115  if((isOn(SW_USE_NTL_SORT))&&(!H.isEmpty())) H.sort(cmpCF);
    11621116#ifndef NDEBUG
    1163     out_cf("rest:",fac,"\n");
    1164 #endif
    1165 #endif
    1166     H.append( CFFactor(F,1) );
    1167   }
    1168   //Outputlist = newfactoras( F, as, 1);
    1169   if(isOn(SW_USE_NTL_SORT)) H.sort(cmpCF);
    1170   libfac_interruptflag=0;
     1117  printf("end Factorize2(%d)\n",libfac_interruptflag);
     1118#endif
    11711119  return H;
    11721120}
     1121
    11731122CFFList
    11741123Factorize(const CanonicalForm & F, const CanonicalForm & minpoly, int is_SqrFree )
     
    13531302/*
    13541303$Log: not supported by cvs2svn $
     1304Revision 1.34  2007/06/02 10:21:57  Singular
     1305*hannes: fdivides2 again
     1306
    13551307Revision 1.33  2007/05/25 16:02:01  Singular
    13561308*hannes: removed diophant_error, format
  • libfac/factor/MVMultiHensel.cc

    rcbc7e3 r927b7e  
    22///////////////////////////////////////////////////////////////////////////////
    33// emacs edit mode for this file is -*- C++ -*-
    4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1.13 2007-05-25 16:02:02 Singular Exp $";
     4// static char * rcsid = "$Id: MVMultiHensel.cc,v 1.14 2007-06-14 14:16:35 Singular Exp $";
    55///////////////////////////////////////////////////////////////////////////////
    66// FACTORY - Includes
     
    3535
    3636#ifdef HAVE_SINGULAR_ERROR
     37extern int libfac_interruptflag;
    3738   extern "C"
    3839   {
     
    4950
    5051#include "debug.h"
     52#include "interrupt.h"
    5153#include "timing.h"
    5254
     
    150152  {
    151153#ifdef HAVE_SINGULAR_ERROR
    152     Werror("libfac: diophant ERROR: degree too large!  (%d + %d <= %d)",degree(F1,levelU), degree(F2,levelU), i);
     154    if (!interrupt_handle()) Werror("libfac: diophant ERROR: degree too large!  (%d + %d <= %d)",degree(F1,levelU), degree(F2,levelU), i);
    153155      //out_cf("F1:",F1,"\n");
    154156      //out_cf("F2:",F2,"\n");
     
    194196      }
    195197#ifdef HAVE_SINGULAR_ERROR
    196       WerrorS("libfac: diophant ERROR: F1 and F2 are not relatively prime! ");
     198      if (!interrupt_handle()) WerrorS("libfac: diophant ERROR: F1 and F2 are not relatively prime! ");
    197199#ifndef NOSTREAMIO
    198200      out_cf("F1:",F1,"\n");
     
    218220    Retvalue.One *= x; // createVar(levelU,1);
    219221    Retvalue.Two *= x; // createVar(levelU,1);
     222
     223    if (interrupt_handle()) return Retvalue;
     224
    220225    // Check degrees.
    221226
     
    271276      intermediate=diophant(levelU,F1,F2,i.exp(),A,B,alpha);
    272277      Retvalue += intermediate.One * i.coeff();
     278
     279      if (interrupt_handle()) return Retvalue;
    273280    }
    274281  }
     
    299306      intermediate=diophant(levelU,F1,F2,i.exp(),A,B,alpha);
    300307      Retvalue += i.coeff() * intermediate.Two;
     308
     309      if (interrupt_handle()) return Retvalue;
    301310    }
    302311  }
     
    371380#endif
    372381    if ( Rk.isZero() ) break;
     382    if (interrupt_handle()) break;
    373383  }
    374384  Retvalue.One = change_poly(Fk,Substitutionlist,1);
     
    510520/*
    511521$Log: not supported by cvs2svn $
     522Revision 1.13  2007/05/25 16:02:02  Singular
     523*hannes: removed diophant_error, format
     524
    512525Revision 1.12  2007/05/22 14:30:53  Singular
    513526*hannes: diophant_error
Note: See TracChangeset for help on using the changeset viewer.