Changeset 8f1473 in git for Singular/syz.cc
- Timestamp:
- Sep 29, 1998, 11:14:46 PM (25 years ago)
- Branches:
- (u'spielwiese', 'd0474371d8c5d8068ab70bfb42719c97936b18a6')
- Children:
- c616d1a866332e51b67371d164a1d853e45e3434
- Parents:
- c898336d2b07c6834ddddbc81515f8b883795ba3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/syz.cc
rc89833 r8f1473 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz.cc,v 1. 9 1998-04-29 07:05:30siebert Exp $ */4 /* $Id: syz.cc,v 1.10 1998-09-29 21:14:46 siebert Exp $ */ 5 5 6 6 /* … … 220 220 { 221 221 int syzIndex=first; 222 intvec * dummy; 222 223 223 224 if (syzIndex<1) syzIndex=1; 225 if ((syzIndex==1) && (idHomModule(res[0],currQuotient,&dummy))) 226 { 227 delete dummy; 228 resolvente res1=syFastMin(res,length); 229 int i; 230 for (i=0;i<length;i++) 231 { 232 idDelete(&res[i]); 233 res[i] = res1[i]; 234 } 235 Free((ADDRESS)res1,length*sizeof(ideal)); 236 return; 237 } 224 238 while ((syzIndex<length-1) && (res[syzIndex]!=NULL) && (res[syzIndex+1]!=NULL)) 225 239 { … … 1014 1028 return j; 1015 1029 } 1030 1031 /*2 1032 * determines the generators of a minimal resolution 1033 * contained in res 1034 */ 1035 static int ** syScanRes(resolvente res, int length) 1036 { 1037 int i=0,j,k; 1038 int **result=(int**)Alloc0(length*sizeof(int*)); 1039 poly p; 1040 ideal tid; 1041 1042 while ((i<length) && (!idIs0(res[i]))) 1043 { 1044 result[i] = (int*)Alloc0(IDELEMS(res[i])*sizeof(int)); 1045 for (j=IDELEMS(res[i])-1;j>=0;j--) 1046 { 1047 if (res[i]->m[j]==NULL) (result[i])[j] = -1; 1048 } 1049 if (i>0) 1050 { 1051 tid = idJet(res[i],0); 1052 Print("Der %d-te 0-jet ist:\n",i); 1053 for (j=0;j<IDELEMS(tid);j++) 1054 { 1055 if (tid->m[j]!=0) 1056 { 1057 Print("poly %d :",j);pWrite(tid->m[j]); 1058 } 1059 } 1060 for (j=0;j<IDELEMS(tid);j++) 1061 { 1062 p = tid->m[j]; 1063 while (p!=NULL) 1064 { 1065 pNorm(p); 1066 k = (result[i-1])[pGetComp(p)-1]; 1067 if ((k==0) || (k==-2)) 1068 { 1069 (result[i-1])[pGetComp(p)-1] = j+1; 1070 (result[i])[j] = -2; 1071 break; 1072 } 1073 else if (k>0) 1074 { 1075 p = pSub(p,pCopy(tid->m[k-1])); 1076 } 1077 else if (k==-1) 1078 { 1079 Print("Something is rotten in the state of Denmark\n"); 1080 } 1081 } 1082 tid->m[j] = p; 1083 } 1084 Print("Der %d-te 0-jet ist:\n",i); 1085 for (j=0;j<IDELEMS(tid);j++) 1086 { 1087 if (tid->m[j]!=0) 1088 { 1089 Print("poly %d :",j);pWrite(tid->m[j]); 1090 } 1091 } 1092 idDelete(&tid); 1093 } 1094 i++; 1095 } 1096 Print("Die gescannte Struktur ist:\n"); 1097 for (i=0;i<length;i++) 1098 { 1099 Print("Fuer den %d-ten Module:\n",i); 1100 if (!idIs0(res[i])) 1101 for (j=0;j<IDELEMS(res[i]);j++) Print(" %d",(result[i])[j]); 1102 Print("\n"); 1103 } 1104 return result; 1105 } 1106 1107 static void syReduce(ideal toRed,poly redWith,int redComp) 1108 { 1109 int i; 1110 poly p=redWith,pp,ppp; 1111 number n; 1112 1113 while ((p!=NULL) && (pGetComp(p)!=redComp)) pIter(p); 1114 if (p==NULL) 1115 { 1116 Print("Hier ist was faul!\n"); 1117 } 1118 else 1119 { 1120 n = nCopy(pGetCoeff(p)); 1121 } 1122 p = redWith; 1123 for (i=0;i<IDELEMS(toRed);i++) 1124 { 1125 pp = toRed->m[i]; 1126 while ((pp!=NULL) && (pGetComp(pp)!=redComp)) pIter(pp); 1127 if (pp!=NULL) 1128 { 1129 ppp = pMultCopyN(p,pGetCoeff(pp)); 1130 pMultN(toRed->m[i],n); 1131 toRed->m[i] = pSub(toRed->m[i],ppp); 1132 } 1133 } 1134 nDelete(&n); 1135 } 1136 1137 resolvente syFastMin(resolvente res,int length) 1138 { 1139 int **res_shape=syScanRes(res,length); 1140 int i,j,k; 1141 poly p; 1142 resolvente result=(ideal*)Alloc0(length*sizeof(ideal)); 1143 1144 for (i=0;(i<length) && !idIs0(res[i]);i++) 1145 { 1146 k = 0; 1147 result[i] = idInit(IDELEMS(res[i]),res[i]->rank); 1148 for (j=IDELEMS(res[i])-1; j>=0;j--) 1149 { 1150 if ((res_shape[i])[j]==0) 1151 { 1152 result[i]->m[k] = pCopy(res[i]->m[j]); 1153 k++; 1154 } 1155 } 1156 if (i>0) 1157 { 1158 for (j=IDELEMS(res[i-1])-1;j>=0;j--) 1159 { 1160 if ((res_shape[i-1])[j]>0) 1161 { 1162 k = (res_shape[i-1])[j]-1; 1163 syReduce(result[i],res[i]->m[k],j+1); 1164 } 1165 } 1166 } 1167 } 1168 return result; 1169 }
Note: See TracChangeset
for help on using the changeset viewer.