Changeset 0dd641 in git
- Timestamp:
- Jan 23, 2008, 4:42:10 PM (15 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- 6bbc8e2c339d1928744e2f67b390389567caa462
- Parents:
- f24a7f4cb925cec508572ae72f9bf06624119a14
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/clapsing.cc
rf24a7f r0dd641 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 // $Id: clapsing.cc,v 1.2 5 2008-01-15 15:25:44Singular Exp $5 // $Id: clapsing.cc,v 1.26 2008-01-23 15:42:10 Singular Exp $ 6 6 /* 7 7 * ABSTRACT: interface between Singular and factory … … 1163 1163 return res; 1164 1164 } 1165 ideal singclap_sqrfree ( poly f) 1166 { 1167 pTest(f); 1168 #ifdef FACTORIZE2_DEBUG 1169 printf("singclap_sqrfree, degree %d\n",pTotaldegree(f)); 1170 #endif 1171 // with_exps: 3,1 return only true factors, no exponents 1172 // 2 return true factors and exponents 1173 // 0 return coeff, factors and exponents 1174 BOOLEAN save_errorreported=errorreported; 1175 1176 ideal res=NULL; 1177 1178 // handle factorize(0) ========================================= 1179 if (f==NULL) 1180 { 1181 res=idInit(1,1); 1182 return res; 1183 } 1184 // handle factorize(mon) ========================================= 1185 if (pNext(f)==NULL) 1186 { 1187 int i=0; 1188 int n=0; 1189 int e; 1190 for(i=pVariables;i>0;i--) if(pGetExp(f,i)!=0) n++; 1191 n++; // with coeff 1192 res=idInit(si_max(n,1),1); 1193 res->m[0]=pOne(); 1194 pSetCoeff(res->m[0],nCopy(pGetCoeff(f))); 1195 if (n==0) 1196 { 1197 res->m[0]=pOne(); 1198 // (**v)[0]=1; is already done 1199 return res; 1200 } 1201 for(i=pVariables;i>0;i--) 1202 { 1203 e=pGetExp(f,i); 1204 if(e!=0) 1205 { 1206 n--; 1207 poly p=pOne(); 1208 pSetExp(p,i,1); 1209 pSetm(p); 1210 res->m[n]=p; 1211 } 1212 } 1213 return res; 1214 } 1215 //PrintS("S:");pWrite(f);PrintLn(); 1216 // use factory/libfac in general ============================== 1217 Off(SW_RATIONAL); 1218 On(SW_SYMMETRIC_FF); 1219 #ifdef HAVE_NTL 1220 extern int prime_number; 1221 if(rField_is_Q()) prime_number=0; 1222 #endif 1223 CFFList L; 1224 1225 if (!rField_is_Zp() && !rField_is_Zp_a()) /* Q, Q(a) */ 1226 { 1227 //if (f!=NULL) // already tested at start of routine 1228 { 1229 pCleardenom(f); 1230 } 1231 } 1232 else if (rField_is_Zp_a()) 1233 { 1234 //if (f!=NULL) // already tested at start of routine 1235 if (singclap_factorize_retry==0) 1236 { 1237 pNorm(f); 1238 pCleardenom(f); 1239 } 1240 } 1241 if (rField_is_Q() || rField_is_Zp()) 1242 { 1243 setCharacteristic( nGetChar() ); 1244 CanonicalForm F( convSingPFactoryP( f ) ); 1245 L = sqrFree( F, 0 ); 1246 } 1247 #if 0 1248 else if (rField_is_GF()) 1249 { 1250 int c=rChar(currRing); 1251 setCharacteristic( c, primepower(c) ); 1252 CanonicalForm F( convSingGFFactoryGF( f ) ); 1253 if (F.isUnivariate()) 1254 { 1255 L = factorize( F ); 1256 } 1257 else 1258 { 1259 goto notImpl; 1260 } 1261 } 1262 #endif 1263 // and over Q(a) / Fp(a) 1264 else if (rField_is_Extension()) 1265 { 1266 if (rField_is_Q_a()) setCharacteristic( 0 ); 1267 else setCharacteristic( -nGetChar() ); 1268 if (currRing->minpoly!=NULL) 1269 { 1270 CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z); 1271 Variable a=rootOf(mipo); 1272 CanonicalForm F( convSingAPFactoryAP( f,a ) ); 1273 L = sqrFree( F,mipo ); 1274 } 1275 else 1276 { 1277 CanonicalForm F( convSingTrPFactoryP( f ) ); 1278 L = sqrFree( F, 0 ); 1279 } 1280 } 1281 else 1282 { 1283 goto notImpl; 1284 } 1285 { 1286 poly ff=pCopy(f); // a copy for the retry stuff 1287 // convert into ideal 1288 int n = L.length(); 1289 if (n==0) n=1; 1290 CFFListIterator J=L; 1291 int j=0; 1292 res = idInit( n ,1); 1293 for ( ; J.hasItem(); J++, j++ ) 1294 { 1295 poly p; 1296 if (rField_is_Zp() || rField_is_Q()) /* Q, Fp */ 1297 //count_Factors(res,*v,f, j, convFactoryPSingP( J.getItem().factor() ); 1298 res->m[j] = convFactoryPSingP( J.getItem().factor() ); 1299 #if 0 1300 else if (rField_is_GF()) 1301 res->m[j] = convFactoryGFSingGF( J.getItem().factor() ); 1302 #endif 1303 else if (rField_is_Extension()) /* Q(a), Fp(a) */ 1304 { 1305 if (currRing->minpoly==NULL) 1306 res->m[j]=convFactoryPSingTrP( J.getItem().factor() ); 1307 else 1308 res->m[j]=convFactoryAPSingAP( J.getItem().factor() ); 1309 } 1310 } 1311 if (res->m[0]==NULL) 1312 { 1313 res->m[0]=pOne(); 1314 } 1315 } 1316 errorreported=save_errorreported; 1317 notImpl: 1318 if (res==NULL) 1319 WerrorS( feNotImplemented ); 1320 return res; 1321 } 1165 1322 matrix singclap_irrCharSeries ( ideal I) 1166 1323 { -
kernel/clapsing.h
rf24a7f r0dd641 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 // $Id: clapsing.h,v 1. 1.1.1 2003-10-06 12:15:50 Singular Exp $5 // $Id: clapsing.h,v 1.2 2008-01-23 15:42:10 Singular Exp $ 6 6 /* 7 7 * ABSTRACT: interface between Singular and factory … … 32 32 ideal singclap_factorize ( poly f, intvec ** v , int with_exps); 33 33 34 ideal singclap_sqrfree ( poly f ); 35 34 36 matrix singclap_irrCharSeries ( ideal I); 35 37
Note: See TracChangeset
for help on using the changeset viewer.