keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.)
| 3138 | /// keeps the first k (>= 1) entries of the given ideal |
| 3139 | /// (Note that the kept polynomials may be zero.) |
| 3140 | void idKeepFirstK(ideal id, const int k) |
| 3141 | { |
| 3142 | for (int i = IDELEMS(id)-1; i >= k; i--) |
| 3143 | { |
| 3144 | if (id->m[i] != NULL) pDelete(&id->m[i]); |
| 3145 | } |
| 3146 | int kk=k; |
| 3147 | if (k==0) kk=1; /* ideals must have at least one element(0)*/ |
| 3148 | pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id)); |
| 3149 | IDELEMS(id) = kk; |
| 3150 | } |
| 3151 | |
| 3152 | typedef struct |
| 3153 | { |
no test coverage detected