Changeset 6cc7f5 in git
- Timestamp:
- Aug 12, 2011, 5:35:41 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 15ff9a6aa572d653f57ec07a5a7dbca09e320c29
- Parents:
- 45c9bd3cc75a93224a2ce248f62c450b05c2ec61
- git-author:
- Burcin Erocal <burcin@erocal.org>2011-08-12 17:35:41+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:24:02+01:00
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipshell.cc
r45c9bd3 r6cc7f5 7 7 */ 8 8 9 //#include <stdlib.h>10 #include <stdio.h>11 #include <string.h>12 #include <ctype.h>13 9 #include <math.h> 14 10 11 #include <misc/options.h> 12 #include <misc/auxiliary.h> 13 #ifdef HAVE_FACTORY 14 #define SI_DONT_HAVE_GLOBAL_VARS 15 #include <factory/factory.h> 16 #endif 17 18 #include <Singular/maps_ip.h> 15 19 #include <kernel/mod2.h> 16 20 #include <Singular/tok.h> … … 21 25 #include <kernel/febase.h> 22 26 #include <polys/polys.h> 27 #include <coeffs/numbers.h> 23 28 #include <polys/prCopy.h> 24 29 #include <kernel/ideals.h> … … 48 53 #include <polys/monomials/ring.h> 49 54 #include <Singular/ipshell.h> 50 #ifdef HAVE_FACTORY 51 #define SI_DONT_HAVE_GLOBAL_VARS 52 #include <factory/factory.h> 53 #endif 55 #include <polys/ext_fields/algext.h> 56 #include <coeffs/mpr_complex.h> 57 #include <coeffs/longrat.h> 58 #include <numeric/mpr_base.h> 59 #include <numeric/mpr_numeric.h> 54 60 55 61 // define this if you want to use the fast_map routine for mapping ideals … … 653 659 // rPar(IDRING(r)), 654 660 // IDRING(r)->minpoly))) 655 if ((nMap=nSetMap(IDRING(r) ))==NULL)661 if ((nMap=nSetMap(IDRING(r)->cf))==NULL) 656 662 { 657 663 if (rEqual(IDRING(r),currRing)) 658 664 { 659 nMap=n Copy;665 nMap=n_SetMap(currRing->cf, currRing->cf); 660 666 } 661 667 else … … 1197 1203 break; 1198 1204 case BIGINT_CMD: 1199 n lDelete(&IDNUMBER(pp),currRing);1205 n_Delete(&IDNUMBER(pp),currRing->cf); 1200 1206 break; 1201 1207 case MAP_CMD: … … 1506 1512 ring r = IDRING(tmp); 1507 1513 1508 r->c h= 32003;1509 r->N = 3;1514 r->cf->ch = 32003; 1515 r->N = 3; 1510 1516 /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/ 1511 1517 /*names*/ … … 1576 1582 // 0: char/ cf - ring 1577 1583 L->m[0].rtyp=INT_CMD; 1578 L->m[0].data=(void *)r->c h;1584 L->m[0].data=(void *)r->cf->ch; 1579 1585 // ---------------------------------------- 1580 1586 // 1: list (var) … … 1679 1685 { 1680 1686 L->m[2].rtyp=STRING_CMD; 1681 L->m[2].data=(void *)omStrDup( R->parameter[0]);1687 L->m[2].data=(void *)omStrDup(rParameter(R)[0]); 1682 1688 } 1683 1689 // ---------------------------------------- … … 1705 1711 LL->Init(2); 1706 1712 LL->m[0].rtyp=BIGINT_CMD; 1707 LL->m[0].data=nlMapGMP((number) R-> ringflaga);1713 LL->m[0].data=nlMapGMP((number) R->cf->modBase, R->cf, R->cf); 1708 1714 LL->m[1].rtyp=INT_CMD; 1709 LL->m[1].data=(void *) R-> ringflagb;1715 LL->m[1].data=(void *) R->cf->modExponent; 1710 1716 L->m[1].rtyp=LIST_CMD; 1711 1717 L->m[1].data=(void *)LL; … … 1754 1760 else if (rIsExtension(r)) 1755 1761 { 1756 if ( r->extRing!=NULL)1757 rDecomposeCF(&(L->m[0]),r-> extRing,r);1762 if (nCoeff_is_algExt(r->cf)) 1763 rDecomposeCF(&(L->m[0]),r->cf->extRing,r); 1758 1764 else 1759 1765 { … … 1762 1768 // char: 1763 1769 Lc->m[0].rtyp=INT_CMD; 1764 Lc->m[0].data=(void*)r->c h;1770 Lc->m[0].data=(void*)r->cf->ch; 1765 1771 // var: 1766 1772 lists Lv=(lists)omAlloc0Bin(slists_bin); 1767 1773 Lv->Init(1); 1768 1774 Lv->m[0].rtyp=STRING_CMD; 1769 Lv->m[0].data=(void *)omStrDup(r ->parameter[0]);1775 Lv->m[0].data=(void *)omStrDup(rParameter(r)[0]); 1770 1776 Lc->m[1].rtyp=LIST_CMD; 1771 1777 Lc->m[1].data=(void*)Lv; … … 1802 1808 { 1803 1809 L->m[0].rtyp=INT_CMD; 1804 L->m[0].data=(void *)r->c h;1810 L->m[0].data=(void *)r->cf->ch; 1805 1811 } 1806 1812 // ---------------------------------------- … … 1885 1891 { 1886 1892 L->m[4].rtyp=MATRIX_CMD; 1887 L->m[4].data=(void *)mp Copy(r->GetNC()->C);1893 L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r); 1888 1894 L->m[5].rtyp=MATRIX_CMD; 1889 L->m[5].data=(void *)mp Copy(r->GetNC()->D);1895 L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r); 1890 1896 } 1891 1897 #endif … … 1903 1909 return; 1904 1910 } 1905 R->c h=-1;1911 R->cf->ch=-1; 1906 1912 // ---------------------------------------- 1907 1913 // 1: … … 1926 1932 if (L->nr==2) 1927 1933 { 1928 R-> P=1;1934 R->cf->extRing->N=1; 1929 1935 if (L->m[2].rtyp!=STRING_CMD) 1930 1936 { … … 1932 1938 return; 1933 1939 } 1934 R-> parameter=(char**)omAlloc0(R->P*sizeof(char_ptr));1935 R-> parameter[0]=omStrDup((char *)L->m[2].data);1940 R->cf->extRing->names=(char**)omAlloc0(rPar(R)*sizeof(char_ptr)); 1941 R->cf->extRing->names[0]=omStrDup((char *)L->m[2].data); 1936 1942 } 1937 1943 // ---------------------------------------- … … 1945 1951 // 0: string: integer 1946 1952 // no further entries --> Z 1947 R-> ringflaga= (int_number) omAlloc(sizeof(mpz_t));1953 R->cf->modBase = (int_number) omAlloc(sizeof(mpz_t)); 1948 1954 if (L->nr == 0) 1949 1955 { 1950 mpz_init_set_ui(R-> ringflaga,0);1951 R-> ringflagb= 1;1956 mpz_init_set_ui(R->cf->modBase,0); 1957 R->cf->modExponent = 1; 1952 1958 } 1953 1959 // ---------------------------------------- … … 1957 1963 if (L->m[1].rtyp!=LIST_CMD) Werror("invald data, expecting list of numbers"); 1958 1964 lists LL=(lists)L->m[1].data; 1959 mpz_init(R-> ringflaga);1965 mpz_init(R->cf->modBase); 1960 1966 if ((LL->nr >= 0) && LL->m[0].rtyp == BIGINT_CMD) 1961 1967 { 1962 number ringflaga= (number) LL->m[0].data;1963 nlGMP( ringflaga, (number) R->ringflaga);1964 LL->m[0].data = (void *) ringflaga;1968 number modBase = (number) LL->m[0].data; 1969 nlGMP(modBase, (number) R->cf->modBase, R->cf); 1970 LL->m[0].data = (void *)modBase; 1965 1971 } 1966 1972 else if ((LL->nr >= 0) && LL->m[0].rtyp == INT_CMD) 1967 1973 { 1968 mpz_set_ui(R-> ringflaga,(unsigned long) LL->m[0].data);1974 mpz_set_ui(R->cf->modBase,(unsigned long) LL->m[0].data); 1969 1975 } 1970 1976 else 1971 1977 { 1972 mpz_set_ui(R-> ringflaga,0);1978 mpz_set_ui(R->cf->modBase,0); 1973 1979 } 1974 1980 if (LL->nr >= 1) 1975 1981 { 1976 R-> ringflagb= (unsigned long) LL->m[1].data;1982 R->cf->modExponent = (unsigned long) LL->m[1].data; 1977 1983 } 1978 1984 else 1979 1985 { 1980 R-> ringflagb= 1;1986 R->cf->modExponent = 1; 1981 1987 } 1982 1988 } 1983 1989 // ---------------------------------------- 1984 if ((mpz_cmp_ui(R-> ringflaga, 1) == 0) && (mpz_cmp_ui(R->ringflaga, 0) < 0))1990 if ((mpz_cmp_ui(R->cf->modBase, 1) == 0) && (mpz_cmp_ui(R->cf->modBase, 0) < 0)) 1985 1991 { 1986 1992 Werror("Wrong ground ring specification (module is 1)"); 1987 1993 return; 1988 1994 } 1989 if (R-> ringflagb< 1)1995 if (R->cf->modExponent < 1) 1990 1996 { 1991 1997 Werror("Wrong ground ring specification (exponent smaller than 1"); … … 1993 1999 } 1994 2000 // module is 0 ---> integers 1995 if (mpz_cmp_ui(R-> ringflaga, 0) == 0)1996 { 1997 R->c h = 0;1998 R-> ringtype = 4;2001 if (mpz_cmp_ui(R->cf->modBase, 0) == 0) 2002 { 2003 R->cf->ch = 0; 2004 R->cf->ringtype = 4; 1999 2005 } 2000 2006 // we have an exponent 2001 else if (R-> ringflagb> 1)2002 { 2003 R->c h = R->ringflagb;2004 if ((mpz_cmp_ui(R-> ringflaga, 2) == 0) && (R->ringflagb<= 8*sizeof(NATNUMBER)))2005 { 2006 /* this branch should be active for ringflagb= 2..32 resp. 2..64,2007 else if (R->cf->modExponent > 1) 2008 { 2009 R->cf->ch = R->cf->modExponent; 2010 if ((mpz_cmp_ui(R->cf->modBase, 2) == 0) && (R->cf->modExponent <= 8*sizeof(NATNUMBER))) 2011 { 2012 /* this branch should be active for modExponent = 2..32 resp. 2..64, 2007 2013 depending on the size of a long on the respective platform */ 2008 R-> ringtype = 1; // Use Z/2^ch2014 R->cf->ringtype = 1; // Use Z/2^ch 2009 2015 } 2010 2016 else 2011 2017 { 2012 R-> ringtype = 3;2018 R->cf->ringtype = 3; 2013 2019 } 2014 2020 } … … 2016 2022 else 2017 2023 { 2018 R-> ringtype = 2;2019 R->c h = mpz_get_ui(R->ringflaga);2024 R->cf->ringtype = 2; 2025 R->cf->ch = mpz_get_ui(R->cf->modBase); 2020 2026 } 2021 2027 } … … 2038 2044 } 2039 2045 } 2040 for(i=0;i< R->P; i++)2046 for(i=0;i<rPar(R); i++) 2041 2047 { 2042 2048 for(j=0;j<R->N;j++) 2043 2049 { 2044 if (strcmp( R->parameter[i],R->names[j])==0)2050 if (strcmp(rParameter(R)[i],R->names[j])==0) 2045 2051 { 2046 2052 Warn("name conflict par(%d) and var(%d): `%s`, rename to `@@(%d)`",i+1,j+1,R->names[j],i+1); 2047 omFree( R->parameter[i]);2048 R->parameter[i]=(char *)omAlloc(10);2049 sprintf( R->parameter[i],"@@(%d)",i+1);2053 omFree(rParameter(R)[i]); 2054 rParameter(R)[i]=(char *)omAlloc(10); 2055 sprintf(rParameter(R)[i],"@@(%d)",i+1); 2050 2056 } 2051 2057 } … … 2270 2276 if (L->m[0].Typ()==INT_CMD) 2271 2277 { 2272 R->c h=(int)(long)L->m[0].Data();2273 if (R->c h!=-1)2278 R->cf->ch=(int)(long)L->m[0].Data(); 2279 if (R->cf->ch!=-1) 2274 2280 { 2275 2281 int l=0; 2276 if (((R->c h!=0) && (R->ch<2) && (is_gf_char=-1))2282 if (((R->cf->ch!=0) && (R->cf->ch<2) && (is_gf_char=-1)) 2277 2283 #ifndef NV_OPS 2278 || (R->c h > 32003)2284 || (R->cf->ch > 32003) 2279 2285 #endif 2280 || ((l=IsPrime(R->c h))!=R->ch)2286 || ((l=IsPrime(R->cf->ch))!=R->cf->ch) 2281 2287 ) 2282 2288 { 2283 Warn("%d is invalid characteristic of ground field. %d is used.", R->c h,l);2284 R->c h=l;2289 Warn("%d is invalid characteristic of ground field. %d is used.", R->cf->ch,l); 2290 R->cf->ch=l; 2285 2291 } 2286 2292 } … … 2308 2314 if (is_gf_char==-1) 2309 2315 { 2310 R-> extRing=rCompose((lists)L->m[0].Data());2311 if (R-> extRing==NULL)2316 R->cf->extRing=rCompose((lists)L->m[0].Data()); 2317 if (R->cf->extRing==NULL) 2312 2318 { 2313 2319 WerrorS("could not create rational function coefficient field"); 2314 2320 goto rCompose_err; 2315 2321 } 2316 if (R-> extRing->ch>0)2317 R->c h= -R->extRing->ch;2322 if (R->cf->extRing->cf->ch>0) 2323 R->cf->ch= -R->cf->extRing->cf->ch; 2318 2324 else 2319 R->ch=1; 2320 R->P=R->extRing->N; 2321 R->parameter=(char**)omAlloc0(R->P*sizeof(char_ptr)); 2325 R->cf->ch=1; 2326 R->cf->extRing->names=(char**)omAlloc0(rPar(R)*sizeof(char_ptr)); 2322 2327 int i; 2323 for(i= R->P-1;i>=0;i--)2324 R-> parameter[i]=omStrDup(R->extRing->names[i]);2325 if (R-> extRing->qideal!=NULL)2328 for(i=rPar(R)-1;i>=0;i--) 2329 R->cf->extRing->names[i]=omStrDup(R->cf->extRing->names[i]); 2330 if (R->cf->extRing->qideal!=NULL) 2326 2331 { 2327 if (IDELEMS(R-> extRing->qideal)==1)2332 if (IDELEMS(R->cf->extRing->qideal)==1) 2328 2333 { 2329 R-> minpoly=naInit(1,R);2334 R->cf->extRing->qideal->m[0]=naInit(1,R); 2330 2335 lnumber n=(lnumber)R->minpoly; 2331 n->z=R-> extRing->qideal->m[0];2336 n->z=R->cf->extRing->qideal->m[0]; 2332 2337 naMinimalPoly=n->z; 2333 R-> extRing->qideal->m[0]=NULL;2334 idDelete(&(R-> extRing->qideal));2338 R->cf->extRing->qideal->m[0]=NULL; 2339 idDelete(&(R->cf->extRing->qideal)); 2335 2340 //redefineFunctionPointers(); 2336 2341 } … … 2343 2348 else 2344 2349 { // gf-char 2345 R->c h=fftable[is_gf_char];2346 R-> P=1;2347 R-> parameter=(char**)omAlloc0(1*sizeof(char_ptr));2348 R-> parameter[0]=omStrDup((char*)((lists)(LL->m[1].Data()))->m[0].Data());2350 R->cf->ch=fftable[is_gf_char]; 2351 R->cf->extRing->N=1; 2352 R->cf->extRing->names=(char**)omAlloc0(1*sizeof(char_ptr)); 2353 R->cf->extRing->names[0]=omStrDup((char*)((lists)(LL->m[1].Data()))->m[0].Data()); 2349 2354 } 2350 2355 } … … 2372 2377 if (q->m[0]!=NULL) 2373 2378 { 2374 if (R->c h!=currRing->ch)2379 if (R->cf->ch!=currRing->cf->ch) 2375 2380 { 2376 2381 #if 0 … … 2386 2391 BOOLEAN bo; 2387 2392 2388 if ((nMap=nSetMap(orig_ring ))==NULL)2393 if ((nMap=nSetMap(orig_ring->cf))==NULL) 2389 2394 { 2390 2395 if (rEqual(orig_ring,currRing)) 2391 2396 { 2392 nMap=n Copy;2397 nMap=n_SetMap(currRing->cf, currRing->cf); 2393 2398 } 2394 2399 else 2395 2400 // Allow imap/fetch to be make an exception only for: 2396 2401 if ( (rField_is_Q_a(orig_ring) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a) 2397 (rField_is_Q( ) || rField_is_Q_a() ||2398 (rField_is_Zp( ) || rField_is_Zp_a())))2402 (rField_is_Q(currRing) || rField_is_Q_a(currRing) || 2403 (rField_is_Zp(currRing) || rField_is_Zp_a(currRing)))) 2399 2404 || 2400 2405 (rField_is_Zp_a(orig_ring) && // Zp(a..) -> Zp(a..) || Zp … … 2407 2412 naSetChar(rInternalChar(orig_ring),orig_ring); 2408 2413 else naSetChar(rInternalChar(orig_ring),orig_ring); 2409 nSetChar(currRing );2414 nSetChar(currRing->cf); 2410 2415 test=save_test; 2411 2416 } … … 2438 2443 for(i=IDELEMS(q)-1; i>=0; i--) 2439 2444 { 2440 dest_id->m[i]=p PermPoly(q->m[i],perm,orig_ring,nMap,2445 dest_id->m[i]=p_PermPoly(q->m[i],perm,orig_ring, currRing,nMap, 2441 2446 par_perm,par_perm_size); 2442 2447 // PrintS("map:");pWrite(dest_id->m[i]);PrintLn(); … … 2654 2659 } 2655 2660 } 2656 if ( idRankFreeModule(trueres[0])> 0)2661 if (/* idRankFreeModule(trueres[0]) */ trueres[0] > 0) 2657 2662 typ0 = MODUL_CMD; 2658 2663 if (syzstr->weights!=NULL) … … 2751 2756 wFunctional = wFunctionalBuch; 2752 2757 x = (int * )omAlloc(2 * (n + 1) * sizeof(int)); 2753 wCall(s, sl, x, wNsqr );2758 wCall(s, sl, x, wNsqr, currRing); 2754 2759 for (i = n; i!=0; i--) 2755 2760 (*iv)[i-1] = x[i + n + 1]; … … 2778 2783 BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w) 2779 2784 { 2780 res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(), (poly)w->CopyD()); 2785 res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(), 2786 (poly)w->CopyD(), currRing); 2781 2787 return errorreported; 2782 2788 } 2783 2789 BOOLEAN jjCHARSERIES(leftv res, leftv u) 2784 2790 { 2785 res->data=singclap_irrCharSeries((ideal)u->Data() );2791 res->data=singclap_irrCharSeries((ideal)u->Data(), currRing); 2786 2792 return (res->data==NULL); 2787 2793 } … … 3031 3037 // ---------------------------------- 3032 3038 3033 if( hasConstTerm( h ) )3039 if( hasConstTerm( h, currRing ) ) 3034 3040 { 3035 3041 return spectrumBadPoly; … … 3040 3046 // -------------------------------- 3041 3047 3042 if( hasLinearTerm( h ) )3048 if( hasLinearTerm( h, currRing ) ) 3043 3049 { 3044 3050 *L = (lists)omAllocBin( slists_bin); … … 3123 3129 // ------------------------------------------ 3124 3130 3125 if( hasOne( stdJ ) )3131 if( hasOne( stdJ, currRing ) ) 3126 3132 { 3127 3133 // ------------------------------- … … 3144 3150 for( i=rVar(currRing); i>0; i-- ) 3145 3151 { 3146 if( hasAxis( stdJ,i )==FALSE )3152 if( hasAxis( stdJ,i, currRing )==FALSE ) 3147 3153 { 3148 3154 return spectrumNotIsolated; … … 3231 3237 3232 3238 poly wc = ( fast==0 ? pCopy( hc ) : 3233 ( fast==1 ? computeWC( nph,(Rational)rVar(currRing) ) : 3234 /* fast==2 */computeWC( nph,((Rational)rVar(currRing))/(Rational)2 ) ) ); 3239 ( fast==1 ? computeWC( nph,(Rational)rVar(currRing), currRing ) : 3240 /* fast==2 */computeWC( nph, 3241 ((Rational)rVar(currRing))/(Rational)2, currRing ) ) ); 3235 3242 3236 3243 #ifdef SPECTRUM_DEBUG … … 3261 3268 spectrumPolyList NF( &nph ); 3262 3269 3263 computeNF( stdJ,hc,wc,&NF );3270 computeNF( stdJ,hc,wc,&NF, currRing ); 3264 3271 3265 3272 #ifdef SPECTRUM_DEBUG … … 3329 3336 // check for a local ring 3330 3337 3331 if( !ringIsLocal( ) )3338 if( !ringIsLocal(currRing ) ) 3332 3339 { 3333 3340 WerrorS( "only works for local orderings" ); … … 4008 4015 BOOLEAN loSimplex( leftv res, leftv args ) 4009 4016 { 4010 if ( !(rField_is_long_R( )) )4017 if ( !(rField_is_long_R(currRing)) ) 4011 4018 { 4012 4019 WerrorS("Ground field not implemented!"); … … 4122 4129 int howclean= (int)(long)arg3->Data(); 4123 4130 4124 if ( !(rField_is_R( ) ||4125 rField_is_Q( ) ||4126 rField_is_long_R( ) ||4127 rField_is_long_C( )) )4131 if ( !(rField_is_R(currRing) || 4132 rField_is_Q(currRing) || 4133 rField_is_long_R(currRing) || 4134 rField_is_long_C(currRing)) ) 4128 4135 { 4129 4136 WerrorS("Ground field not implemented!"); … … 4131 4138 } 4132 4139 4133 if ( !(rField_is_R()||rField_is_long_R()||rField_is_long_C()) ) 4140 if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \ 4141 rField_is_long_C(currRing)) ) 4134 4142 { 4135 4143 unsigned long int ii = (unsigned long int)arg2->Data(); … … 4213 4221 rlist->Init( elem ); 4214 4222 4215 if (rField_is_long_C( ))4223 if (rField_is_long_C(currRing)) 4216 4224 { 4217 4225 for ( j= 0; j < elem; j++ ) … … 4226 4234 for ( j= 0; j < elem; j++ ) 4227 4235 { 4228 dummy = complexToStr( (*roots)[j], gmp_output_digits );4236 dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf ); 4229 4237 rlist->m[j].rtyp=STRING_CMD; 4230 4238 rlist->m[j].data=(void *)dummy; … … 4284 4292 return TRUE; 4285 4293 } 4286 if ( !(rField_is_Q( ) /* ||4294 if ( !(rField_is_Q(currRing) /* || 4287 4295 rField_is_R() || rField_is_long_R() || 4288 4296 rField_is_long_C()*/ ) ) … … 4391 4399 if ( v->Typ() != INT_CMD ) 4392 4400 return TRUE; 4393 else if ( !(rField_is_R()||rField_is_long_R()||rField_is_long_C()) ) 4401 else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \ 4402 rField_is_long_C(currRing)) ) 4394 4403 { 4395 4404 unsigned long int ii=(unsigned long int)v->Data(); … … 4523 4532 for ( j= 0; j < elem; j++ ) 4524 4533 { 4525 if ( !rField_is_long_C( ) )4534 if ( !rField_is_long_C(currRing) ) 4526 4535 { 4527 4536 onepoint->m[j].rtyp=STRING_CMD; 4528 onepoint->m[j].data=(void *)complexToStr((*roots[j])[i],oprec); 4537 onepoint->m[j].data=(void *)complexToStr((*roots[j])[i],oprec, 4538 currRing->cf); 4529 4539 } 4530 4540 else … … 4887 4897 #ifdef HAVE_RINGS 4888 4898 unsigned int ringtype = 0; 4889 int_number ringflaga= NULL;4890 unsigned int ringflagb= 1;4899 int_number modBase = NULL; 4900 unsigned int modExponent = 1; 4891 4901 #endif 4892 4902 int float_len=0; … … 4930 4940 else if ((pn->name != NULL) && (strcmp(pn->name, "integer") == 0)) 4931 4941 { 4932 ringflaga= (int_number) omAlloc(sizeof(mpz_t));4933 mpz_init_set_si( ringflaga, 0);4942 modBase = (int_number) omAlloc(sizeof(mpz_t)); 4943 mpz_init_set_si(modBase, 0); 4934 4944 if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD)) 4935 4945 { 4936 mpz_set_ui( ringflaga, (int)(long) pn->next->Data());4946 mpz_set_ui(modBase, (int)(long) pn->next->Data()); 4937 4947 pn=pn->next; 4938 4948 if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD)) 4939 4949 { 4940 ringflagb= (long) pn->next->Data();4950 modExponent = (long) pn->next->Data(); 4941 4951 pn=pn->next; 4942 4952 } 4943 4953 while ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD)) 4944 4954 { 4945 mpz_mul_ui( ringflaga, ringflaga, (int)(long) pn->next->Data());4955 mpz_mul_ui(modBase, modBase, (int)(long) pn->next->Data()); 4946 4956 pn=pn->next; 4947 4957 } 4948 4958 } 4949 if ((mpz_cmp_ui( ringflaga, 1) == 0) && (mpz_cmp_ui(ringflaga, 0) < 0))4959 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0)) 4950 4960 { 4951 4961 Werror("Wrong ground ring specification (module is 1)"); 4952 4962 goto rInitError; 4953 4963 } 4954 if ( ringflagb< 1)4964 if (modExponent < 1) 4955 4965 { 4956 4966 Werror("Wrong ground ring specification (exponent smaller than 1"); … … 4958 4968 } 4959 4969 // module is 0 ---> integers 4960 if (mpz_cmp_ui( ringflaga, 0) == 0)4970 if (mpz_cmp_ui(modBase, 0) == 0) 4961 4971 { 4962 4972 ch = 0; … … 4964 4974 } 4965 4975 // we have an exponent 4966 else if ( ringflagb> 1)4967 { 4968 ch = ringflagb;4969 if ((mpz_cmp_ui( ringflaga, 2) == 0) && (ringflagb<= 8*sizeof(NATNUMBER)))4970 { 4971 /* this branch should be active for ringflagb= 2..32 resp. 2..64,4976 else if (modExponent > 1) 4977 { 4978 ch = modExponent; 4979 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(NATNUMBER))) 4980 { 4981 /* this branch should be active for modExponent = 2..32 resp. 2..64, 4972 4982 depending on the size of a long on the respective platform */ 4973 4983 ringtype = 1; // Use Z/2^ch … … 4982 4992 { 4983 4993 ringtype = 2; 4984 ch = mpz_get_ui( ringflaga);4994 ch = mpz_get_ui(modBase); 4985 4995 } 4986 4996 } … … 5044 5054 // allocated ring and set ch 5045 5055 R = (ring) omAlloc0Bin(sip_sring_bin); 5046 R->c h = ch;5056 R->cf->ch = ch; 5047 5057 #ifdef HAVE_RINGS 5048 R-> ringtype = ringtype;5049 R-> ringflaga = ringflaga;5050 R-> ringflagb = ringflagb;5058 R->cf->ringtype = ringtype; 5059 R->cf->modBase = modBase; 5060 R->cf->modExponent = modExponent; 5051 5061 #endif 5052 5062 if (ch == -1) … … 5059 5069 if (pn!=NULL) 5060 5070 { 5061 R-> P=pn->listLength();5062 //if ((ffChar|| (ch == 1)) && ( R->P> 1))5063 if (( R->P> 1) && (ffChar || (ch == -1)))5071 R->cf->extRing->N=pn->listLength(); 5072 //if ((ffChar|| (ch == 1)) && (rPar(R) > 1)) 5073 if ((rPar(R) > 1) && (ffChar || (ch == -1))) 5064 5074 { 5065 5075 WerrorS("too many parameters"); 5066 5076 goto rInitError; 5067 5077 } 5068 R-> parameter=(char**)omAlloc0(R->P*sizeof(char_ptr));5069 if (rSleftvList2StringArray(pn, R-> parameter))5078 R->cf->extRing->names=(char**)omAlloc0(rPar(R)*sizeof(char_ptr)); 5079 if (rSleftvList2StringArray(pn, R->cf->extRing->names)) 5070 5080 { 5071 5081 WerrorS("parameter expected"); 5072 5082 goto rInitError; 5073 5083 } 5074 if (ch>1 && !ffChar) R->c h=-ch;5075 else if (ch==0) R->c h=1;5084 if (ch>1 && !ffChar) R->cf->ch=-ch; 5085 else if (ch==0) R->cf->ch=1; 5076 5086 } 5077 5087 else if (ffChar) … … 5082 5092 /* post-processing of field description */ 5083 5093 // we have short reals, but no short complex 5084 if ((R->c h == - 1)5085 && ( R->parameter!=NULL)5094 if ((R->cf->ch == - 1) 5095 && (rParameter(R) !=NULL) 5086 5096 && (R->float_len < SHORT_REAL_LENGTH)) 5087 5097 { … … 5411 5421 } 5412 5422 5413 idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n =NULL)5423 idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n) 5414 5424 { 5415 5425 //idhdl next_best=NULL; -
Singular/ipshell.h
r45c9bd3 r6cc7f5 206 206 void rSetHdl(idhdl h); 207 207 ring rInit(sleftv* pn, sleftv* rv, sleftv* ord); 208 idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL); 208 209 idhdl rFindHdl(ring r, idhdl n, idhdl w); 209 210 void rKill(idhdl h); -
Singular/maps_ip.h
r45c9bd3 r6cc7f5 20 20 ideal idSubstPoly(ideal id, int n, poly e); 21 21 ideal idSubstPar(ideal id, int n, poly e); 22 23 24 /* 25 * maps the expression w to res, 26 * switch what: MAP_CMD: use theMap for mapping, N for preimage ring 27 * //FETCH_CMD: use pOrdPoly for mapping 28 * IMAP_CMD: use perm for mapping, N for preimage ring 29 * default: map only poly-structures, 30 * use perm and par_perm, N and P, 31 */ 32 BOOLEAN maApplyFetch(int what,map theMap,leftv res, leftv w, ring preimage_r, 33 int *perm, int *par_perm, int P, nMapFunc nMap); 22 34 #endif -
libpolys/coeffs/longrat.h
r45c9bd3 r6cc7f5 69 69 70 70 #ifdef HAVE_RINGS 71 number nlMapGMP(number from, const coeffs src, const coeffs dst); 71 72 void nlGMP(number &i, number n, const coeffs r); 72 73 #endif -
libpolys/polys/monomials/ring.cc
r45c9bd3 r6cc7f5 77 77 }; 78 78 79 #define rInternalChar(r) ((r)->cf->ch)80 79 81 80 const char * rSimpleOrdStr(int ord) -
libpolys/polys/monomials/ring.h
r45c9bd3 r6cc7f5 568 568 /// if m == var(i)/1 => return i, 569 569 int n_IsParam(number m, const ring r); 570 571 //#define rInternalChar(r) ((r)->cf->ch) 572 static inline int rInternalChar(const ring r) 573 { 574 assume(r != NULL); 575 const coeffs C = r->cf; 576 assume(C != NULL); 577 return C->ch; 578 } 579 570 580 571 581 /* R, Q, Fp: FALSE */ -
numeric/mpr_base.h
r45c9bd3 r6cc7f5 11 11 */ 12 12 13 #include < kernel/mpr_numeric.h>13 #include <numeric/mpr_numeric.h> 14 14 15 15 #define SNONE -1 -
numeric/mpr_numeric.h
r45c9bd3 r6cc7f5 13 13 14 14 //-> include & define stuff 15 #include < kernel/numbers.h>16 #include < kernel/mpr_global.h>17 #include < kernel/mpr_complex.h>15 #include <coeffs/numbers.h> 16 #include <coeffs/mpr_global.h> 17 #include <coeffs/mpr_complex.h> 18 18 19 19 // define polish mode when finding roots
Note: See TracChangeset
for help on using the changeset viewer.