Changeset 728288 in git
- Timestamp:
- Apr 18, 2008, 2:11:40 PM (16 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 3ad53dd58ab62b367f6a39e871372997e9c519bd
- Parents:
- 936551d9412a5b90762e763a532a71c37dbe42c1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gring.cc
r936551 r728288 7 7 * Author: levandov (Viktor Levandovsky) 8 8 * Created: 8/00 - 11/00 9 * Version: $Id: gring.cc,v 1.5 1 2008-01-24 10:07:14 SingularExp $9 * Version: $Id: gring.cc,v 1.52 2008-04-18 12:11:40 motsak Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 2010 2010 } 2011 2011 2012 ideal twostd(ideal I) 2013 { 2014 int i; 2015 int j; 2016 int s; 2017 bool flag; 2018 poly p=NULL; 2019 poly q=NULL; 2020 ideal J=kStd(I, currQuotient,testHomog,NULL,NULL,0,0,NULL); 2021 idSkipZeroes(J); 2022 ideal K=NULL; 2023 poly varj=NULL; 2024 ideal Q=NULL; 2025 ideal id_tmp=NULL; 2026 int rN=currRing->N; 2027 int iSize=0; 2012 ideal twostd(ideal I) // works in currRing only! 2013 { 2014 ideal J = kStd(I, currQuotient, testHomog, NULL, NULL, 0, 0, NULL); // in currRing!!! 2015 idSkipZeroes(J); // ring independent! 2016 2017 const int rN = currRing->N; 2028 2018 2029 2019 loop 2030 2020 { 2031 flag = true; // nothing new! 2032 K = NULL; 2033 s = idElem(J); 2034 2035 for (i=0;i<=s-1;i++) 2036 { 2037 p=J->m[i]; 2038 2039 #ifdef PDEBUG 2040 p_Test(p, currRing); 2041 #if 0 2042 Print("p: "); // ! 2021 ideal K = NULL; 2022 const int s = idElem(J); // ring independent 2023 2024 for(int i = 0; i < s; i++) 2025 { 2026 const poly p = J->m[i]; 2027 2028 #ifdef PDEBUG 2029 p_Test(p, currRing); 2030 #if 0 2031 Print("p: "); // ! 2032 p_Write(p, currRing); 2033 #endif 2034 #endif 2035 2036 for (int j = 1; j <= rN; j++) // for all j = 1..N 2037 { 2038 poly varj = p_ISet(1, currRing); 2039 p_SetExp(varj, j, 1, currRing); 2040 p_Setm(varj, currRing); 2041 2042 poly q = pp_Mult_mm(p, varj, currRing); // q = J[i] * var(j), 2043 2044 #ifdef PDEBUG 2045 p_Test(varj, currRing); 2046 p_Test(p, currRing); 2047 p_Test(q, currRing); 2048 #if 0 2049 Print("Reducing p: "); // ! 2050 p_Write(p, currRing); 2051 2052 Print("With q: "); // ! 2053 p_Write(q, currRing); 2054 #endif 2055 #endif 2056 2057 p_Delete(&varj, currRing); 2058 2059 if (q != NULL) 2060 { 2061 #ifdef PDEBUG 2062 #if 0 2063 Print("Reducing q[j = %d]: ", j); // ! 2064 p_Write(q, currRing); 2065 2066 Print("With p:"); 2043 2067 p_Write(p, currRing); 2044 #endif 2045 #endif 2046 2047 for (j=1;j<=rN;j++) // for all j = 1..N 2048 { 2049 varj = pOne(); 2050 pSetExp(varj,j,1); 2051 pSetm(varj); 2052 q = pp_Mult_mm(p,varj,currRing); // q = J[i] * var(j), 2053 pDelete(&varj); 2054 2055 #ifdef PDEBUG 2056 p_Test(p, currRing); 2068 2069 #endif 2070 #endif 2071 2072 // bug: lm(p) may not divide lm(p * var(i)) in a SCA! 2073 if( p_LmDivisibleBy(p, q, currRing) ) 2074 q = nc_ReduceSpoly(p, q, currRing); 2075 2076 2077 #ifdef PDEBUG 2057 2078 p_Test(q, currRing); 2058 #if 0 2059 Print("Reducing p: "); // ! 2060 p_Write(p, currRing); 2061 2062 Print("With q: "); // ! 2079 #if 0 2080 Print("reductum q/p: "); 2063 2081 p_Write(q, currRing); 2064 #endif 2065 #endif 2066 2067 if (q!=NULL) 2068 { 2069 q = nc_ReduceSpoly(p,q,currRing); 2070 2071 #ifdef PDEBUG 2072 p_Test(q, currRing); 2073 #if 0 2074 Print("Reducing q: "); // ! 2075 p_Write(q, currRing); 2076 2077 Print("With J!\n"); 2078 #endif 2079 #endif 2080 2081 if (q!=NULL) q = kNF(J,currQuotient,q,0,KSTD_NF_NONORM); 2082 2083 #ifdef PDEBUG 2084 p_Test(q, currRing); 2085 #if 0 2086 Print("=> q: "); // ! 2087 p_Write(q, currRing); 2088 #endif 2089 #endif 2090 } 2091 if (q!=NULL) 2092 { 2093 if (pIsConstant(q)) // => return (1)! 2082 2083 // Print("With J!\n"); 2084 #endif 2085 #endif 2086 2087 // if( q != NULL) 2088 q = kNF(J, currQuotient, q, 0, KSTD_NF_NONORM); // in currRing!!! 2089 2090 #ifdef PDEBUG 2091 p_Test(q, currRing); 2092 #if 0 2093 Print("NF(J/currQuotient)=> q: "); // ! 2094 p_Write(q, currRing); 2095 #endif 2096 #endif 2097 if (q!=NULL) 2094 2098 { 2095 Q=idInit(1,1); 2096 Q->m[0]=pOne(); 2097 idDelete(&J); 2098 pDelete(&q); 2099 if (K!=NULL) idDelete(&K); 2100 return(Q); 2099 if (p_IsConstant(q, currRing)) // => return (1)! 2100 { 2101 p_Delete(&q, currRing); 2102 id_Delete(&J, currRing); 2103 2104 if (K != NULL) 2105 id_Delete(&K, currRing); 2106 2107 ideal Q = idInit(1,1); // ring independent! 2108 Q->m[0] = p_ISet(1,currRing); 2109 2110 return(Q); 2111 } 2112 2113 // flag = false; 2114 2115 // K += q: 2116 2117 ideal Q = idInit(1,1); // ring independent 2118 Q->m[0]=q; 2119 2120 if( K == NULL ) 2121 K = Q; 2122 else 2123 { 2124 ideal id_tmp = idSimpleAdd(K, Q); // in currRing 2125 id_Delete(&K, currRing); 2126 id_Delete(&Q, currRing); 2127 K = id_tmp; // K += Q 2128 } 2101 2129 } 2102 2130 2103 flag=false; 2104 Q=idInit(1,1); 2105 Q->m[0]=q; 2106 id_tmp=idSimpleAdd(K,Q); 2107 idDelete(&K); 2108 K=id_tmp; 2109 idDelete(&Q); 2110 } 2111 } 2112 } 2113 if (flag) // nothing new! 2114 /* i.e. all elements are two-sided */ 2115 { 2116 // idDelete(&K); 2131 2132 } // if q != NULL 2133 } // for all variables 2134 2135 } 2136 2137 if (K == NULL) // nothing new: i.e. all elements are two-sided 2117 2138 return(J); 2118 }2119 2139 /* now we update GrBasis J with K */ 2120 2140 // iSize=IDELEMS(J); 2121 2122 idTest(J); 2123 2141 #ifdef PDEBUG 2142 idTest(J); // in currRing! 2143 #if 0 2124 2144 Print("J:"); 2125 2145 idPrint(J); 2126 2146 PrintLn(); 2127 2128 2129 2130 2131 2132 2133 idTest(K); 2134 2147 #endif // debug 2148 #endif 2149 2150 2151 2152 #ifdef PDEBUG 2153 idTest(K); // in currRing! 2154 #if 0 2135 2155 Print("+K:"); 2136 2156 idPrint(K); 2137 2157 PrintLn(); 2138 #endif // debug 2139 #endif 2140 2141 2142 iSize=idElem(J); 2143 id_tmp=idSimpleAdd(J,K); 2144 idDelete(&K); 2145 idDelete(&J); 2146 2158 #endif // debug 2159 #endif 2160 2161 2162 int iSize = idElem(J); // ring independent 2163 2164 // J += K: 2165 ideal id_tmp = idSimpleAdd(J,K); // in currRing 2166 id_Delete(&K, currRing); id_Delete(&J, currRing); 2167 2168 #if 1 2147 2169 BITSET save_test=test; 2148 2149 #if 1 2150 test|=Sy_bit(OPT_SB_1); 2151 J = kStd(id_tmp, currQuotient, testHomog, NULL, NULL, 0, iSize); // J = J + K, J - std 2152 #else 2153 J=kStd(id_tmp, currQuotient,testHomog,NULL,NULL,0,0,NULL); 2154 #endif 2170 test|=Sy_bit(OPT_SB_1); // ring independent 2171 J = kStd(id_tmp, currQuotient, testHomog, NULL, NULL, 0, iSize); // J = J + K, J - std // in currRing! 2155 2172 test = save_test; 2156 2157 idDelete(&id_tmp); // !!! 2158 2159 idSkipZeroes(J); 2160 2161 #ifdef PDEBUG 2162 idTest(J); 2163 #if 0 2173 #else 2174 J=kStd(id_tmp, currQuotient,testHomog,NULL,NULL,0,0,NULL); 2175 #endif 2176 2177 id_Delete(&id_tmp, currRing); 2178 idSkipZeroes(J); // ring independent 2179 2180 #ifdef PDEBUG 2181 idTest(J); // in currRing! 2182 #if 0 2164 2183 Print("J:"); 2165 2184 idPrint(J); 2166 2185 PrintLn(); 2167 #endif // debug 2168 #endif 2169 2170 // bug: 2171 2172 //J:Module of rank 1,real rank 0 and 4 generators. 2173 //generator 0: f 2174 //generator 1: h2+h 2175 //generator 2: eh+e 2176 //generator 3: e2 2177 2178 //+K:Module of rank 1,real rank 0 and 2 generators. 2179 //generator 0: h 2180 //generator 1: e 2181 2182 // =>>>> 2183 2184 //J:Module of rank 1,real rank 0 and 6 generators. 2185 //generator 0: h 2186 //generator 1: f 2187 //generator 2: e 2188 //generator 3: h2+h 2189 //generator 4: eh+e 2190 //generator 5: e2 2191 2192 2193 2194 2195 } 2196 } 2186 #endif // debug 2187 #endif 2188 } // loop 2189 } 2190 2197 2191 2198 2192 matrix nc_PrintMat(int a, int b, ring r, int metric)
Note: See TracChangeset
for help on using the changeset viewer.