! insert h2 into h1 depending on the two boolean parameters: * - if zeroOk is true, then h2 will also be inserted when it is zero * - if duplicateOk is true, then h2 will also be inserted when it is * already present in h1 * return TRUE iff h2 was indeed inserted */
| 875 | * return TRUE iff h2 was indeed inserted |
| 876 | */ |
| 877 | BOOLEAN id_InsertPolyWithTests (ideal h1, const int validEntries, |
| 878 | const poly h2, const bool zeroOk, const bool duplicateOk, const ring r) |
| 879 | { |
| 880 | id_Test(h1, r); |
| 881 | p_Test(h2, r); |
| 882 | |
| 883 | if ((!zeroOk) && (h2 == NULL)) return FALSE; |
| 884 | if (!duplicateOk) |
| 885 | { |
| 886 | bool h2FoundInH1 = false; |
| 887 | int i = 0; |
| 888 | while ((i < validEntries) && (!h2FoundInH1)) |
| 889 | { |
| 890 | h2FoundInH1 = p_EqualPolys(h1->m[i], h2,r); |
| 891 | i++; |
| 892 | } |
| 893 | if (h2FoundInH1) return FALSE; |
| 894 | } |
| 895 | if (validEntries == IDELEMS(h1)) |
| 896 | { |
| 897 | pEnlargeSet(&(h1->m), IDELEMS(h1), 16); |
| 898 | IDELEMS(h1) += 16; |
| 899 | } |
| 900 | h1->m[validEntries] = h2; |
| 901 | return TRUE; |
| 902 | } |
| 903 | |
| 904 | /// h1 + h2 |
| 905 | ideal id_Add (ideal h1,ideal h2, const ring r) |
no test coverage detected