| 1418 | } |
| 1419 | |
| 1420 | ideal scKBase(int deg, ideal s, ideal Q, intvec * mv) |
| 1421 | { |
| 1422 | if( Q!=NULL) id_Test(Q, currRing); |
| 1423 | |
| 1424 | int i, di; |
| 1425 | poly p; |
| 1426 | |
| 1427 | if (deg < 0) |
| 1428 | { |
| 1429 | di = scDimInt(s, Q); |
| 1430 | if (di != 0) |
| 1431 | { |
| 1432 | //Werror("KBase not finite"); |
| 1433 | return idInit(1,s->rank); |
| 1434 | } |
| 1435 | } |
| 1436 | stcmem = hCreate((currRing->N) - 1); |
| 1437 | hexist = hInit(s, Q, &hNexist); |
| 1438 | p = last = pInit(); |
| 1439 | /*pNext(p) = NULL;*/ |
| 1440 | act = (scmon)omAlloc(((currRing->N) + 1) * sizeof(int)); |
| 1441 | *act = 0; |
| 1442 | if (!hNexist) |
| 1443 | { |
| 1444 | scAll((currRing->N), deg); |
| 1445 | goto ende; |
| 1446 | } |
| 1447 | if (!hisModule) |
| 1448 | { |
| 1449 | if (deg < 0) scInKbase(hexist, hNexist, (currRing->N)); |
| 1450 | else scDegKbase(hexist, hNexist, (currRing->N), deg); |
| 1451 | } |
| 1452 | else |
| 1453 | { |
| 1454 | hstc = (scfmon)omAlloc(hNexist * sizeof(scmon)); |
| 1455 | for (i = 1; i <= hisModule; i++) |
| 1456 | { |
| 1457 | *act = i; |
| 1458 | hComp(hexist, hNexist, i, hstc, &hNstc); |
| 1459 | int deg_ei=deg; |
| 1460 | if (mv!=NULL) deg_ei -= (*mv)[i-1]; |
| 1461 | if ((deg < 0) || (deg_ei>=0)) |
| 1462 | { |
| 1463 | if (hNstc) |
| 1464 | { |
| 1465 | if (deg < 0) scInKbase(hstc, hNstc, (currRing->N)); |
| 1466 | else scDegKbase(hstc, hNstc, (currRing->N), deg_ei); |
| 1467 | } |
| 1468 | else |
| 1469 | scAll((currRing->N), deg_ei); |
| 1470 | } |
| 1471 | } |
| 1472 | omFreeSize((ADDRESS)hstc, hNexist * sizeof(scmon)); |
| 1473 | } |
| 1474 | ende: |
| 1475 | hDelete(hexist, hNexist); |
| 1476 | omFreeSize((ADDRESS)act, ((currRing->N) + 1) * sizeof(int)); |
| 1477 | hKill(stcmem, (currRing->N) - 1); |
no test coverage detected