Changeset 927b7e in git
- Timestamp:
- Jun 14, 2007, 4:16:35 PM (17 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- d8a0328e6cfefb97612f39bd9789312acceee6a5
- Parents:
- cbc7e3a7ea564423342c0c92a78606ddf14433fb
- Location:
- libfac/factor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libfac/factor/Factor.cc
rcbc7e3 r927b7e 1 1 /* Copyright 1996 Michael Messollen. All rights reserved. */ 2 2 /////////////////////////////////////////////////////////////////////////////// 3 static char * rcsid = "$Id: Factor.cc,v 1.3 4 2007-06-02 10:21:57Singular Exp $ ";3 static char * rcsid = "$Id: Factor.cc,v 1.35 2007-06-14 14:16:35 Singular Exp $ "; 4 4 static char * errmsg = "\nYou found a bug!\nPlease inform (Michael Messollen) michael@math.uni-sb.de \nPlease include above information and your input (the ideal/polynomial and characteristic) in your bug-report.\nThank you."; 5 5 /////////////////////////////////////////////////////////////////////////////// … … 1043 1043 CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly ) 1044 1044 { 1045 #ifndef NDEBUG 1046 printf("start Factorize2(int_flag=%d)\n",libfac_interruptflag); 1047 #endif 1045 1048 CFFList G,H; 1046 1049 CanonicalForm fac; … … 1049 1052 libfac_interruptflag=0; 1050 1053 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()) 1059 1067 { 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 { 1060 1074 #ifndef NOSTREAMIO 1061 1075 #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 { 1073 1096 #ifndef NOSTREAMIO 1074 1097 #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 } 1152 1107 } 1153 if (e>0) H.append( CFFactor( fac , e ) );1154 1108 } 1155 1109 } 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); 1162 1116 #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 1171 1119 return H; 1172 1120 } 1121 1173 1122 CFFList 1174 1123 Factorize(const CanonicalForm & F, const CanonicalForm & minpoly, int is_SqrFree ) … … 1353 1302 /* 1354 1303 $Log: not supported by cvs2svn $ 1304 Revision 1.34 2007/06/02 10:21:57 Singular 1305 *hannes: fdivides2 again 1306 1355 1307 Revision 1.33 2007/05/25 16:02:01 Singular 1356 1308 *hannes: removed diophant_error, format -
libfac/factor/MVMultiHensel.cc
rcbc7e3 r927b7e 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 // emacs edit mode for this file is -*- C++ -*- 4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1.1 3 2007-05-25 16:02:02Singular Exp $";4 // static char * rcsid = "$Id: MVMultiHensel.cc,v 1.14 2007-06-14 14:16:35 Singular Exp $"; 5 5 /////////////////////////////////////////////////////////////////////////////// 6 6 // FACTORY - Includes … … 35 35 36 36 #ifdef HAVE_SINGULAR_ERROR 37 extern int libfac_interruptflag; 37 38 extern "C" 38 39 { … … 49 50 50 51 #include "debug.h" 52 #include "interrupt.h" 51 53 #include "timing.h" 52 54 … … 150 152 { 151 153 #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); 153 155 //out_cf("F1:",F1,"\n"); 154 156 //out_cf("F2:",F2,"\n"); … … 194 196 } 195 197 #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! "); 197 199 #ifndef NOSTREAMIO 198 200 out_cf("F1:",F1,"\n"); … … 218 220 Retvalue.One *= x; // createVar(levelU,1); 219 221 Retvalue.Two *= x; // createVar(levelU,1); 222 223 if (interrupt_handle()) return Retvalue; 224 220 225 // Check degrees. 221 226 … … 271 276 intermediate=diophant(levelU,F1,F2,i.exp(),A,B,alpha); 272 277 Retvalue += intermediate.One * i.coeff(); 278 279 if (interrupt_handle()) return Retvalue; 273 280 } 274 281 } … … 299 306 intermediate=diophant(levelU,F1,F2,i.exp(),A,B,alpha); 300 307 Retvalue += i.coeff() * intermediate.Two; 308 309 if (interrupt_handle()) return Retvalue; 301 310 } 302 311 } … … 371 380 #endif 372 381 if ( Rk.isZero() ) break; 382 if (interrupt_handle()) break; 373 383 } 374 384 Retvalue.One = change_poly(Fk,Substitutionlist,1); … … 510 520 /* 511 521 $Log: not supported by cvs2svn $ 522 Revision 1.13 2007/05/25 16:02:02 Singular 523 *hannes: removed diophant_error, format 524 512 525 Revision 1.12 2007/05/22 14:30:53 Singular 513 526 *hannes: diophant_error
Note: See TracChangeset
for help on using the changeset viewer.