2 *computes a representation of the generators of submod with respect to those * of mod */ represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = Matrix(M)*Matrix(result) goodShape: maximal non-zero index in generators of SM <= that of M isSB: generators of M form a Groebner basis divide: allow SM not to be a submodule of M U is an diagonal matrix of un
| 1103 | /// U is an diagonal matrix of units (non-constant only in local rings) |
| 1104 | /// rest is: 0 if SM in M, SM if not divide, NF(SM,std(M)) if divide |
| 1105 | ideal idLift(ideal mod, ideal submod,ideal *rest, BOOLEAN goodShape, |
| 1106 | BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg) |
| 1107 | { |
| 1108 | int lsmod =id_RankFreeModule(submod,currRing), j, k; |
| 1109 | int comps_to_add=0; |
| 1110 | int idelems_mod=IDELEMS(mod); |
| 1111 | int idelems_submod=IDELEMS(submod); |
| 1112 | poly p; |
| 1113 | |
| 1114 | if (idIs0(submod)) |
| 1115 | { |
| 1116 | if (rest!=NULL) |
| 1117 | { |
| 1118 | *rest=idInit(1,mod->rank); |
| 1119 | } |
| 1120 | idLift_setUnit(idelems_submod,unit); |
| 1121 | return idInit(1,idelems_mod); |
| 1122 | } |
| 1123 | if (idIs0(mod)) /* and not idIs0(submod) */ |
| 1124 | { |
| 1125 | if (rest!=NULL) |
| 1126 | { |
| 1127 | *rest=idCopy(submod); |
| 1128 | idLift_setUnit(idelems_submod,unit); |
| 1129 | return idInit(1,idelems_mod); |
| 1130 | } |
| 1131 | else |
| 1132 | { |
| 1133 | WerrorS("2nd module does not lie in the first"); |
| 1134 | return NULL; |
| 1135 | } |
| 1136 | } |
| 1137 | if (unit!=NULL) |
| 1138 | { |
| 1139 | comps_to_add = idelems_submod; |
| 1140 | while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL)) |
| 1141 | comps_to_add--; |
| 1142 | } |
| 1143 | k=si_max(id_RankFreeModule(mod,currRing),id_RankFreeModule(submod,currRing)); |
| 1144 | if ((k!=0) && (lsmod==0)) lsmod=1; |
| 1145 | k=si_max(k,(int)mod->rank); |
| 1146 | if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; } |
| 1147 | |
| 1148 | ring orig_ring=currRing; |
| 1149 | ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); |
| 1150 | rSetSyzComp(k,syz_ring); |
| 1151 | rChangeCurrRing(syz_ring); |
| 1152 | |
| 1153 | ideal s_mod, s_temp; |
| 1154 | if (orig_ring != syz_ring) |
| 1155 | { |
| 1156 | s_mod = idrCopyR_NoSort(mod,orig_ring,syz_ring); |
| 1157 | s_temp = idrCopyR_NoSort(submod,orig_ring,syz_ring); |
| 1158 | } |
| 1159 | else |
| 1160 | { |
| 1161 | s_mod = mod; |
| 1162 | s_temp = idCopy(submod); |
no test coverage detected