h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no columns at all)
| 916 | /// one h_i must be an ideal (with at least one column) |
| 917 | /// the other h_i may be a module (with no columns at all) |
| 918 | ideal id_Mult (ideal h1,ideal h2, const ring R) |
| 919 | { |
| 920 | id_Test(h1, R); |
| 921 | id_Test(h2, R); |
| 922 | |
| 923 | int j = IDELEMS(h1); |
| 924 | while ((j > 0) && (h1->m[j-1] == NULL)) j--; |
| 925 | |
| 926 | int i = IDELEMS(h2); |
| 927 | while ((i > 0) && (h2->m[i-1] == NULL)) i--; |
| 928 | |
| 929 | j *= i; |
| 930 | int r = si_max( h2->rank, h1->rank ); |
| 931 | if (j==0) |
| 932 | { |
| 933 | if ((IDELEMS(h1)>0) && (IDELEMS(h2)>0)) j=1; |
| 934 | return idInit(j, r); |
| 935 | } |
| 936 | ideal hh = idInit(j, r); |
| 937 | |
| 938 | int k = 0; |
| 939 | for (i=0; i<IDELEMS(h1); i++) |
| 940 | { |
| 941 | if (h1->m[i] != NULL) |
| 942 | { |
| 943 | for (j=0; j<IDELEMS(h2); j++) |
| 944 | { |
| 945 | if (h2->m[j] != NULL) |
| 946 | { |
| 947 | hh->m[k] = pp_Mult_qq(h1->m[i],h2->m[j],R); |
| 948 | k++; |
| 949 | } |
| 950 | } |
| 951 | } |
| 952 | } |
| 953 | |
| 954 | id_Compactify(hh,R); |
| 955 | return hh; |
| 956 | } |
| 957 | |
| 958 | /// returns true if h is the zero ideal |
| 959 | BOOLEAN idIs0 (ideal h) |
no test coverage detected