Changeset d143376 in git
- Timestamp:
- Aug 12, 2011, 7:29:19 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 8c6ae50ebf0a50c5c19b2b5b0dad7b35be193f9b
- Parents:
- 77bb59200a4a6c29f96eb37fb6da3b221d283eba
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-12 19:29:19+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:30:46+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipshell.cc
r77bb59 rd143376 2071 2071 ) 2072 2072 return NULL; 2073 int is_gf_char=0;2074 2073 // 0: char/ cf - ring 2075 2074 // 1: list (var) … … 2079 2078 // 4: C 2080 2079 // 5: D 2081 ring R=(ring) omAlloc0Bin(sip_sring_bin); 2080 ring R = (ring) omAlloc0Bin(sip_sring_bin); 2081 2082 2083 assume( R->cf == NULL ); 2084 int ch; 2085 int is_gf_char = 0; 2086 2087 // ------------------------------------------------------------------ 2088 // 0: char: 2089 if (L->m[0].Typ()==INT_CMD) 2090 { 2091 ch = (int)(long)L->m[0].Data(); 2092 assume( ch >= 0 ); 2093 2094 2095 if (ch != -1) // WTF? 2096 { 2097 int l=0; 2098 2099 if ( 2100 ((ch!=0) && (ch<2) && (is_gf_char=-1)) // TODO for Hans!: negative characteristic? 2101 #ifndef NV_OPS 2102 || (ch > 32003) 2103 #endif 2104 || ((l=IsPrime(ch))!=ch) 2105 ) 2106 { 2107 Warn("%d is invalid characteristic of ground field. %d is used.", ch,l); 2108 ch = l; 2109 } 2110 } 2111 } 2112 else if (L->m[0].Typ()==LIST_CMD) 2113 { 2114 lists LL=(lists)L->m[0].Data(); 2115 #ifdef HAVE_RINGS 2116 if (LL->m[0].Typ() == STRING_CMD) 2117 { 2118 rComposeRing(LL,R); /* Ring */ 2119 } 2120 else 2121 #endif 2122 if (LL->nr<3) 2123 rComposeC(LL,R); /* R, long_R, long_C */ 2124 else 2125 { 2126 if (LL->m[0].Typ()==INT_CMD) 2127 { 2128 ch = (int)(long)LL->m[0].Data(); 2129 2130 // TODO: check that ch is a supported (by our GF impl.) power of a prime 2131 while ((ch != fftable[is_gf_char]) && (fftable[is_gf_char])) is_gf_char++; 2132 2133 if (fftable[is_gf_char]==0) is_gf_char=-1; 2134 } 2135 2136 if (is_gf_char==-1) 2137 { 2138 ring extRing = rCompose((lists)L->m[0].Data()); 2139 2140 if (extRing==NULL) 2141 { 2142 WerrorS("could not create rational function coefficient field"); 2143 goto rCompose_err; 2144 } 2145 if (extRing->cf->ch > 0) 2146 ch = - extRing->cf->ch; // TODO: this is obsolete! 2147 else 2148 ch = 1; // WTF? 2149 2150 // extRing->names = (char**)omAlloc0(rPar(R)*sizeof(char_ptr)); // obsolete? 2151 2152 int i; 2153 2154 // for( i = rPar(R) - 1; i >= 0; i--) extRing->names[i] = omStrDup(extRing->names[i]); 2155 /* 2156 // Obsolete? 2157 if (extRing->qideal!=NULL) 2158 { 2159 if (IDELEMS(extRing->qideal) == 1) 2160 { 2161 extRing->qideal->m[0] = naInit(1,R); 2162 lnumber n=(lnumber)R->minpoly; 2163 n->z = extRing->qideal->m[0]; 2164 // naMinimalPoly = n->z; 2165 R->cf->extRing->qideal->m[0]=NULL; 2166 idDelete(&(R->cf->extRing->qideal)); 2167 2168 redefineFunctionPointers(); 2169 } 2170 else 2171 { 2172 WerrorS("not implemented yet."); 2173 } 2174 } 2175 */ 2176 } 2177 else 2178 { // gf-char 2179 // ch = fftable[is_gf_char]; 2180 extRing->N=1; 2181 extRing->names=(char**)omAlloc0(1*sizeof(char_ptr)); 2182 extRing->names[0]=omStrDup((char*)((lists)(LL->m[1].Data()))->m[0].Data()); 2183 } 2184 } 2185 } 2186 else 2187 { 2188 WerrorS("coefficient field must be described by `int` or `list`"); 2189 goto rCompose_err; 2190 } 2191 rRenameVars(R); 2192 rComplete(R); 2193 2194 #ifdef HAVE_RINGS 2195 // This was a BUG IN SINGULAR: There is no HABE_RINGS!!! 2196 2197 // currently, coefficients which are ring elements require a global ordering: 2198 if (rField_is_Ring(R) && (R->pOrdSgn==-1)) 2199 { 2200 WerrorS("global ordering required for these coefficients"); 2201 goto rCompose_err; 2202 } 2203 #endif 2204 2205 2206 2207 2208 2209 2210 2211 2212 2082 2213 // ------------------------- VARS --------------------------- 2083 2214 if (L->m[1].Typ()==LIST_CMD) … … 2276 2407 goto rCompose_err; 2277 2408 } 2278 // ------------------------------------------------------------------2279 // 0: char:2280 if (L->m[0].Typ()==INT_CMD)2281 {2282 R->cf->ch=(int)(long)L->m[0].Data();2283 if (R->cf->ch!=-1)2284 {2285 int l=0;2286 if (((R->cf->ch!=0) && (R->cf->ch<2) && (is_gf_char=-1))2287 #ifndef NV_OPS2288 || (R->cf->ch > 32003)2289 #endif2290 || ((l=IsPrime(R->cf->ch))!=R->cf->ch)2291 )2292 {2293 Warn("%d is invalid characteristic of ground field. %d is used.", R->cf->ch,l);2294 R->cf->ch=l;2295 }2296 }2297 }2298 else if (L->m[0].Typ()==LIST_CMD)2299 {2300 lists LL=(lists)L->m[0].Data();2301 #ifdef HAVE_RINGS2302 if (LL->m[0].Typ() == STRING_CMD)2303 {2304 rComposeRing(LL,R); /* Ring */2305 }2306 else2307 #endif2308 if (LL->nr<3)2309 rComposeC(LL,R); /* R, long_R, long_C */2310 else2311 {2312 if (LL->m[0].Typ()==INT_CMD)2313 {2314 int ch=(int)(long)LL->m[0].Data();2315 while ((ch!=fftable[is_gf_char]) && (fftable[is_gf_char])) is_gf_char++;2316 if (fftable[is_gf_char]==0) is_gf_char=-1;2317 }2318 if (is_gf_char==-1)2319 {2320 R->cf->extRing=rCompose((lists)L->m[0].Data());2321 if (R->cf->extRing==NULL)2322 {2323 WerrorS("could not create rational function coefficient field");2324 goto rCompose_err;2325 }2326 if (R->cf->extRing->cf->ch>0)2327 R->cf->ch= -R->cf->extRing->cf->ch;2328 else2329 R->cf->ch=1;2330 R->cf->extRing->names=(char**)omAlloc0(rPar(R)*sizeof(char_ptr));2331 int i;2332 for(i=rPar(R)-1;i>=0;i--)2333 R->cf->extRing->names[i]=omStrDup(R->cf->extRing->names[i]);2334 if (R->cf->extRing->qideal!=NULL)2335 {2336 if (IDELEMS(R->cf->extRing->qideal)==1)2337 {2338 R->cf->extRing->qideal->m[0]=naInit(1,R);2339 lnumber n=(lnumber)R->minpoly;2340 n->z=R->cf->extRing->qideal->m[0];2341 naMinimalPoly=n->z;2342 R->cf->extRing->qideal->m[0]=NULL;2343 idDelete(&(R->cf->extRing->qideal));2344 //redefineFunctionPointers();2345 }2346 else2347 {2348 WerrorS("not implemented yet.");2349 }2350 }2351 }2352 else2353 { // gf-char2354 R->cf->ch=fftable[is_gf_char];2355 R->cf->extRing->N=1;2356 R->cf->extRing->names=(char**)omAlloc0(1*sizeof(char_ptr));2357 R->cf->extRing->names[0]=omStrDup((char*)((lists)(LL->m[1].Data()))->m[0].Data());2358 }2359 }2360 }2361 else2362 {2363 WerrorS("coefficient field must be described by `int` or `list`");2364 goto rCompose_err;2365 }2366 rRenameVars(R);2367 rComplete(R);2368 #ifdef HABE_RINGS2369 // currently, coefficients which are ring elements require a global ordering:2370 if (rField_is_Ring(R) && (R->pOrdSgn==-1))2371 {2372 WerrorS("global ordering required for these coefficients");2373 goto rCompose_err;2374 }2375 #endif2376 2409 // ------------------------ Q-IDEAL ------------------------ 2377 2410
Note: See TracChangeset
for help on using the changeset viewer.