Changeset b5ae52 in git
- Timestamp:
- Oct 15, 1997, 9:58:54 AM (27 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 309f679293c6bbca5f6a90d4264f81251290c122
- Parents:
- 499bdc5e258e4f3d05720339759579c6bf80618c
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/hdegree.cc
r499bdc rb5ae52 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: hdegree.cc,v 1. 4 1997-04-02 15:07:01 Singular Exp $ */4 /* $Id: hdegree.cc,v 1.5 1997-10-15 07:58:51 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - dimension, multiplicity, HC, kbase … … 16 16 #include "polys.h" 17 17 #include "intvec.h" 18 #include "numbers.h" 18 19 #include "hutil.h" 19 20 #include "stairc.h" … … 1092 1093 // kbase 1093 1094 1094 static polyset Kbase; 1095 static int count; 1096 1097 static void scInKbase( poly p, int start) 1098 { 1099 int i, j; 1100 poly q; 1101 scmon x; 1102 for (i = 0; i < hNstc; i++) 1103 { 1104 x = hstc[i]; 1105 j = pVariables; 1095 static poly last; 1096 static scmon act; 1097 1098 static void scElKbase() 1099 { 1100 poly q = pNew(); 1101 pSetCoeff0(q,nInit(1)); 1102 pSetExpV(q,act); 1103 pSetm(q); 1104 pNext(q) = NULL; 1105 last = pNext(last) = q; 1106 } 1107 1108 static short scMax( int i, scfmon stc, int Nvar) 1109 { 1110 short x, y=stc[0][Nvar]; 1111 for (; i;) 1112 { 1113 i--; 1114 x = stc[i][Nvar]; 1115 if (x > y) y = x; 1116 } 1117 return y; 1118 } 1119 1120 static short scMin( int i, scfmon stc, int Nvar) 1121 { 1122 short x, y=stc[0][Nvar]; 1123 for (; i;) 1124 { 1125 i--; 1126 x = stc[i][Nvar]; 1127 if (x < y) y = x; 1128 } 1129 return y; 1130 } 1131 1132 static short scRestrict( int &Nstc, scfmon stc, int Nvar) 1133 { 1134 unsigned short x, y; 1135 int i, j, Istc = Nstc; 1136 1137 y = 0XFFFF; 1138 for (i=Nstc-1; i>=0; i--) 1139 { 1140 j = Nvar-1; 1106 1141 loop 1107 1142 { 1108 if (x[j] > p->exp[j]) 1143 if(stc[i][j] != 0) break; 1144 j--; 1145 if (j == 0) 1146 { 1147 Istc--; 1148 x = stc[i][Nvar]; 1149 if (x < y) y = x; 1150 stc[i] = NULL; 1109 1151 break; 1110 j--; 1111 if (j==0) 1112 { 1113 pDelete1(&p); 1114 return; 1115 } 1116 } 1117 } 1118 pSetm(p); 1119 Kbase[count] = p; 1120 count++; 1121 for (i = start; i <= pVariables; i++) 1122 { 1123 q = pCopy(p); 1124 q->exp[i]++; 1125 scInKbase(q, i); 1126 } 1127 } 1128 1129 1130 extern ideal scKBase(ideal s, ideal Q) 1131 { 1132 int i, a; 1152 } 1153 } 1154 } 1155 if (Istc < Nstc) 1156 { 1157 j = 0; 1158 while (stc[j]) j++; 1159 i = j+1; 1160 for(; i<Nstc; i++) 1161 { 1162 if (stc[i]) 1163 { 1164 stc[j] = stc[i]; 1165 j++; 1166 } 1167 } 1168 Nstc = Istc; 1169 return y; 1170 } 1171 else 1172 return -1; 1173 } 1174 1175 static void scAll( int Nvar, short deg) 1176 { 1177 int i; 1178 short d = deg; 1179 if (d == 0) 1180 { 1181 for (i=Nvar; i; i--) act[i] = 0; 1182 scElKbase(); 1183 return; 1184 } 1185 if (Nvar == 1) 1186 { 1187 act[1] = d; 1188 scElKbase(); 1189 return; 1190 } 1191 do 1192 { 1193 act[Nvar] = d; 1194 scAll(Nvar-1, deg-d); 1195 d--; 1196 } while (d >= 0); 1197 } 1198 1199 static void scAllKbase( int Nvar, short ideg, short deg) 1200 { 1201 do 1202 { 1203 act[Nvar] = ideg; 1204 scAll(Nvar-1, deg-ideg); 1205 ideg--; 1206 } while (ideg >= 0); 1207 } 1208 1209 static void scDegKbase( scfmon stc, int Nstc, int Nvar, short deg) 1210 { 1211 int Ivar, Istc, i, j; 1212 scfmon sn; 1213 short x, ideg; 1214 1215 if (deg == 0) 1216 { 1217 for (i=Nvar; i; i--) act[i] = 0; 1218 scElKbase(); 1219 return; 1220 } 1221 if (Nvar == 1) 1222 { 1223 for (i=Nstc-1; i>=0; i--) if(deg >= stc[i][1]) return; 1224 act[1] = deg; 1225 scElKbase(); 1226 return; 1227 } 1228 Ivar = Nvar-1; 1229 sn = hGetmem(Nstc, stc, stcmem[Ivar]); 1230 x = scRestrict(Nstc, sn, Nvar); 1231 if (x < 0) ideg = deg; 1232 else 1233 { 1234 if (Nstc == 0) 1235 { 1236 if (deg >= x) return; 1237 act[Nvar] = deg; 1238 for (i=Ivar; i; i--) act[i] = 0; 1239 scElKbase(); 1240 return; 1241 } 1242 if (deg < x) ideg = deg; 1243 else ideg = x-1; 1244 } 1245 loop 1246 { 1247 x = scMax(Nstc, sn, Nvar); 1248 while (ideg >= x) 1249 { 1250 act[Nvar] = ideg; 1251 scDegKbase(sn, Nstc, Ivar, deg-ideg); 1252 ideg--; 1253 } 1254 if (ideg < 0) return; 1255 Istc = Nstc; 1256 for (i=Nstc-1; i>=0; i--) 1257 { 1258 if (ideg < sn[i][Nvar]) 1259 { 1260 Istc--; 1261 sn[i] = NULL; 1262 } 1263 } 1264 if (Istc == 0) 1265 { 1266 scAllKbase(Nvar, ideg, deg); 1267 return; 1268 } 1269 j = 0; 1270 while (sn[j]) j++; 1271 i = j+1; 1272 for (; i<Nstc; i++) 1273 { 1274 if (sn[i]) 1275 { 1276 sn[j] = sn[i]; 1277 j++; 1278 } 1279 } 1280 Nstc = Istc; 1281 } 1282 } 1283 1284 static void scInKbase( scfmon stc, int Nstc, int Nvar) 1285 { 1286 int Ivar, Istc, i, j; 1287 scfmon sn; 1288 short x, ideg; 1289 1290 if (Nvar == 1) 1291 { 1292 ideg = scMin(Nstc, stc, 1); 1293 while (ideg > 0) 1294 { 1295 ideg--; 1296 act[1] = ideg; 1297 scElKbase(); 1298 } 1299 return; 1300 } 1301 Ivar = Nvar-1; 1302 sn = hGetmem(Nstc, stc, stcmem[Ivar]); 1303 x = scRestrict(Nstc, sn, Nvar); 1304 if (Nstc == 0) 1305 { 1306 if (x == 0) return; 1307 for (i=Ivar; i; i--) act[i] = 0; 1308 do 1309 { 1310 x--; 1311 act[Nvar] = x; 1312 scElKbase(); 1313 } while(x > 0); 1314 return; 1315 } 1316 ideg = x-1; 1317 loop 1318 { 1319 x = scMax(Nstc, sn, Nvar); 1320 while (ideg >= x) 1321 { 1322 act[Nvar] = ideg; 1323 scInKbase(sn, Nstc, Ivar); 1324 ideg--; 1325 } 1326 if (ideg < 0) return; 1327 Istc = Nstc; 1328 for (i=Nstc-1; i>=0; i--) 1329 { 1330 if (ideg < sn[i][Nvar]) 1331 { 1332 Istc--; 1333 sn[i] = NULL; 1334 } 1335 } 1336 j = 0; 1337 while (sn[j]) j++; 1338 i = j+1; 1339 for (; i<Nstc; i++) 1340 { 1341 if (sn[i]) 1342 { 1343 sn[j] = sn[i]; 1344 j++; 1345 } 1346 } 1347 Nstc = Istc; 1348 } 1349 } 1350 1351 static ideal scIdKbase() 1352 { 1353 polyset mm; 1354 ideal res; 1355 poly p, q = last; 1356 int i = pLength(q); 1357 res = idInit(i,1); 1358 mm = res->m; 1359 i = 0; 1360 do 1361 { 1362 mm[i] = q; 1363 i++; 1364 p = pNext(q); 1365 pNext(q) = NULL; 1366 q = p; 1367 } while (q); 1368 return res; 1369 } 1370 1371 extern ideal scKBase(int deg, ideal s, ideal Q) 1372 { 1373 int i, di; 1133 1374 poly p; 1134 ideal res; 1135 a = scMult0Int(s, Q); 1136 if (a <= 0) 1137 return idInit(1,s->rank); 1138 res = idInit(a,s->rank); 1139 Kbase = res->m; 1375 1376 if (deg < 0) 1377 { 1378 di = scDimInt(s, Q); 1379 if (di != 0) 1380 { 1381 Werror("KBase not finite"); 1382 return idInit(1,0); 1383 } 1384 } 1385 stcmem = hCreate(pVariables - 1); 1140 1386 hexist = hInit(s, Q, &hNexist); 1141 count = 0; 1387 p = last = pNew(); 1388 pNext(p) = NULL; 1389 act = (scmon)Alloc((pVariables + 1) * sizeof(short)); 1390 *act = 0; 1391 if (!hNexist) 1392 { 1393 scAll(pVariables, deg); 1394 goto ende; 1395 } 1142 1396 if (!hisModule) 1143 1397 { 1144 hstc = hexist; 1145 hNstc = hNexist; 1146 p = pOne(); 1147 scInKbase(p, 1); 1398 if (deg < 0) scInKbase(hexist, hNexist, pVariables); 1399 else scDegKbase(hexist, hNexist, pVariables, deg); 1148 1400 } 1149 1401 else … … 1152 1404 for (i = 1; i <= hisModule; i++) 1153 1405 { 1406 *act = i; 1154 1407 hComp(hexist, hNexist, i, hstc, &hNstc); 1155 1408 if (hNstc) 1156 1409 { 1157 p = pOne(); 1158 p->exp[0] = i; 1159 scInKbase(p, 1); 1160 } 1410 if (deg < 0) scInKbase(hstc, hNstc, pVariables); 1411 else scDegKbase(hstc, hNstc, pVariables, deg); 1412 } 1413 else 1414 scAll(pVariables, deg); 1161 1415 } 1162 1416 Free((ADDRESS)hstc, hNexist * sizeof(scmon)); 1163 1417 } 1418 ende: 1164 1419 Free((ADDRESS)hexist, hNexist * sizeof(scmon)); 1165 return res; 1166 } 1167 1168 1420 Free((ADDRESS)act, (pVariables + 1) * sizeof(short)); 1421 hKill(stcmem, pVariables - 1); 1422 pDelete1(&p); 1423 if (p == NULL) 1424 return idInit(1,0); 1425 else 1426 { 1427 last = p; 1428 return scIdKbase(); 1429 } 1430 } 1431 1432 1433 -
Singular/iparith.cc
r499bdc rb5ae52 184 184 { "jacob", 0, JACOB_CMD , CMD_1}, 185 185 { "jet", 0, JET_CMD , CMD_23}, 186 { "kbase", 0, KBASE_CMD , CMD_1 },186 { "kbase", 0, KBASE_CMD , CMD_12}, 187 187 { "keepring", 0, KEEPRING_CMD , KEEPRING_CMD}, 188 188 { "kill", 0, KILL_CMD , KILL_CMD}, … … 1538 1538 { 1539 1539 res->data = (char *)idJet((ideal)u->Data(),(int)v->Data()); 1540 return FALSE; 1541 } 1542 static BOOLEAN jjKBASE2(leftv res, leftv u, leftv v) 1543 { 1544 assumeStdFlag(u); 1545 res->data = (char *)scKBase((int)v->Data(), 1546 (ideal)(u->Data()),currQuotient); 1540 1547 return FALSE; 1541 1548 } … … 2039 2046 ,{jjJET_P, JET_CMD, VECTOR_CMD, VECTOR_CMD, INT_CMD PROFILER} 2040 2047 ,{jjJET_ID, JET_CMD, MODUL_CMD, MODUL_CMD, INT_CMD PROFILER} 2048 ,{jjKBASE2, KBASE_CMD, IDEAL_CMD, IDEAL_CMD, INT_CMD PROFILER} 2049 ,{jjKBASE2, KBASE_CMD, MODUL_CMD, MODUL_CMD, INT_CMD PROFILER} 2041 2050 ,{atKILLATTR2, KILLATTR_CMD, NONE, IDHDL, STRING_CMD PROFILER} 2042 2051 ,{jjKoszul, KOSZUL_CMD, MATRIX_CMD, INT_CMD, INT_CMD PROFILER} … … 2449 2458 { 2450 2459 assumeStdFlag(v); 2451 res->data = (char *)scKBase( (ideal)(v->Data()),currQuotient);2460 res->data = (char *)scKBase(-1,(ideal)(v->Data()),currQuotient); 2452 2461 return FALSE; 2453 2462 } -
Singular/stairc.h
r499bdc rb5ae52 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: stairc.h,v 1. 3 1997-04-09 12:20:13Singular Exp $ */6 /* $Id: stairc.h,v 1.4 1997-10-15 07:58:54 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 20 20 void scDegree(ideal s,ideal Q=NULL); 21 21 22 ideal scKBase(i deal s, ideal Q=NULL);22 ideal scKBase(int deg, ideal s, ideal Q=NULL); 23 23 //void scHilbertPoly(ideal s,ideal Q=NULL); 24 24 //intvec *scHilbert(ideal s,ideal Q=NULL); … … 35 35 #endif 36 36 37
Note: See TracChangeset
for help on using the changeset viewer.