Changeset b45eec in git for kernel/ideals.cc
- Timestamp:
- Apr 19, 2020, 9:57:14 PM (4 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- ffcf715a570941627bf020648e93955f1596f2ef
- Parents:
- d49a473d44aa25c5ecc3126360ab3179ddb8af7e636fa5455e699fa8c0a820dd60e00a059f96f8ef
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ideals.cc
rd49a47 rb45eec 206 206 if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank); 207 207 208 BITSET save_opt; 209 SI_SAVE_OPT1(save_opt); 210 si_opt_1 |= Sy_bit(OPT_REDTAIL_SYZ); 211 208 212 ideal first,second,temp,temp1,result; 209 213 poly p,q; … … 404 408 405 409 idSkipZeroes(result); 410 SI_RESTORE_OPT1(save_opt); 406 411 if (TEST_OPT_RETURN_SB) 407 412 { … … 793 798 idTest(s_h1); 794 799 800 BITSET save_opt; 801 SI_SAVE_OPT1(save_opt); 802 si_opt_1|=Sy_bit(OPT_REDTAIL_SYZ); 803 795 804 ideal s_h3=idPrepare(s_h1,h,k,w,alg); // main (syz) GB computation 805 806 SI_RESTORE_OPT1(save_opt); 796 807 797 808 if (s_h3==NULL) … … 1099 1110 } 1100 1111 1112 static void idLift_setUnit(int e_mod, matrix *unit) 1113 { 1114 if (unit!=NULL) 1115 { 1116 *unit=mpNew(e_mod,e_mod); 1117 // make sure that U is a diagonal matrix of units 1118 for(int i=e_mod;i>0;i--) 1119 { 1120 MATELEM(*unit,i,i)=pOne(); 1121 } 1122 } 1123 } 1101 1124 /*2 1102 1125 *computes a representation of the generators of submod with respect to those … … 1109 1132 int lsmod =id_RankFreeModule(submod,currRing), j, k; 1110 1133 int comps_to_add=0; 1134 int idelems_mod=IDELEMS(mod); 1135 int idelems_submod=IDELEMS(submod); 1111 1136 poly p; 1112 1137 1113 1138 if (idIs0(submod)) 1114 1139 { 1115 if (unit!=NULL)1116 {1117 *unit=mpNew(1,1);1118 MATELEM(*unit,1,1)=pOne();1119 }1120 1140 if (rest!=NULL) 1121 1141 { 1122 1142 *rest=idInit(1,mod->rank); 1123 1143 } 1124 return idInit(1,mod->rank); 1144 idLift_setUnit(idelems_submod,unit); 1145 return idInit(1,idelems_mod); 1125 1146 } 1126 1147 if (idIs0(mod)) /* and not idIs0(submod) */ 1127 1148 { 1128 WerrorS("2nd module does not lie in the first"); 1129 return NULL; 1149 if (rest!=NULL) 1150 { 1151 *rest=idCopy(submod); 1152 idLift_setUnit(idelems_submod,unit); 1153 return idInit(1,idelems_mod); 1154 } 1155 else 1156 { 1157 WerrorS("2nd module does not lie in the first"); 1158 return NULL; 1159 } 1130 1160 } 1131 1161 if (unit!=NULL) 1132 1162 { 1133 comps_to_add = IDELEMS(submod);1163 comps_to_add = idelems_submod; 1134 1164 while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL)) 1135 1165 comps_to_add--; … … 1210 1240 if (!divide) 1211 1241 { 1212 if ( isSB)1242 if (rest==NULL) 1213 1243 { 1214 WarnS("first module not a standardbasis\n" 1244 if (isSB) 1245 { 1246 WarnS("first module not a standardbasis\n" 1215 1247 "// ** or second not a proper submodule"); 1248 } 1249 else 1250 WerrorS("2nd module does not lie in the first"); 1216 1251 } 1217 else1218 WerrorS("2nd module does not lie in the first");1219 1252 idDelete(&s_result); 1220 1253 idDelete(&s_rest); 1221 s_result=idInit(IDELEMS(submod),submod->rank); 1222 break; 1254 if(syz_ring!=orig_ring) 1255 { 1256 idDelete(&s_mod); 1257 rChangeCurrRing(orig_ring); 1258 rDelete(syz_ring); 1259 } 1260 if (unit!=NULL) 1261 { 1262 idLift_setUnit(idelems_submod,unit); 1263 } 1264 if (rest!=NULL) *rest=idCopy(submod); 1265 s_result=idInit(idelems_submod,idelems_mod); 1266 return s_result; 1223 1267 } 1224 1268 else … … 1253 1297 } 1254 1298 if (rest!=NULL) 1299 { 1300 s_rest->rank=mod->rank; 1255 1301 *rest = s_rest; 1302 } 1256 1303 else 1257 1304 idDelete(&s_rest); … … 1259 1306 if (unit!=NULL) 1260 1307 { 1261 *unit=mpNew( comps_to_add,comps_to_add);1308 *unit=mpNew(idelems_submod,idelems_submod); 1262 1309 int i; 1263 1310 for(i=0;i<IDELEMS(s_result);i++) … … 1292 1339 } 1293 1340 } 1341 s_result->rank=idelems_mod; 1294 1342 return s_result; 1295 1343 } … … 1510 1558 #endif 1511 1559 ideal s_h3; 1560 BITSET old_test1; 1561 SI_SAVE_OPT1(old_test1); 1562 if (TEST_OPT_RETURN_SB) si_opt_1 |= Sy_bit(OPT_REDTAIL_SYZ); 1512 1563 if (addOnlyOne) 1513 1564 { 1514 BITSET old_test1;1515 SI_SAVE_OPT1(old_test1);1516 1565 if(!rField_is_Ring(currRing)) si_opt_1 |= Sy_bit(OPT_SB_1); 1517 1566 s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1); 1518 SI_RESTORE_OPT1(old_test1);1519 1567 } 1520 1568 else … … 1522 1570 s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1); 1523 1571 } 1572 SI_RESTORE_OPT1(old_test1); 1524 1573 #if 0 1525 1574 // only together with the above debug stuff … … 1894 1943 p_Delete(&q,currRing); 1895 1944 } 1896 1945 } 1897 1946 /*delete the matrix tmp*/ 1898 1947 for (i=1; i<=ar; i++) … … 2329 2378 2330 2379 idTest(s_temp); 2331 unsigned save_opt=si_opt_1; 2380 unsigned save_opt; 2381 SI_SAVE_OPT1(save_opt); 2332 2382 si_opt_1 |= Sy_bit(OPT_REDTAIL_SYZ); 2333 2383 ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length); 2334 si_opt_1=save_opt;2384 SI_RESTORE_OPT1(save_opt); 2335 2385 2336 2386 //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn(); … … 2895 2945 // if (mm[i]!=0) Print("x_%d:%d ",i,mm[i]); 2896 2946 //PrintLn(); 2897 memset(&strat->P,0,sizeof(strat->P)); 2947 strat->P.Init(currRing); 2948 //memset(&strat->P,0,sizeof(strat->P)); 2898 2949 strat->P.tailRing = strat->tailRing; 2899 2950 strat->P.p=p; … … 2946 2997 // if (mm[i]!=0) Print("x_%d:%d ",i,mm[i]); 2947 2998 //PrintLn(); 2948 memset(&strat->P,0,sizeof(strat->P)); 2999 strat->P.Init(currRing); 3000 //memset(&strat->P,0,sizeof(strat->P)); 2949 3001 strat->P.tailRing = strat->tailRing; 2950 3002 strat->P.t_p=p;
Note: See TracChangeset
for help on using the changeset viewer.