Changeset a3337a in git
- Timestamp:
- Nov 29, 2012, 8:48:28 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- d6283902d593a8accfa74862cafcd05348f70d1a
- Parents:
- 91c7251b522fe5741414bc172467ac24df89485d
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-11-29 20:48:28+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:49+02:00
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/schreyer.lib
r91c7251 ra3337a 2153 2153 exportto(Schreyer, Syzextra::SchreyerSyzygyNF); 2154 2154 exportto(Schreyer, Syzextra::ComputeSyzygy); 2155 2156 exportto(Schreyer, Syzextra::ComputeResolution); 2155 2157 } 2156 2158 /* … … 2205 2207 exportto(Schreyer, Syzextra_g::SchreyerSyzygyNF); 2206 2208 exportto(Schreyer, Syzextra_g::ComputeSyzygy); 2209 2210 exportto(Schreyer, Syzextra_g::ComputeResolution); 2207 2211 } 2208 2212 */ … … 2274 2278 int i, j; 2275 2279 int f = 0; 2276 def m ;2280 def m, mm; 2277 2281 2278 2282 for (i = size(@save_res_list); i > 0; i--) … … 2287 2291 for (j = i-1; j > 0; j--) 2288 2292 { 2289 if( m != @save_res_list[j][4] ) 2293 mm = @save_res_list[j][4]; 2294 if( (nrows(m) != nrows(mm)) || (ncols(m) != ncols(mm)) ) 2290 2295 { 2291 "ERROR: Betti[j: ", j, "] != Betti[i: ", i, "]:";2292 2293 2294 2296 "ERROR: SIZE(Betti[j: ", j, "]) != SIZE(Betti[i: ", i, "]):"; 2297 "j: ", j; 2298 print( @save_res_list[j][4], "betti"); 2299 print(@save_res_list[j]); 2295 2300 2296 2297 2298 2301 "i: ", i; 2302 print( @save_res_list[i][4], "betti"); 2303 print(@save_res_list[i]); 2299 2304 2300 2305 f = 1; 2306 2307 } else 2308 { 2309 if( m != mm ) 2310 { 2311 "ERROR: Betti[j: ", j, "] != Betti[i: ", i, "]:"; 2312 "j: ", j; 2313 print( @save_res_list[j][4], "betti"); 2314 print(@save_res_list[j]); 2315 2316 "i: ", i; 2317 print( @save_res_list[i][4], "betti"); 2318 print(@save_res_list[i]); 2319 2320 f = 1; 2321 }; 2301 2322 }; 2302 2323 … … 2433 2454 if(@PROFILE){ProfilerStop();} 2434 2455 setring R;module M;list @l=list();@l[size(RES)-1]=list();r=nrows(RES[1]);for(i=2;i<=size(RES);i++){M=RES[i];rr=nrows(M);if((r>0)&&(size(M)>0)&&(r<rr)){M=transpose(M);M=M[(r+1)..ncols(M)];M=transpose(M);RES[i]=M;};r=rr;@l[i-1] = M;};resolution RR=@l;RR=minres(RR);def S=betti(RR,1);@t=rtimer; 2456 DetailedPrint(RR,0); 2457 SCheck(R); 2458 StopAddResTest(RR, S, @t,@m); 2459 kill S, RR; setring save; kill R; 2460 } 2461 2462 proc TestSSSres(def I) 2463 { 2464 def save = basering; 2465 int @t,@m,r,rr,i; 2466 string name = 2467 "LEAD2SYZ:" +string(attrib(SSinit,"LEAD2SYZ")) + 2468 ",TAILREDSYZ:"+string(attrib(SSinit,"TAILREDSYZ")) + 2469 ",HYBRIDNF:" +string(attrib(SSinit,"HYBRIDNF")); 2470 2471 int @PROFILE = attrib(SSinit, "PROFILE"); 2472 if(@PROFILE){ string @prof = "SSSres_" + @save_res_desc + "_" + name + ".prof"; } 2473 2474 StartAddResTest( 2475 "SSSres", 2476 "minres + betti(,1) + mods: {" + name + "}" 2477 ); 2478 2479 option(redSB); option(redTail); 2480 if(@PROFILE){ProfilerStart(@prof);} 2481 timer=0;rtimer=0;def R=SSinit(I);setring R;def RR=ComputeResolution(RES[2], LRES[2], TRES[2], 0); 2482 @m=rtimer; 2483 if(@PROFILE){ProfilerStop();} 2484 RR=minres(RR);def S=betti(RR,1);@t=rtimer; 2485 // DetailedPrint(RR,0); print(RR); print(S, "betti"); 2435 2486 SCheck(R); 2436 2487 StopAddResTest(RR, S, @t,@m); … … 2509 2560 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M); 2510 2561 2511 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSres(M); 2512 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M); 2562 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M); 2563 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M); 2564 2565 2513 2566 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M); 2514 2567 … … 2527 2580 StartResTesting(#); 2528 2581 2529 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSS res(M);2530 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSS res(M);2531 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSS res(M);2532 2533 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSS res(M);2534 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSS res(M);2535 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSS res(M);2582 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M); 2583 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M); 2584 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M); 2585 2586 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M); 2587 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M); 2588 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M); 2536 2589 2537 2590 -
dyn_modules/syzextra/mod_main.cc
r91c7251 ra3337a 16 16 #include <polys/monomials/p_polys.h> 17 17 #include <polys/monomials/ring.h> 18 #include <polys/simpleideals.h> 19 18 20 // #include <kernel/longrat.h> 19 21 #include <kernel/GBEngine/kstd1.h> … … 389 391 PRINT_RESOLUTION(syzstr, fullres); 390 392 391 assume (id_RankFreeModule (syzstr->res[1], rr) == syzstr->res[1]->rank);393 // assume (id_RankFreeModule (syzstr->res[1], rr) == syzstr->res[1]->rank); 392 394 393 395 PRINT_RESOLUTION(syzstr, res); … … 1113 1115 1114 1116 1117 static BOOLEAN _ComputeResolution(leftv res, leftv h) 1118 { 1119 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 1120 1121 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 1122 1123 const char* usage = "`ComputeResolution(<ideal/module>[,int])` expected"; 1124 const ring r = attributes.m_rBaseRing; 1125 1126 NoReturn(res); 1127 1128 // input 1129 if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL)) 1130 { 1131 WerrorS(usage); 1132 return TRUE; 1133 } 1134 1135 ideal M = (ideal)(h->CopyD()); // copy for resolution...!??? 1136 int size = IDELEMS(M); 1137 1138 assume( size >= 0 ); 1139 1140 h = h->Next(); 1141 1142 // lead 1143 if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL)) 1144 { 1145 WerrorS(usage); 1146 return TRUE; 1147 } 1148 1149 ideal L = (ideal)(h->CopyD()); // no copy! 1150 assume( IDELEMS(L) == size ); 1151 1152 h = h->Next(); 1153 1154 // tail 1155 if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL)) 1156 { 1157 WerrorS(usage); 1158 return TRUE; 1159 } 1160 1161 ideal T = (ideal)(h->CopyD()); // no copy! 1162 assume( IDELEMS(T) == size ); 1163 1164 h = h->Next(); 1165 1166 // length..? 1167 long length = 0; 1168 1169 if ((h!=NULL) && (h->Typ()==INT_CMD)) 1170 { 1171 length = (long)(h->Data()); 1172 h = h->Next(); 1173 } 1174 1175 assume( h == NULL ); 1176 1177 if( length <= 0 ) 1178 length = 1 + rVar(r); 1179 1180 if( __DEBUG__ ) 1181 { 1182 PrintS("ComputeResolution(M, length)::Input: \n"); 1183 Print( "starting length: %ld\n", length); 1184 PrintS("M: \n"); dPrint(M, r, r, 0); 1185 PrintS("L=LEAD(M): \n"); dPrint(L, r, r, 1); 1186 PrintS("T=TAIL(M): \n"); dPrint(T, r, r, 0); 1187 } 1188 1189 1190 syStrategy _res=(syStrategy)omAlloc0(sizeof(ssyStrategy)); 1191 1192 // class ssyStrategy; typedef ssyStrategy * syStrategy; 1193 // typedef ideal * resolvente; 1194 1195 _res->length = length + 1; // index + 1; 1196 _res->fullres = (resolvente)omAlloc0((_res->length)*sizeof(ideal)); 1197 int index = 0; 1198 _res->fullres[index++] = M; 1199 1200 while( (!idIs0(L)) && (index < length)) 1201 { 1202 ideal LL, TT; 1203 ComputeSyzygy(L, T, LL, TT, attributes); 1204 1205 if( __DEBUG__ ) 1206 { 1207 Print("ComputeResolution()::Separated Syzygy[%d]: \n", index); 1208 PrintS("LL: \n"); dPrint(LL, r, r, 1); 1209 PrintS("TT: \n"); dPrint(TT, r, r, 2); 1210 } 1211 size = IDELEMS(LL); 1212 1213 assume( size == IDELEMS(TT) ); 1214 1215 id_Delete(&L, r); id_Delete(&T, r); 1216 1217 L = LL; T = TT; 1218 1219 // id_Add(T, L, r); 1220 M = idInit(size, 0); 1221 for( int i = size-1; i >= 0; i-- ) 1222 { 1223 M->m[i] = p_Add_q(p_Copy(T->m[i], r), p_Copy(L->m[i], r), r); // TODO: :((( 1224 } 1225 M->rank = id_RankFreeModule(M, r); 1226 1227 if( __DEBUG__ ) 1228 { 1229 Print("ComputeResolution()::Restored Syzygy[%d]: \n", index); 1230 PrintS("M = LL + TT: \n"); dPrint(M, r, r, 0); 1231 } 1232 1233 _res->fullres[index++] = M; // ??? 1234 } 1235 1236 id_Delete(&L, r); id_Delete(&T, r); 1237 1238 res->data = _res; 1239 res->rtyp = RESOLUTION_CMD; 1240 1241 if( __DEBUG__ ) 1242 { 1243 Print("ComputeResolution::Output (index: %d): ", index); 1244 // class sleftv; typedef sleftv * leftv; 1245 sleftv _h; 1246 DetailedPrint(&_h, res); 1247 } 1248 1249 // omFreeSize(_res, sizeof(ssyStrategy)); 1250 1251 return FALSE; 1252 1253 } 1254 1255 1115 1256 /// module (LL, TT) = SSComputeSyzygy(L, T); 1116 1257 /// Compute Syz(L ++ T) = N = LL ++ TT … … 1126 1267 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 1127 1268 1128 const char* usage = "`ComputeSyzygy(<ideal/module>, <ideal/module> ])` expected";1269 const char* usage = "`ComputeSyzygy(<ideal/module>, <ideal/module>)` expected"; 1129 1270 const ring r = attributes.m_rBaseRing; 1130 1271 … … 1826 1967 ADD(psModulFunctions, currPack->libname, "SchreyerSyzygyNF", FALSE, _SchreyerSyzygyNF); 1827 1968 ADD(psModulFunctions, currPack->libname, "ComputeSyzygy", FALSE, _ComputeSyzygy); 1828 1829 // ADD(psModulFunctions, currPack->libname, "GetAMData", FALSE, GetAMData); 1969 1970 ADD(psModulFunctions, currPack->libname, "ComputeResolution", FALSE, _ComputeResolution); 1971 // ADD(psModulFunctions, currPack->libname, "GetAMData", FALSE, GetAMData); 1830 1972 1831 1973 // ADD(psModulFunctions, currPack->libname, "", FALSE, );
Note: See TracChangeset
for help on using the changeset viewer.