Changeset bf38a4 in git
 Timestamp:
 Aug 12, 2011, 4:34:17 PM (12 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
 Children:
 33e249b0536a97f2ce55d8d4301209e30d449476
 Parents:
 e92b071a14e237753ca43c8b8faad5e5199cd077
 gitauthor:
 Hans Schoenemann <hannes@mathematik.unikl.de>20110812 16:34:17+02:00
 gitcommitter:
 Mohamed Barakat <mohamed.barakat@rwthaachen.de>20111109 13:22:41+01:00
 Location:
 Singular
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

Singular/iparith.cc
re92b07 rbf38a4 472 472 if (e>=0) 473 473 { 474 n lPower(n,e,(number*)&res>data);474 n_Power(n,e,(number*)&res>data,coeffs_BIGINT); 475 475 } 476 476 else … … 642 642 static BOOLEAN jjPLUS_BI(leftv res, leftv u, leftv v) 643 643 { 644 res>data = (char *)(n lAdd((number)u>Data(), (number)v>Data()));644 res>data = (char *)(n_Add((number)u>Data(), (number)v>Data(),coeffs_BIGINT)); 645 645 return jjPLUSMINUS_Gen(res,u,v); 646 646 } … … 669 669 { 670 670 matrix A=(matrix)u>Data(); matrix B=(matrix)v>Data(); 671 res>data = (char *)(mp Add(A , B));671 res>data = (char *)(mp_Add(A , B, currRing)); 672 672 if (res>data==NULL) 673 673 { … … 681 681 { 682 682 matrix m=(matrix)u>Data(); 683 matrix p= mp InitP(m>nrows,m>ncols,(poly)(v>CopyD(POLY_CMD)));683 matrix p= mp_InitP(m>nrows,m>ncols,(poly)(v>CopyD(POLY_CMD)),currRing); 684 684 if (iiOp=='+') 685 res>data = (char *)mp Add(m , p);685 res>data = (char *)mp_Add(m , p,currRing); 686 686 else 687 res>data = (char *)mp Sub(m , p);687 res>data = (char *)mp_Sub(m , p,currRing); 688 688 idDelete((ideal *)&p); 689 689 return jjPLUSMINUS_Gen(res,u,v); … … 726 726 static BOOLEAN jjMINUS_BI(leftv res, leftv u, leftv v) 727 727 { 728 res>data = (char *)(n lSub((number)u>Data(), (number)v>Data()));728 res>data = (char *)(n_Sub((number)u>Data(), (number)v>Data(),coeffs_BIGINT)); 729 729 return jjPLUSMINUS_Gen(res,u,v); 730 730 } … … 752 752 { 753 753 matrix A=(matrix)u>Data(); matrix B=(matrix)v>Data(); 754 res>data = (char *)(mp Sub(A , B));754 res>data = (char *)(mp_Sub(A , B, currRing)); 755 755 if (res>data==NULL) 756 756 { … … 776 776 static BOOLEAN jjTIMES_BI(leftv res, leftv u, leftv v) 777 777 { 778 res>data = (char *)(n lMult( (number)u>Data(), (number)v>Data()));778 res>data = (char *)(n_Mult( (number)u>Data(), (number)v>Data(),coeffs_BIGINT)); 779 779 if ((v>next!=NULL)  (u>next!=NULL)) 780 780 return jjOP_REST(res,u,v); … … 848 848 { 849 849 res>data = (char *)idMult((ideal)u>Data(),(ideal)v>Data()); 850 id Normalize((ideal)res>data);850 id_Normalize((ideal)res>data,currRing); 851 851 if ((v>next!=NULL)  (u>next!=NULL)) 852 852 return jjOP_REST(res,u,v); … … 867 867 static BOOLEAN jjTIMES_MA_BI1(leftv res, leftv u, leftv v) 868 868 { 869 number n=n Init_bigint((number)v>Data());869 number n=n_Init_bigint((number)v>Data(),coeffs_BIGINT,currRing>cf); 870 870 poly p=pNSet(n); 871 ideal I= (ideal)mp MultP((matrix)u>CopyD(MATRIX_CMD),p);871 ideal I= (ideal)mp_MultP((matrix)u>CopyD(MATRIX_CMD),p,currRing); 872 872 res>data = (char *)I; 873 873 return FALSE; … … 881 881 poly p=(poly)v>CopyD(POLY_CMD); 882 882 int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/ 883 ideal I= (ideal)mp MultP((matrix)u>CopyD(MATRIX_CMD),p);883 ideal I= (ideal)mp_MultP((matrix)u>CopyD(MATRIX_CMD),p,currRing); 884 884 if (r>0) I>rank=r; 885 id Normalize(I);885 id_Normalize(I,currRing); 886 886 res>data = (char *)I; 887 887 return FALSE; … … 891 891 poly p=(poly)u>CopyD(POLY_CMD); 892 892 int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/ 893 ideal I= (ideal)pMultMp(p,(matrix)v>CopyD(MATRIX_CMD) );893 ideal I= (ideal)pMultMp(p,(matrix)v>CopyD(MATRIX_CMD),currRing); 894 894 if (r>0) I>rank=r; 895 id Normalize(I);895 id_Normalize(I,currRing); 896 896 res>data = (char *)I; 897 897 return FALSE; … … 901 901 number n=(number)v>CopyD(NUMBER_CMD); 902 902 poly p=pNSet(n); 903 res>data = (char *)mp MultP((matrix)u>CopyD(MATRIX_CMD),p);904 id Normalize((ideal)res>data);903 res>data = (char *)mp_MultP((matrix)u>CopyD(MATRIX_CMD),p,currRing); 904 id_Normalize((ideal)res>data,currRing); 905 905 return FALSE; 906 906 } … … 911 911 static BOOLEAN jjTIMES_MA_I1(leftv res, leftv u, leftv v) 912 912 { 913 res>data = (char *)mp MultI((matrix)u>CopyD(MATRIX_CMD),(int)(long)v>Data());914 id Normalize((ideal)res>data);913 res>data = (char *)mp_MultI((matrix)u>CopyD(MATRIX_CMD),(int)(long)v>Data(),currRing); 914 id_Normalize((ideal)res>data,currRing); 915 915 return FALSE; 916 916 } … … 922 922 { 923 923 matrix A=(matrix)u>Data(); matrix B=(matrix)v>Data(); 924 res>data = (char *)mp Mult(A,B);924 res>data = (char *)mp_Mult(A,B,currRing); 925 925 if (res>data==NULL) 926 926 { … … 929 929 return TRUE; 930 930 } 931 id Normalize((ideal)res>data);931 id_Normalize((ideal)res>data,currRing); 932 932 if ((v>next!=NULL)  (u>next!=NULL)) 933 933 return jjOP_REST(res,u,v); … … 936 936 static BOOLEAN jjGE_BI(leftv res, leftv u, leftv v) 937 937 { 938 number h=n lSub((number)u>Data(),(number)v>Data());939 res>data = (char *) (n lGreaterZero(h)(nlIsZero(h)));940 n lDelete(&h,NULL);938 number h=n_Sub((number)u>Data(),(number)v>Data(),coeffs_BIGINT); 939 res>data = (char *) (n_GreaterZero(h,coeffs_BIGINT)(n_IsZero(h,coeffs_BIGINT))); 940 n_Delete(&h,coeffs_BIGINT); 941 941 return FALSE; 942 942 } … … 954 954 static BOOLEAN jjGT_BI(leftv res, leftv u, leftv v) 955 955 { 956 number h=n lSub((number)u>Data(),(number)v>Data());957 res>data = (char *) (n lGreaterZero(h)&&(!nlIsZero(h)));958 n lDelete(&h,NULL);956 number h=n_Sub((number)u>Data(),(number)v>Data(),coeffs_BIGINT); 957 res>data = (char *) (n_GreaterZero(h,coeffs_BIGINT)&&(!n_IsZero(h,coeffs_BIGINT))); 958 n_Delete(&h,coeffs_BIGINT); 959 959 return FALSE; 960 960 } … … 1026 1026 { 1027 1027 number q=(number)v>Data(); 1028 if (n lIsZero(q))1028 if (n_IsZero(q,coeffs_BIGINT)) 1029 1029 { 1030 1030 WerrorS(ii_div_by_0); 1031 1031 return TRUE; 1032 1032 } 1033 q = n lIntDiv((number)u>Data(),q);1034 n lNormalize(q);1033 q = n_IntDiv((number)u>Data(),q,coeffs_BIGINT); 1034 n_Normalize(q,coeffs_BIGINT); 1035 1035 res>data = (char *)q; 1036 1036 return FALSE; … … 1063 1063 return FALSE; 1064 1064 } 1065 if ((pNext(q)!=NULL) && (!rField_is_Ring( )))1065 if ((pNext(q)!=NULL) && (!rField_is_Ring(currRing))) 1066 1066 { /* This means that q != 0 consists of at least two terms. 1067 1067 Moreover, currRing is over a field. */ … … 1070 1070 { 1071 1071 res>data=(void*)(singclap_pdivide(p /*(poly)(u>Data())*/ , 1072 q /*(poly)(v>Data())*/ ));1072 q /*(poly)(v>Data())*/ ,currRing)); 1073 1073 } 1074 1074 else … … 1096 1096 if (I>m[i]!=NULL) 1097 1097 { 1098 h=singclap_pdivide(I>m[i],q );1098 h=singclap_pdivide(I>m[i],q,currRing); 1099 1099 pSetCompP(h,i+1); 1100 1100 p=pAdd(p,h); … … 1113 1113 or that currRing is over a coefficient ring. */ 1114 1114 #ifdef HAVE_RINGS 1115 if (!rField_is_Domain( ))1115 if (!rField_is_Domain(currRing)) 1116 1116 { 1117 1117 WerrorS("division only defined over coefficient domains"); … … 1150 1150 #ifdef HAVE_FACTORY 1151 1151 MATELEM(mm,i,j) = singclap_pdivide( MATELEM(m,i,j) , 1152 q /*(poly)(v>Data())*/ );1152 q /*(poly)(v>Data())*/, currRing ); 1153 1153 #else /* HAVE_FACTORY */ 1154 1154 WerrorS("division only by a monomial"); … … 1160 1160 } 1161 1161 } 1162 id Normalize((ideal)mm);1162 id_Normalize((ideal)mm,currRing); 1163 1163 res>data=(char *)mm; 1164 1164 return FALSE; … … 1166 1166 static BOOLEAN jjEQUAL_BI(leftv res, leftv u, leftv v) 1167 1167 { 1168 res>data = (char *)((long)n lEqual((number)u>Data(),(number)v>Data()));1168 res>data = (char *)((long)n_Equal((number)u>Data(),(number)v>Data(),coeffs_BIGINT)); 1169 1169 jjEQUAL_REST(res,u,v); 1170 1170 return FALSE; … … 1178 1178 static BOOLEAN jjEQUAL_Ma(leftv res, leftv u, leftv v) 1179 1179 { 1180 res>data = (char *)((long)mp Equal((matrix)u>Data(),(matrix)v>Data()));1180 res>data = (char *)((long)mp_Equal((matrix)u>Data(),(matrix)v>Data(),currRing)); 1181 1181 jjEQUAL_REST(res,u,v); 1182 1182 return FALSE; … … 1519 1519 for(i=rl1;i>=0;i) 1520 1520 { 1521 q[i]=n lInit((*p)[i], NULL);1522 x[i]=n lInit((*c)[i], NULL);1523 } 1524 number n=n lChineseRemainder(x,q,rl);1521 q[i]=n_Init((*p)[i], coeffs_BIGINT); 1522 x[i]=n_Init((*c)[i], coeffs_BIGINT); 1523 } 1524 number n=n_ChineseRemainder(x,q,rl,coeffs_BIGINT); 1525 1525 for(i=rl1;i>=0;i) 1526 1526 { 1527 n lDelete(&(q[i]),NULL);1528 n lDelete(&(x[i]),NULL);1527 n_Delete(&(q[i]),coeffs_BIGINT); 1528 n_Delete(&(x[i]),coeffs_BIGINT); 1529 1529 } 1530 1530 omFree(x); omFree(q); … … 1599 1599 static BOOLEAN jjCHINREM_ID(leftv res, leftv u, leftv v) 1600 1600 { 1601 if ((currRing==NULL)  rField_is_Q( ))1601 if ((currRing==NULL)  rField_is_Q(currRing)) 1602 1602 { 1603 1603 lists c=(lists)u>CopyD(); // list of ideal … … 1635 1635 for(i=rl1;i>=0;i) 1636 1636 { 1637 q[i]=n lInit((*p)[i], currRing);1637 q[i]=n_Init((*p)[i], currRing>cf); 1638 1638 } 1639 1639 } … … 1644 1644 if (pl>m[i].Typ()==INT_CMD) 1645 1645 { 1646 q[i]=n lInit((int)(long)pl>m[i].Data(),currRing);1646 q[i]=n_Init((int)(long)pl>m[i].Data(),currRing>cf); 1647 1647 } 1648 1648 else if (pl>m[i].Typ()==BIGINT_CMD) 1649 1649 { 1650 q[i]=n lCopy((number)(pl>m[i].Data()));1650 q[i]=n_Copy((number)(pl>m[i].Data()),coeffs_BIGINT); 1651 1651 } 1652 1652 else … … 1655 1655 for(i++;i<rl;i++) 1656 1656 { 1657 n lDelete(&(q[i]),currRing);1657 n_Delete(&(q[i]),currRing>cf); 1658 1658 } 1659 1659 omFree(x); // delete c … … 1663 1663 } 1664 1664 } 1665 result=id ChineseRemainder(x,q,rl);1665 result=id_ChineseRemainder(x,q,rl,currRing); 1666 1666 for(i=rl1;i>=0;i) 1667 1667 { 1668 n lDelete(&(q[i]),currRing);1668 n_Delete(&(q[i]),coeffs_BIGINT); 1669 1669 } 1670 1670 omFree(q); … … 1680 1680 poly p=(poly)v>Data(); 1681 1681 if ((p==NULL)(pNext(p)!=NULL)) return TRUE; 1682 res>data=(char *)mp CoeffProc((poly)u>Data(),p /*(poly)v>Data()*/);1682 res>data=(char *)mp_CoeffProc((poly)u>Data(),p /*(poly)v>Data()*/,currRing); 1683 1683 return FALSE; 1684 1684 } … … 1691 1691 return TRUE; 1692 1692 } 1693 res>data=(char *)mp Coeffs((ideal)u>CopyD(),i);1693 res>data=(char *)mp_Coeffs((ideal)u>CopyD(),i,currRing); 1694 1694 return FALSE; 1695 1695 } … … 1715 1715 static BOOLEAN jjDEG_M_IV(leftv res, leftv u, leftv v) 1716 1716 { 1717 short *iv=iv2array((intvec *)v>Data() );1717 short *iv=iv2array((intvec *)v>Data(),currRing); 1718 1718 ideal I=(ideal)u>Data(); 1719 1719 int d=1; … … 1729 1729 if (p!=NULL) 1730 1730 { 1731 short *iv=iv2array((intvec *)v>Data() );1731 short *iv=iv2array((intvec *)v>Data(),currRing); 1732 1732 int d=(int)pDegW(p,iv); 1733 1733 omFreeSize((ADDRESS)iv,(currRing>N+1)*sizeof(short)); … … 1773 1773 ring origR = currRing; 1774 1774 ring tempR = rCopy(origR); 1775 tempR>ringtype = 0; tempR>ch = 0; 1775 coeffs new_cf=nInitChar(n_Q,NULL); 1776 nKillChar(tempR>cf); 1777 tempR>cf=new_cf; 1776 1778 rComplete(tempR); 1777 1779 ideal vid = (ideal)v>Data(); 1778 1780 int i = idPosConstant(vid); 1779 if ((i != 1) && (n IsUnit(pGetCoeff(vid>m[i]))))1781 if ((i != 1) && (n_IsUnit(pGetCoeff(vid>m[i]),currRing>cf))) 1780 1782 { /* ideal v contains unit; dim = 1 */ 1781 1783 res>data = (char *)1; … … 1912 1914 { 1913 1915 poly r,pa,pb; 1914 BOOLEAN ret=singclap_extgcd((poly)u>Data(),(poly)v>Data(),r,pa,pb );1916 BOOLEAN ret=singclap_extgcd((poly)u>Data(),(poly)v>Data(),r,pa,pb,currRing); 1915 1917 if (ret) return TRUE; 1916 1918 lists L=(lists)omAllocBin(slists_bin); … … 1933 1935 if ((sw<0)(sw>2)) fac_sw=1; 1934 1936 singclap_factorize_retry=0; 1935 ideal f=singclap_factorize((poly)(u>CopyD()), &v, fac_sw );1937 ideal f=singclap_factorize((poly)(u>CopyD()), &v, fac_sw,currRing); 1936 1938 if (f==NULL) 1937 1939 return TRUE; … … 1998 2000 static BOOLEAN jjFAREY_BI(leftv res, leftv u, leftv v) 1999 2001 { 2000 if (rField_is_Q( ))2002 if (rField_is_Q(currRing)) 2001 2003 { 2002 2004 number uu=(number)u>Data(); 2003 2005 number vv=(number)v>Data(); 2004 res>data=(char *)n lFarey(uu,vv);2006 res>data=(char *)n_Farey(uu,vv,currRing>cf); 2005 2007 return FALSE; 2006 2008 } … … 2009 2011 static BOOLEAN jjFAREY_ID(leftv res, leftv u, leftv v) 2010 2012 { 2011 if (rField_is_Q( ))2013 if (rField_is_Q(currRing)) 2012 2014 { 2013 2015 ideal uu=(ideal)u>Data(); 2014 2016 number vv=(number)v>Data(); 2015 res>data=(void*)id Farey(uu,vv);2017 res>data=(void*)id_Farey(uu,vv,currRing); 2016 2018 res>rtyp=u>Typ(); 2017 2019 return FALSE; … … 2033 2035 BOOLEAN bo; 2034 2036 //if (!nSetMap(rInternalChar(r),r>parameter,rPar(r),r>minpoly)) 2035 if ((nMap=nSetMap(r))==NULL) 2036 { 2037 if (rEqual(r,currRing)) 2038 { 2039 nMap=nCopy; 2040 } 2041 else 2037 if ((nMap=n_SetMap(r>cf,currRing>cf))==NULL) 2038 { 2042 2039 // Allow imap/fetch to be make an exception only for: 2043 2040 if ( (rField_is_Q_a(r) && // Q(a..) > Q(a..)  Q  Zp  Zp(a) 2044 (rField_is_Q( )  rField_is_Q_a() 2045 (rField_is_Zp( )  rField_is_Zp_a())))2041 (rField_is_Q(currRing)  rField_is_Q_a(currRing)  2042 (rField_is_Zp(currRing)  rField_is_Zp_a(currRing)))) 2046 2043  2047 2044 (rField_is_Zp_a(r) && // Zp(a..) > Zp(a..)  Zp 2048 (rField_is_Zp(currRing, r InternalChar(r)) 2049 rField_is_Zp_a(currRing, r InternalChar(r)))) )2045 (rField_is_Zp(currRing, r>cf>ch)  2046 rField_is_Zp_a(currRing, r>cf>ch))) ) 2050 2047 { 2051 2048 par_perm_size=rPar(r); 2052 BITSET save_test=test;2053 if ((r>minpoly != NULL)  (r>minideal != NULL))2054 naSetChar(rInternalChar(r),r);2055 else naSetChar(rInternalChar(r),r);2056 nSetChar(currRing);2057 test=save_test;2058 2049 } 2059 2050 else … … 2070 2061 if (iiOp==IMAP_CMD) 2071 2062 { 2072 maFindPerm(r>names, r>N, rParameter(r), r>P, 2073 currRing>names,currRing>N,rParameter(currRing), currRing>P, 2074 perm,par_perm, currRing>ch); 2063 int r_par=0; 2064 char ** r_par_names=NULL; 2065 if (r>cf>extRing!=NULL) 2066 { 2067 r_par=r>cf>extRing>N; 2068 r_par_names=r>cf>extRing>names; 2069 } 2070 int c_par=0; 2071 char ** c_par_names=NULL; 2072 if (currRing>cf>extRing!=NULL) 2073 { 2074 c_par=currRing>cf>extRing>N; 2075 c_par_names=currRing>cf>extRing>names; 2076 } 2077 maFindPerm(r>names, r>N, r_par_names, r_par, 2078 currRing>names,currRing>N,c_par_names, c_par, 2079 perm,par_perm, currRing>cf>type); 2075 2080 } 2076 2081 else … … 2160 2165 number a=(number) u>Data(); 2161 2166 number b=(number) v>Data(); 2162 if (n lIsZero(a))2163 { 2164 if (n lIsZero(b)) res>data=(char *)nlInit(1, NULL);2165 else res>data=(char *)nlCopy(b);2167 if (n_IsZero(a,coeffs_BIGINT)) 2168 { 2169 if (n_IsZero(b,coeffs_BIGINT)) res>data=(char *)n_Init(1,coeffs_BIGINT); 2170 else res>data=(char *)n_Copy(b,coeffs_BIGINT); 2166 2171 } 2167 2172 else 2168 2173 { 2169 if (n lIsZero(b)) res>data=(char *)nlCopy(a);2170 else res>data=(char *)n lGcd(a, b, NULL);2174 if (n_IsZero(b,coeffs_BIGINT)) res>data=(char *)n_Copy(a,coeffs_BIGINT); 2175 else res>data=(char *)n_Gcd(a, b, coeffs_BIGINT); 2171 2176 } 2172 2177 return FALSE; … … 2192 2197 { 2193 2198 res>data=(void *)singclap_gcd((poly)(u>CopyD(POLY_CMD)), 2194 (poly)(v>CopyD(POLY_CMD)) );2199 (poly)(v>CopyD(POLY_CMD)),currRing); 2195 2200 return FALSE; 2196 2201 } … … 2203 2208 ring origR = currRing; 2204 2209 ring tempR = rCopy(origR); 2205 tempR>ringtype = 0; tempR>ch = 0; 2210 coeffs new_cf=nInitChar(n_Q,NULL); 2211 nKillChar(tempR>cf); 2212 tempR>cf=new_cf; 2206 2213 rComplete(tempR); 2207 2214 ideal uid = (ideal)u>Data(); … … 2285 2292 deg=p_Totaldegree; 2286 2293 else 2287 deg= pFDeg;2294 deg=currRing>pFDeg; 2288 2295 poly p=pOne(); pSetExp(p,i,1); pSetm(p); 2289 2296 int d=deg(p,currRing); … … 2300 2307 intvec *vw=(intvec*)u>Data(); 2301 2308 ideal v_id=(ideal)v>Data(); 2302 pFDegProc save_FDeg= pFDeg;2303 pLDegProc save_LDeg= pLDeg;2309 pFDegProc save_FDeg=currRing>pFDeg; 2310 pLDegProc save_LDeg=currRing>pLDeg; 2304 2311 BOOLEAN save_pLexOrder=pLexOrder; 2305 2312 pLexOrder=FALSE; 2306 2313 kHomW=vw; 2307 2314 kModW=w; 2308 pSetDegProcs( kHomModDeg);2315 pSetDegProcs(currRing,kHomModDeg); 2309 2316 res>data=(void *)(long)idHomModule(v_id,currQuotient,&w); 2310 2317 pLexOrder=save_pLexOrder; 2311 2318 kHomW=NULL; 2312 2319 kModW=NULL; 2313 pRestoreDegProcs( save_FDeg,save_LDeg);2320 pRestoreDegProcs(currRing,save_FDeg,save_LDeg); 2314 2321 if (w!=NULL) delete w; 2315 2322 return FALSE; … … 2361 2368 static BOOLEAN jjKoszul(leftv res, leftv u, leftv v) 2362 2369 { 2363 return mpKoszul(res, u,v );2370 return mpKoszul(res, u,v,NULL); 2364 2371 } 2365 2372 static BOOLEAN jjKoszul_Id(leftv res, leftv u, leftv v) … … 2457 2464 { 2458 2465 number q=(number)v>Data(); 2459 if (n lIsZero(q))2466 if (n_IsZero(q,coeffs_BIGINT)) 2460 2467 { 2461 2468 WerrorS(ii_div_by_0); 2462 2469 return TRUE; 2463 2470 } 2464 res>data =(char *) n lIntMod((number)u>Data(),q);2471 res>data =(char *) n_IntMod((number)u>Data(),q,coeffs_BIGINT); 2465 2472 return FALSE; 2466 2473 } … … 2473 2480 return TRUE; 2474 2481 } 2475 res>data =(char *) n IntMod((number)u>Data(),q);2482 res>data =(char *) n_IntMod((number)u>Data(),q,currRing>cf); 2476 2483 return FALSE; 2477 2484 } … … 2581 2588 if (iiOp==NCALGEBRA_CMD) 2582 2589 { 2583 return nc_CallPlural(NULL,NULL,(poly)a>Data(),(poly)b>Data(),currRing );2590 return nc_CallPlural(NULL,NULL,(poly)a>Data(),(poly)b>Data(),currRing,false,true,false,currRing); 2584 2591 } 2585 2592 else 2586 2593 { 2587 2594 ring r=rCopy(currRing); 2588 BOOLEAN result=nc_CallPlural(NULL,NULL,(poly)a>Data(),(poly)b>Data(),r );2595 BOOLEAN result=nc_CallPlural(NULL,NULL,(poly)a>Data(),(poly)b>Data(),r,false,true,false,currRing); 2589 2596 res>data=r; 2590 2597 if (r>qideal!=NULL) res>rtyp=QRING_CMD; … … 2602 2609 if (iiOp==NCALGEBRA_CMD) 2603 2610 { 2604 return nc_CallPlural(NULL,(matrix)b>Data(),(poly)a>Data(),NULL,currRing );2611 return nc_CallPlural(NULL,(matrix)b>Data(),(poly)a>Data(),NULL,currRing,false,true,false,currRing); 2605 2612 } 2606 2613 else 2607 2614 { 2608 2615 ring r=rCopy(currRing); 2609 BOOLEAN result=nc_CallPlural(NULL,(matrix)b>Data(),(poly)a>Data(),NULL,r );2616 BOOLEAN result=nc_CallPlural(NULL,(matrix)b>Data(),(poly)a>Data(),NULL,r,false,true,false,currRing); 2610 2617 res>data=r; 2611 2618 if (r>qideal!=NULL) res>rtyp=QRING_CMD; … … 2623 2630 if (iiOp==NCALGEBRA_CMD) 2624 2631 { 2625 return nc_CallPlural((matrix)a>Data(),NULL,NULL,(poly)b>Data(),currRing );2632 return nc_CallPlural((matrix)a>Data(),NULL,NULL,(poly)b>Data(),currRing,false,true,false,currRing); 2626 2633 } 2627 2634 else 2628 2635 { 2629 2636 ring r=rCopy(currRing); 2630 BOOLEAN result=nc_CallPlural((matrix)a>Data(),NULL,NULL,(poly)b>Data(),r );2637 BOOLEAN result=nc_CallPlural((matrix)a>Data(),NULL,NULL,(poly)b>Data(),r,false,true,false,currRing); 2631 2638 res>data=r; 2632 2639 if (r>qideal!=NULL) res>rtyp=QRING_CMD; … … 2644 2651 if (iiOp==NCALGEBRA_CMD) 2645 2652 { 2646 return nc_CallPlural((matrix)a>Data(),(matrix)b>Data(),NULL,NULL,currRing );2653 return nc_CallPlural((matrix)a>Data(),(matrix)b>Data(),NULL,NULL,currRing,false,true,false,currRing); 2647 2654 } 2648 2655 else 2649 2656 { 2650 2657 ring r=rCopy(currRing); 2651 BOOLEAN result=nc_CallPlural((matrix)a>Data(),(matrix)b>Data(),NULL,NULL,r );2658 BOOLEAN result=nc_CallPlural((matrix)a>Data(),(matrix)b>Data(),NULL,NULL,r,false,true,false,currRing); 2652 2659 res>data=r; 2653 2660 if (r>qideal!=NULL) res>rtyp=QRING_CMD; … … 2706 2713 { 2707 2714 poly q = (poly)IDDATA(w); 2708 res>data = pOppose(r,q );2715 res>data = pOppose(r,q,currRing); 2709 2716 res>rtyp = argtype; 2710 2717 break; … … 2714 2721 { 2715 2722 ideal Q = (ideal)IDDATA(w); 2716 res>data = idOppose(r,Q );2723 res>data = idOppose(r,Q,currRing); 2717 2724 res>rtyp = argtype; 2718 2725 break; … … 2723 2730 rChangeCurrRing(r); 2724 2731 matrix m = (matrix)IDDATA(w); 2725 ideal Q = idMatrix2Module(mp Copy(m));2732 ideal Q = idMatrix2Module(mp_Copy(m,currRing)); 2726 2733 rChangeCurrRing(save); 2727 ideal S = idOppose(r,Q );2734 ideal S = idOppose(r,Q,currRing); 2728 2735 id_Delete(&Q, r); 2729 2736 res>data = idModule2Matrix(S); … … 3047 3054 3048 3055 if ((u>Typ() == BIGINT_CMD)  3049 ((u>Typ() == NUMBER_CMD) && rField_is_Q( )))3056 ((u>Typ() == NUMBER_CMD) && rField_is_Q(currRing))) 3050 3057 { 3051 3058 temp = (number)u>Data(); 3052 n1 = n lCopy(temp);3059 n1 = n_Copy(temp,coeffs_BIGINT); 3053 3060 } 3054 3061 else if (u>Typ() == INT_CMD) 3055 3062 { 3056 3063 i = (int)(long)u>Data(); 3057 n1 = n lInit(i, NULL);3064 n1 = n_Init(i, coeffs_BIGINT); 3058 3065 } 3059 3066 else … … 3064 3071 3065 3072 if ((v>Typ() == BIGINT_CMD)  3066 ((v>Typ() == NUMBER_CMD) && rField_is_Q( )))3073 ((v>Typ() == NUMBER_CMD) && rField_is_Q(currRing))) 3067 3074 { 3068 3075 temp = (number)v>Data(); 3069 n2 = n lCopy(temp);3076 n2 = n_Copy(temp,coeffs_BIGINT); 3070 3077 } 3071 3078 else if (v>Typ() == INT_CMD) 3072 3079 { 3073 3080 i = (int)(long)v>Data(); 3074 n2 = n lInit(i, NULL);3081 n2 = n_Init(i, coeffs_BIGINT); 3075 3082 } 3076 3083 else … … 3081 3088 3082 3089 lists l = primeFactorisation(n1, n2); 3083 n lDelete(&n1, NULL); nlDelete(&n2, NULL);3090 n_Delete(&n1, coeffs_BIGINT); n_Delete(&n2, coeffs_BIGINT); 3084 3091 res>data = (char*)l; 3085 3092 return FALSE; … … 3361 3368 static BOOLEAN jjWEDGE(leftv res, leftv u, leftv v) 3362 3369 { 3363 res>data = (char *)mp Wedge((matrix)u>Data(),(int)(long)v>Data());3370 res>data = (char *)mp_Wedge((matrix)u>Data(),(int)(long)v>Data(),currRing); 3364 3371 return FALSE; 3365 3372 } … … 3409 3416 { 3410 3417 number n=(number)u>CopyD(BIGINT_CMD); 3411 n=n lNeg(n);3418 n=n_Neg(n,coeffs_BIGINT); 3412 3419 res>data = (char *)n; 3413 3420 return FALSE; … … 3433 3440 { 3434 3441 poly m1=pISet(1); 3435 res>data = (char *)mp MultP((matrix)u>CopyD(MATRIX_CMD),m1);3442 res>data = (char *)mp_MultP((matrix)u>CopyD(MATRIX_CMD),m1,currRing); 3436 3443 return FALSE; 3437 3444 } … … 3472 3479 static BOOLEAN jjBI2N(leftv res, leftv u) 3473 3480 { 3474 if (rField_is_Q())3475 {3476 res>data=u>CopyD();3477 return FALSE;3478 }3481 BOOLEAN bo=FALSE; 3482 number n=(number)u>CopyD(); 3483 nMapFunc nMap=n_SetMap(coeffs_BIGINT,currRing>cf); 3484 if (nMap!=NULL) 3485 res>data=nMap(n,coeffs_BIGINT,currRing>cf); 3479 3486 else 3480 3487 { 3481 BOOLEAN bo=FALSE; 3482 number n=(number)u>CopyD(); 3483 if (rField_is_Zp()) 3484 { 3485 res>data=(void *)npMap0(n); 3486 } 3487 else if (rField_is_Q_a()) 3488 { 3489 res>data=(void *)naMap00(n); 3490 } 3491 else if (rField_is_Zp_a()) 3492 { 3493 res>data=(void *)naMap0P(n); 3494 } 3495 #ifdef HAVE_RINGS 3496 else if (rField_is_Ring_Z()) 3497 { 3498 res>data=(void *)nrzMapQ(n); 3499 } 3500 else if (rField_is_Ring_ModN()) 3501 { 3502 res>data=(void *)nrnMapQ(n); 3503 } 3504 else if (rField_is_Ring_PtoM()) 3505 { 3506 res>data=(void *)nrnMapQ(n); 3507 } 3508 else if (rField_is_Ring_2toM()) 3509 { 3510 res>data=(void *)nr2mMapQ(n); 3511 } 3512 #endif 3513 else 3514 { 3515 WerrorS("cannot convert bigint to this field"); 3516 bo=TRUE; 3517 } 3518 nlDelete(&n,NULL); 3519 return bo; 3520 } 3488 WerrorS("cannot convert bigint to this field"); 3489 bo=TRUE; 3490 } 3491 n_Delete(&n,coeffs_BIGINT); 3492 return bo; 3521 3493 } 3522 3494 static BOOLEAN jjBI2P(leftv res, leftv u) … … 3564 3536 static BOOLEAN jjCOUNT_BI(leftv res, leftv v) 3565 3537 { 3566 res>data = (char *)(long)n lSize((number)v>Data());3538 res>data = (char *)(long)n_Size((number)v>Data(),coeffs_BIGINT); 3567 3539 return FALSE; 3568 3540 } … … 3593 3565 ring r=(ring)v>Data(); 3594 3566 int elems=1; 3595 if (rField_is_Zp(r)rField_is_GF(r)) elems=r InternalChar(r);3567 if (rField_is_Zp(r)rField_is_GF(r)) elems=r>cf>ch; 3596 3568 else if (rField_is_Zp_a(r) && (r>minpoly!=NULL)) 3597 3569 { 3598 3570 #ifdef HAVE_FACTORY 3599 3571 extern int ipower ( int b, int n ); /* factory/cf_util */ 3600 elems=ipower( ABS(rInternalChar(r)),naParDeg(r>minpoly));3572 elems=ipower(r>cf>ch,naParDeg(r>minpoly)); 3601 3573 #else 3602 elems=(int)pow( ABS((double) rInternalChar(r)),(double)naParDeg(r>minpoly));3574 elems=(int)pow((double) r>cf>ch,(double)naParDeg(r>minpoly)); 3603 3575 #endif 3604 3576 } … … 3678 3650 if (smCheckDet((ideal)m,m>cols(),TRUE)) 3679 3651 { 3680 ideal I=idMatrix2Module(mp Copy(m));3652 ideal I=idMatrix2Module(mp_Copy(m,currRing)); 3681 3653 p=smCallDet(I); 3682 3654 idDelete(&I); … … 4211 4183 if ((long)i == d) 4212 4184 { 4213 return n lInit(i, NULL);4185 return n_Init(i, coeffs_BIGINT); 4214 4186 } 4215 4187 else … … 4228 4200 } 4229 4201 #else 4230 #define jjLONG2N(D) n lInit((int)D, NULL)4202 #define jjLONG2N(D) n_Init((int)D, coeffs_BIGINT) 4231 4203 #endif 4232 4204 static BOOLEAN jjPFAC1(leftv res, leftv v) … … 4334 4306 { 4335 4307 number n,i; i=(number)v>Data(); 4336 if (rField_is_Zp( ))4337 { 4338 n=n lInit(npInt(i,currRing),NULL);4339 } 4340 else if (rField_is_Q( )) n=nlBigInt(i);4308 if (rField_is_Zp(currRing)) 4309 { 4310 n=n_Init(n_Int(i,currRing>cf),coeffs_BIGINT); 4311 } 4312 else if (rField_is_Q(currRing)) n=nlBigInt(i); 4341 4313 #ifdef HAVE_RINGS 4342 else if (rField_is_Ring_Z( )  rField_is_Ring_ModN()  rField_is_Ring_PtoM()) n=nlMapGMP(i);4343 else if (rField_is_Ring_2toM( )) n=nlInit((unsigned long) i,NULL);4314 else if (rField_is_Ring_Z(currRing)  rField_is_Ring_ModN(currRing)  rField_is_Ring_PtoM(currRing)) n=nlMapGMP(i); 4315 else if (rField_is_Ring_2toM(currRing)) n=n_Init((unsigned long) i,coeffs_BIGINT); 4344 4316 #endif 4345 4317 else goto err; … … 4420 4392 { 4421 4393 poly p=(poly)v>Data(); 4422 if (p==NULL) { res>data=(char *)n lInit(0,NULL); return FALSE; }4394 if (p==NULL) { res>data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; } 4423 4395 if ((pNext(p)!=NULL) (!pIsConstant(p))) 4424 4396 { … … 4430 4402 if (rField_is_Zp()) 4431 4403 { 4432 n=n lInit(npInt(i,currRing), NULL);4433 } 4434 else if (rField_is_Q( )) n=nlBigInt(i);4404 n=n_Init(npInt(i,currRing), coeffs_BIGINT); 4405 } 4406 else if (rField_is_Q(currRing)) n=nlBigInt(i); 4435 4407 #ifdef HAVE_RINGS 4436 4408 else if (rField_is_Ring_Z()  rField_is_Ring_ModN()  rField_is_Ring_PtoM()) 4437 4409 n=nlMapGMP(i); 4438 4410 else if (rField_is_Ring_2toM()) 4439 n=n lInit((unsigned long) i, NULL);4411 n=n_Init((unsigned long) i, coeffs_BIGINT); 4440 4412 #endif 4441 4413 else goto err; … … 5143 5115 { 5144 5116 number n=(number)u>Data(); 5145 res>data=(char *)(long)n lInt(n,NULL /*dummy for nlInt*/);5117 res>data=(char *)(long)n_Int(n,coeffs_BIGINT ); 5146 5118 return FALSE; 5147 5119 } … … 5636 5608 return TRUE; 5637 5609 } 5638 res>data = (char *)p Series((int)(long)w>Data(),(poly)u>CopyD(),(poly)v>CopyD());5610 res>data = (char *)p_Series((int)(long)w>Data(),(poly)u>CopyD(),(poly)v>CopyD(),NULL,currRing); 5639 5611 return FALSE; 5640 5612 } … … 6481 6453 { 6482 6454 number b=(number)h>Data(); 6483 number n=n Init_bigint(b);6455 number n=n_Init_bigint(b,coeffs_BIGINT,currRing>cf); 6484 6456 if (!nIsZero(n)) 6485 6457 { … … 6820 6792 res>rtyp=u1>Typ(); 6821 6793 res>data=(char*)idSeries((int)(long)u3>Data(),idCopy((ideal)u1>Data()), 6822 mp Copy((matrix)u2>Data()),(intvec*)u4>Data());6794 mp_Copy((matrix)u2>Data()),(intvec*)u4>Data(),currRing); 6823 6795 return FALSE; 6824 6796 } … … 6950 6922 res>rtyp=IDEAL_CMD; 6951 6923 res>data=(char*)redNF(idCopy((ideal)u3>Data()),idCopy((ideal)u1>Data()), 6952 mp Copy((matrix)u2>Data()),(int)(long)u4>Data());6924 mp_Copy((matrix)u2>Data()),(int)(long)u4>Data(),currRing); 6953 6925 return FALSE; 6954 6926 } … … 6992 6964 res>rtyp=IDEAL_CMD; 6993 6965 res>data=(char*)redNF(idCopy((ideal)u3>Data()),idCopy((ideal)u1>Data()), 6994 mp Copy((matrix)u2>Data()),6995 (int)(long)u4>Data(),(intvec*)u5>Data() );6966 mp_Copy((matrix)u2>Data()), 6967 (int)(long)u4>Data(),(intvec*)u5>Data(),currRing); 6996 6968 return FALSE; 6997 6969 } 
Singular/ipshell.h
re92b07 rbf38a4 209 209 void rKill(idhdl h); 210 210 void rKill(ring r); 211 212 #endif 213 211 lists scIndIndset(ideal S, BOOLEAN all, ideal Q); 212 BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id); 213 214 #endif 215
Note: See TracChangeset
for help on using the changeset viewer.