Changeset 59aa94 in git
 Timestamp:
 Feb 8, 2005, 7:59:36 PM (18 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
 Children:
 066b0020bd9fd9b3c31513f59b07e261fa366329
 Parents:
 a96f4d9e2f9f0ae333c8bbfda7b2b6f5393bf913
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/ring.cc
ra96f4d r59aa94 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ring.cc,v 1.2 8 20050203 16:41:29 SingularExp $ */4 /* $Id: ring.cc,v 1.29 20050208 18:59:36 levandov Exp $ */ 5 5 6 6 /* … … 1080 1080 //#endif 1081 1081 #ifdef HAVE_PLURAL 1082 ring old_ring = currRing; 1083 rChangeCurrRing(sum); 1082 1084 BOOLEAN R1_is_nc = rIsPluralRing(r1); 1083 1085 BOOLEAN R2_is_nc = rIsPluralRing(r2); 1084 1086 if ( (R1_is_nc)  (R2_is_nc)) 1085 1087 { 1088 rChangeCurrRing(r1); /* since rCopy works well only in currRing */ 1086 1089 ring R1 = rCopy(r1); 1090 rChangeCurrRing(r2); 1087 1091 ring R2 = rCopy(r2); 1092 rChangeCurrRing(sum); 1088 1093 /* basic nc constructions */ 1089 1094 sum>nc = (nc_struct *)omAlloc0(sizeof(nc_struct)); … … 1136 1141 WarnS("Error on recognizing nc types"); 1137 1142 /* multiplication matrices */ 1138 ring old_ring = currRing;1139 rChangeCurrRing(sum);1143 // ring old_ring = currRing; 1144 // rChangeCurrRing(sum); 1140 1145 /* find permutations of vars and pars */ 1141 1146 int *perm1 = (int *)omAlloc0((rVar(R1)+1)*sizeof(int)); … … 1202 1207 rDelete(R1); 1203 1208 rDelete(R2); 1209 /* TODO: delete perm arrays */ 1210 if (perm1!=NULL) omFree((ADDRESS)perm1); 1211 if (perm2!=NULL) omFree((ADDRESS)perm2); 1212 if (par_perm1!=NULL) omFree((ADDRESS)par_perm1); 1213 if (par_perm2!=NULL) omFree((ADDRESS)par_perm2); 1204 1214 if ( old_ring != NULL) 1205 1215 rChangeCurrRing(old_ring); 1206 1216 } 1207 1217 #endif 1218 ring old_ring2 = currRing; 1219 rChangeCurrRing(sum); 1220 ideal Q=NULL; 1221 ideal Q1, Q2; 1208 1222 if (r1>qideal!=NULL) 1209 1223 { 1210 if (r2>qideal!=NULL) 1211 { 1212 WerrorS("todo: qring+qring"); 1213 return 1; 1214 } 1215 else 1216 { 1217 int * perm=(int*)omAlloc0(sizeof(int)*(sum>N+1)); 1218 int i; 1219 for(i=1;i<=r1>N;i++) perm[i]=i; 1220 sum>qideal=idInit(IDELEMS(r1>qideal),1); 1221 for (int i=0;i<IDELEMS(r1>qideal);i++) 1222 sum>qideal>m[i]=pPermPoly(r1>qideal>m[i],perm,r1,nCopy); 1223 omFree((ADDRESS)perm); 1224 } 1225 } 1226 else if (r2>qideal!=NULL) 1227 { 1228 int * perm=(int*)omAlloc0(sizeof(int)*(sum>N+1)); 1229 int i; 1230 for(i=1;i<=r2>N;i++) perm[i]=i+r1>N; 1231 sum>qideal=idInit(IDELEMS(r2>qideal),1); 1224 // if (r2>qideal!=NULL) 1225 // { 1226 // WerrorS("todo: qring+qring"); 1227 // return 1; 1228 // } 1229 // else 1230 // {} 1231 /* these were defined in the Plural Part above... */ 1232 int *perm1 = (int *)omAlloc0((rVar(r1)+1)*sizeof(int)); 1233 int *par_perm1 = NULL; 1234 if (rPar(r1)!=0) par_perm1=(int *)omAlloc0((rPar(r1)+1)*sizeof(int)); 1235 maFindPerm(r1>names, rVar(r1), r1>parameter, rPar(r1), 1236 sum>names, rVar(sum), sum>parameter, rPar(sum), 1237 perm1, par_perm1, sum>ch); 1238 nMapFunc nMap1 = nSetMap(r1); 1239 Q1 = idInit(IDELEMS(r1>qideal),1); 1240 for (int i=0;i<IDELEMS(r1>qideal);i++) 1241 Q1>m[i] = pPermPoly(r1>qideal>m[i],perm1,r1,nMap1,par_perm1,rPar(r1)); 1242 omFree((ADDRESS)perm1); 1243 } 1244 else 1245 { 1246 Q1 = NULL; 1247 } 1248 1249 if (r2>qideal!=NULL) 1250 { 1251 int *perm2 = (int *)omAlloc0((rVar(r2)+1)*sizeof(int)); 1252 int *par_perm2 = NULL; 1253 if (rPar(r2)!=0) par_perm2=(int *)omAlloc0((rPar(r2)+1)*sizeof(int)); 1254 maFindPerm(r2>names, rVar(r2), r2>parameter, rPar(r2), 1255 sum>names, rVar(sum), sum>parameter, rPar(sum), 1256 perm2, par_perm2, sum>ch); 1257 nMapFunc nMap2 = nSetMap(r2); 1258 Q2 = idInit(IDELEMS(r2>qideal),1); 1232 1259 for (int i=0;i<IDELEMS(r2>qideal);i++) 1233 sum>qideal>m[i]=pPermPoly(r2>qideal>m[i],perm,r2,nCopy); 1234 omFree((ADDRESS)perm); 1235 } 1260 Q2>m[i] = pPermPoly(r2>qideal>m[i],perm2,r2,nMap2,par_perm2,rPar(r2)); 1261 omFree((ADDRESS)perm2); 1262 } 1263 else 1264 { 1265 Q2 = NULL; 1266 } 1267 if ( (Q1!=NULL)  ( Q2!=NULL)) 1268 Q = idSimpleAdd(Q1,Q2); 1269 sum>qideal = Q; 1270 if ( old_ring2 != NULL) 1271 rChangeCurrRing(old_ring2); 1236 1272 return 1; 1237 1273 } … … 3569 3605 /* creates an opposite algebra of R */ 3570 3606 /* that is R^opp, where f (*^opp) g = g*f */ 3571 /* ignores the case of qring > done in iparith.cc*/3607 /* treats the case of qring */ 3572 3608 { 3573 3609 ring save = currRing; … … 3826 3862 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int)); 3827 3863 /* now oppose the qideal for qrings */ 3828 // if (r>qideal != NULL)3829 //{3830 //idDelete(&(r>qideal));3831 // r>qideal = idOppose(src,qideal);3832 //}3833 //rTest(r);3864 if (src>qideal != NULL) 3865 { 3866 idDelete(&(r>qideal)); 3867 r>qideal = idOppose(src, src>qideal); 3868 } 3869 rTest(r); 3834 3870 rChangeCurrRing(save); 3835 3871 } … … 3844 3880 ring Ropp = rOpposite(R); 3845 3881 ring Renv = NULL; 3846 int stat = rSum(R, Ropp, Renv); /* should ignoreqideals */3882 int stat = rSum(R, Ropp, Renv); /* takes care of qideals */ 3847 3883 if ( stat <=0 ) 3848 3884 WarnS("Error in rEnvelope at rSum"); 3849 3885 /* now create the qideal for qrings */ 3850 // if (R>qideal != NULL)3851 // {3852 // ring save = currRing;3853 // rChangeCurrRing(Ropp);3854 // ideal Q = idCopy(R>qideal);3855 // ideal Qop = idOppose(R,Q);3856 // rChangeCurrRing(Renv);3857 // ideal Qenv = idInit(Q>ncols+Qop>ncols,1);3858 // int i;3859 // for (i=0; i<=Q>ncols; i++)3860 // {3861 // Qenv>m[i] = maIMap(R,Q>m[i]);3862 // }3863 // for (i=0; i<= Qop>ncols; i++)3864 // {3865 // Qenv>m[Q>ncols+i] = maIMap(Ropp,Qop>m[i]);3866 // }3867 // /* should we run twostd on the result? */3868 // Renv>qideal = Qenv;3869 // rChangeCurrRing(save);3870 // }3886 // if (R>qideal != NULL) 3887 // { 3888 // ring save = currRing; 3889 // rChangeCurrRing(Ropp); 3890 // ideal Q = idCopy(R>qideal); 3891 // ideal Qop = idOppose(R,Q); 3892 // rChangeCurrRing(Renv); 3893 // ideal Qenv = idInit(Q>ncols+Qop>ncols,1); 3894 // int i; 3895 // for (i=0; i< Q>ncols; i++) 3896 // { 3897 // Qenv>m[i] = maIMap(R,Q>m[i]); 3898 // } 3899 // for (i=0; i<= Qop>ncols; i++) 3900 // { 3901 // Qenv>m[Q>ncols+i] = maIMap(Ropp,Qop>m[i]); 3902 // } 3903 // /* should we run twostd on the result? */ 3904 // Renv>qideal = Qenv; 3905 // rChangeCurrRing(save); 3906 // } 3871 3907 rTest(Renv); 3872 3908 return Renv;
Note: See TracChangeset
for help on using the changeset viewer.