Changeset 8e165ec in git for kernel/ring.cc
- Timestamp:
- Apr 29, 2004, 7:10:21 PM (20 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- dc2e3e750feee49ddfd152b2a0c4824f8cbd1fdd
- Parents:
- b5060799fd0568dfb3e8a2dca5dd9c208896b9ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ring.cc
rb506079 r8e165ec 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ring.cc,v 1. 6 2004-04-29 14:53:56 SingularExp $ */4 /* $Id: ring.cc,v 1.7 2004-04-29 17:10:21 levandov Exp $ */ 5 5 6 6 /* … … 1051 1051 memcpy(sum,&tmpR,sizeof(ip_sring)); 1052 1052 rComplete(sum); 1053 #ifdef HAVE_PLURAL 1054 BOOLEAN R1_is_nc = rIsPluralRing(r1); 1055 BOOLEAN R2_is_nc = rIsPluralRing(r2); 1056 if ( (R1_is_nc) || (R2_is_nc)) 1057 { 1058 ring R1 = rCopy(r1); 1059 ring R2 = rCopy(r2); 1060 /* basic nc constructions */ 1061 sum->nc = (nc_struct *)omAlloc0(sizeof(nc_struct)); 1062 sum->nc->ref = 1; 1063 sum->nc->basering = sum; 1064 if ( !R1_is_nc ) nc_rCreateNCcomm(R1); 1065 if ( !R2_is_nc ) nc_rCreateNCcomm(R2); 1066 /* nc types */ 1067 sum->nc->type = nc_undef; 1068 nc_type t1 = R1->nc->type, t2 = R2->nc->type; 1069 if ( t1==t2) sum->nc->type = t1; 1070 else 1071 { 1072 if ( (t1==nc_general) || (t2==nc_general) ) sum->nc->type = nc_general; 1073 } 1074 if (sum->nc->type == nc_undef) /* not yet done */ 1075 { 1076 switch (t1) 1077 { 1078 case nc_comm: 1079 sum->nc->type = t2; break; 1080 case nc_lie: 1081 switch(t2) 1082 { 1083 case nc_skew: 1084 sum->nc->type = nc_general; break; 1085 case nc_comm: 1086 sum->nc->type = nc_lie; break; 1087 default: 1088 sum->nc->type = nc_undef; break; 1089 } 1090 break; 1091 case nc_skew: 1092 switch(t2) 1093 { 1094 case nc_lie: 1095 sum->nc->type = nc_lie; break; 1096 case nc_comm: 1097 sum->nc->type = nc_skew; break; 1098 default: 1099 sum->nc->type = nc_undef; break; 1100 } 1101 } 1102 } 1103 if (sum->nc->type == nc_undef) 1104 WarnS("Error on recognizing nc types"); 1105 /* multiplication matrices */ 1106 ring old_ring = currRing; 1107 rChangeCurrRing(sum); 1108 matrix C1 = R1->nc->C, C2 = R2->nc->C; 1109 matrix D1 = R1->nc->D, D2 = R2->nc->D; 1110 int l = R1->N + R2->N; 1111 matrix C = mpNew(l,l); 1112 matrix D = mpNew(l,l); 1113 for (i=1; i<= R1->N + R2->N; i++) 1114 { 1115 for (j= i+1; j<= R1->N + R2->N; j++) 1116 { 1117 MATELEM(C,i,j) = pOne(); 1118 } 1119 } 1120 for (i=1; i< R1->N; i++) 1121 { 1122 for (j=i+1; j<=R1->N; j++) 1123 { 1124 MATELEM(C,i,j) = p_CopyEmbed(MATELEM(C1,i,j),R1,0); 1125 //prCopyR_NoSort(MATELEM(C1,i,j),R1,sum); 1126 // MATELEM(D,i,j) = prCopyR(MATELEM(D1,i,j),R1,sum); 1127 MATELEM(D,i,j) = p_CopyEmbed(MATELEM(D1,i,j),R1,0); 1128 } 1129 } 1130 for (i=1; i< R2->N; i++) 1131 { 1132 for (j=i+1; j<=R2->N; j++) 1133 { 1134 // MATELEM(C,R1->N+i,R1->N+j) = prCopyR_NoSort(MATELEM(C2,i,j),R2,sum); 1135 // MATELEM(D,R1->N+i,R1->N+j) = prCopyR(MATELEM(D2,i,j),R2,sum); 1136 MATELEM(C,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(C2,i,j),R2, R1->N); 1137 MATELEM(D,R1->N+i,R1->N+j) = p_CopyEmbed(MATELEM(D2,i,j),R2, R1->N); 1138 } 1139 } 1140 sum->nc->C = C; 1141 sum->nc->D = D; 1142 if (nc_InitMultiplication(sum)) 1143 WarnS("Error initializing multiplication!"); 1144 sum->nc->IsSkewConstant =(int)((R1->nc->IsSkewConstant) && (R2->nc->IsSkewConstant)); 1145 /* delete R1, R2*/ 1146 rDelete(R1); 1147 rDelete(R2); 1148 if ( old_ring != NULL) 1149 rChangeCurrRing(old_ring); 1150 } 1151 #endif 1053 1152 return 1; 1054 1153 }
Note: See TracChangeset
for help on using the changeset viewer.