Changeset 6b5dd2 in git
- Timestamp:
- Aug 13, 2004, 8:26:03 PM (20 years ago)
- Branches:
- (u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
- Children:
- eb234f15d6598ca0962dedbf1a9bb6b54a5e4b6d
- Parents:
- e5627dd3d72ab05802168acf771823493696b8ef
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gring.cc
re5627d r6b5dd2 7 7 * Author: levandov (Viktor Levandovsky) 8 8 * Created: 8/00 - 11/00 9 * Version: $Id: gring.cc,v 1.1 1 2004-07-29 14:58:00 SingularExp $9 * Version: $Id: gring.cc,v 1.12 2004-08-13 18:26:03 levandov Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 1027 1027 return(NULL); 1028 1028 } 1029 poly m =pOne();1029 poly m = pOne(); 1030 1030 p_ExpVectorDiff(m,p2,p1,r); 1031 1031 //p_Setm(m,r); … … 1034 1034 #endif 1035 1035 /* pSetComp(m,r)=0? */ 1036 poly N=nc_mm_Mult_p(m,p_Head(p1,r),r);1037 number C =n_Copy(p_GetCoeff(N,r),r);1038 number cF =n_Copy(p_GetCoeff(p2,r),r);1036 poly N = nc_mm_Mult_p(m, p_Head(p1,r), r); 1037 number C = n_Copy( p_GetCoeff(N, r), r); 1038 number cF = n_Copy( p_GetCoeff(p2, r),r); 1039 1039 /* GCD stuff */ 1040 number cG = nGcd(C, cF,r);1041 if ( !nEqual(cG,n_Init(1,r)))1042 { 1043 cF = nDiv(cF, cG);1044 C = nDiv(C, cG);1045 } 1046 p2 =p_Mult_nn(p2,C,r);1040 number cG = nGcd(C, cF, r); 1041 if ( !nEqual(cG, n_Init(1,r) ) ) 1042 { 1043 cF = nDiv(cF, cG); 1044 C = nDiv(C, cG); 1045 } 1046 p2 = p_Mult_nn(p2, C, r); 1047 1047 poly out = nc_mm_Mult_p(m, p_Copy(pNext(p1),r), r); 1048 N=p_Add_q(N,out,r); 1049 number MinusOne=n_Init(-1,r); 1048 N = p_Add_q(N, out, r); 1049 p_Test(p2,r); 1050 p_Test(N,r); 1051 number MinusOne = n_Init(-1,r); 1050 1052 if (!n_Equal(cF,MinusOne,r)) 1051 1053 { 1052 cF=n_Neg(cF,r); 1053 N=p_Mult_nn(N,cF,r); 1054 } 1055 out=p_Add_q(p2,N,r); 1056 if (out!=NULL) pContent(out); 1054 cF = n_Neg(cF,r); 1055 N = p_Mult_nn(N, cF, r); 1056 p_Test(N,r); 1057 } 1058 out = p_Add_q(p2,N,r); 1059 p_Test(out,r); 1060 if ( out!=NULL ) pContent(out); 1057 1061 p_Delete(&m,r); 1058 1062 n_Delete(&cF,r); … … 2242 2246 matrix D = mpNew(r->N,r->N); 2243 2247 int i,j; 2244 number One=r->cf->nInit(1);2245 2248 for(i=1; i<r->N; i++) 2246 2249 { … … 2259 2262 } 2260 2263 2261 poly p_CopyEmbed(poly p, ring srcRing, int shift) 2262 /* for use with embeddings: srcRing is a sum of smaller rings */ 2264 poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift) 2265 /* NOT USED ANYMORE: replaced by maFindPerm in ring.cc */ 2266 /* for use with embeddings: currRing is a sum of smaller rings */ 2267 /* and srcRing is one of such smaller rings */ 2263 2268 /* shift defines the position of a subring in srcRing */ 2269 /* par_shift defines the position of a subfield in basefield of CurrRing */ 2264 2270 { 2265 2271 if (currRing == srcRing) … … 2269 2275 nMapFunc nMap=nSetMap(srcRing); 2270 2276 poly q; 2271 if ( nMap == nCopy)2272 {2273 q = prCopyR(p,srcRing);2274 }2275 else2277 // if ( nMap == nCopy) 2278 // { 2279 // q = prCopyR(p,srcRing); 2280 // } 2281 // else 2276 2282 { 2277 2283 int *perm = (int *)omAlloc0((srcRing->N+1)*sizeof(int)); 2278 int *par_perm = NULL;2284 int *par_perm = (int *)omAlloc0((srcRing->P+1)*sizeof(int)); 2279 2285 // int *par_perm = (int *)omAlloc0((srcRing->P+1)*sizeof(int)); 2280 2286 int i; … … 2289 2295 return(0); 2290 2296 } 2291 for (i=1; i<=srcRing->N; i++) 2292 perm[i]=shift+i; 2297 for (i=1; i<= srcRing->N; i++) 2298 { 2299 perm[i] = shift+i; 2300 } 2293 2301 q = pPermPoly(p,perm,srcRing,nMap,par_perm,srcRing->P); 2294 2302 } -
kernel/ring.cc
re5627d r6b5dd2 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ring.cc,v 1.1 7 2004-08-13 14:25:46 SingularExp $ */4 /* $Id: ring.cc,v 1.18 2004-08-13 18:26:02 levandov Exp $ */ 5 5 6 6 /* … … 28 28 #include "gring.h" 29 29 #include "matpol.h" 30 #include "maps.h" 30 31 #endif 31 32 … … 1134 1135 ring old_ring = currRing; 1135 1136 rChangeCurrRing(sum); 1137 /* find permutations of vars and pars */ 1138 int *perm1 = (int *)omAlloc0((R1->N+1)*sizeof(int)); 1139 int *par_perm1 = (int *)omAlloc0((R1->P+1)*sizeof(int)); 1140 int *perm2 = (int *)omAlloc0((R2->N+1)*sizeof(int)); 1141 int *par_perm2 = (int *)omAlloc0((R2->P+1)*sizeof(int)); 1142 // maFindPerm(char **preim_names, int preim_n, char **preim_par, int preim_p, 1143 // char **names, int n, char **par, int nop, 1144 // int * perm, int *par_perm, int ch); 1145 maFindPerm(R1->names, R1->N, R1->parameter, R1->P, 1146 sum->names, sum->N, sum->parameter, sum->P, 1147 perm1, par_perm1, sum->ch); 1148 maFindPerm(R2->names, R2->N, R2->parameter, R2->P, 1149 sum->names, sum->N, sum->parameter, sum->P, 1150 perm2, par_perm2, sum->ch); 1151 nMapFunc nMap1 = nSetMap(R1); 1152 nMapFunc nMap2 = nSetMap(R2); 1136 1153 matrix C1 = R1->nc->C, C2 = R2->nc->C; 1137 1154 matrix D1 = R1->nc->D, D2 = R2->nc->D; … … 1139 1156 matrix C = mpNew(l,l); 1140 1157 matrix D = mpNew(l,l); 1158 int param_shift = 0; 1141 1159 for (i=1; i<= R1->N + R2->N; i++) 1142 1160 { … … 1150 1168 for (j=i+1; j<=R1->N; j++) 1151 1169 { 1152 MATELEM(C,i,j) = p_CopyEmbed(MATELEM(C1,i,j),R1,0); 1170 MATELEM(C,i,j) = pPermPoly(MATELEM(C1,i,j),perm1,R1,nMap1,par_perm1,R1->P); 1171 MATELEM(D,i,j) = pPermPoly(MATELEM(D1,i,j),perm1,R1,nMap1,par_perm1,R1->P); 1172 // MATELEM(C,i,j) = p_CopyEmbed(MATELEM(C1,i,j),R1,0,param_shift); 1153 1173 //prCopyR_NoSort(MATELEM(C1,i,j),R1,sum); 1154 1174 // MATELEM(D,i,j) = prCopyR(MATELEM(D1,i,j),R1,sum); 1155 MATELEM(D,i,j) = p_CopyEmbed(MATELEM(D1,i,j),R1,0); 1175 // MATELEM(D,i,j) = p_CopyEmbed(MATELEM(D1,i,j),R1,0,param_shift); 1176 1156 1177 } 1157 1178 } … … 1162 1183 // MATELEM(C,R1->N+i,R1->N+j) = prCopyR_NoSort(MATELEM(C2,i,j),R2,sum); 1163 1184 // MATELEM(D,R1->N+i,R1->N+j) = prCopyR(MATELEM(D2,i,j),R2,sum); 1164 MATELEM(C,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(C2,i,j),R2, R1->N); 1165 MATELEM(D,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(D2,i,j),R2, R1->N); 1185 // MATELEM(C,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(C2,i,j),R2, R1->N,param_shift); 1186 // MATELEM(D,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(D2,i,j),R2, R1->N,param_shift); 1187 1188 MATELEM(C,R1->N+i,R1->N+j) = pPermPoly(MATELEM(C2,i,j),perm2,R2,nMap2,par_perm2,R2->P); 1189 MATELEM(D,R1->N+i,R1->N+j) = pPermPoly(MATELEM(D2,i,j),perm2,R2,nMap2,par_perm2,R2->P); 1166 1190 } 1167 1191 } … … 3462 3486 #include <ctype.h> 3463 3487 3464 ring rOpp(ring src) 3465 { 3488 ring rOpposite(ring src) 3489 /* creates an opposite algebra of R */ 3490 /* that is R^opp, where f (*^opp) g = g*f */ 3491 { 3492 ring save=currRing; 3466 3493 ring r=rCopy(src); 3467 3494 // change vars v1..vN -> vN..v1 … … 3529 3556 case ro_syzcomp: 3530 3557 case ro_syz: 3531 WerrorS("not implemented in rOpp ");3558 WerrorS("not implemented in rOpposite"); 3532 3559 // should not happen 3533 3560 break; … … 3540 3567 case ro_none: 3541 3568 default: 3542 Werror("unknown typ in rOpp(%d)",r->typ[i].ord_typ);3569 Werror("unknown type in rOpposite(%d)",r->typ[i].ord_typ); 3543 3570 break; 3544 3571 } 3545 3572 } 3546 3573 // avoid printing changed stuff: 3547 r->order[0]=ringorder_unspec; 3548 r->block0[0]=1; 3549 r->block1[0]=rVar(r); 3550 r->order[1]=0; 3551 #ifdef RDEBUG 3552 rDebugPrint(r); 3553 #endif 3574 // r->order[0]=ringorder_unspec; 3575 // r->block0[0]=1; 3576 // r->block1[0]=rVar(r); 3577 // r->order[1]=0; 3578 // #ifdef RDEBUG 3579 // rDebugPrint(r); 3580 //#endif 3581 /* now, we initialize a non-comm structure on it */ 3582 rComplete(r); /* dare we? */ 3583 //#ifdef HAVE_PLURAL 3584 if (!rIsPluralRing(src)) 3585 { 3586 return(r); 3587 } 3588 rChangeCurrRing(r); 3589 /* basic nc constructions */ 3590 r->nc = (nc_struct *)omAlloc0(sizeof(nc_struct)); 3591 r->nc->ref = 1; /* in spite of Copy(src)? */ 3592 r->nc->basering = r; 3593 r->nc->type = src->nc->type; 3594 int *perm = (int *)omAlloc0((r->N+1)*sizeof(int)); 3595 int *par_perm = NULL; 3596 nMapFunc nMap = nSetMap(src); 3597 int j; 3598 int ni,nj; 3599 for(i=1; i<=r->N; i++) 3600 { 3601 perm[i] = r->N+1-i; 3602 } 3603 matrix C = mpNew(r->N,r->N); 3604 matrix D = mpNew(r->N,r->N); 3605 for (i=1; i< r->N; i++) 3606 { 3607 for (j=i+1; j<=r->N; j++) 3608 { 3609 ni = r->N +1 - i; 3610 nj = r->N +1 - j; /* i<j ==> nj < ni */ 3611 MATELEM(C,nj,ni) = pPermPoly(MATELEM(src->nc->C,i,j),perm,src,nMap,par_perm,src->P); 3612 MATELEM(D,nj,ni) = pPermPoly(MATELEM(src->nc->D,i,j),perm,src,nMap,par_perm,src->P); 3613 } 3614 } 3615 r->nc->C = C; 3616 r->nc->D = D; 3617 if (nc_InitMultiplication(r)) 3618 WarnS("Error initializing multiplication!"); 3619 r->nc->IsSkewConstant = src->nc->IsSkewConstant; 3620 rChangeCurrRing(save); 3554 3621 return r; 3555 3622 } 3623 3624 ring rEnvelope(ring R) 3625 /* creates an enveloping algebra of R */ 3626 /* that is R^e = R \tensor_K R^opp */ 3627 { 3628 ring Ropp = rOpposite(R); 3629 ring Renv; 3630 int stat = rSum(R, Ropp, Renv); 3631 if (stat <=0) 3632 WarnS("Error in rEnvelope at rSum"); 3633 return Renv; 3634 } -
kernel/ring.h
re5627d r6b5dd2 7 7 * ABSTRACT - the interpreter related ring operations 8 8 */ 9 /* $Id: ring.h,v 1. 4 2004-08-09 14:44:30 SingularExp $ */9 /* $Id: ring.h,v 1.5 2004-08-13 18:26:03 levandov Exp $ */ 10 10 11 11 /* includes */ … … 28 28 void rKill(ring r); 29 29 ring rCopy(ring r); 30 ring rOpp(ring r); 30 ring rOpposite(ring r); 31 ring rEnvelope(ring r); 31 32 32 33
Note: See TracChangeset
for help on using the changeset viewer.