Changeset 3b58e9 in git
- Timestamp:
- Dec 7, 2000, 1:22:42 PM (23 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 7b34aedfeac63b17a621ba2a14291c7dc1930641
- Parents:
- fb4232247333afc978e691cd03863a559e8e8f29
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/polys.h
rfb4232 r3b58e9 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys.h,v 1.4 8 2000-11-30 16:46:08Singular Exp $ */6 /* $Id: polys.h,v 1.49 2000-12-07 12:22:42 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT - all basic methods to manipulate polynomials of the … … 235 235 236 236 /*-------------predicate on polys ----------------------*/ 237 BOOLEAN pIsConstant(const poly p); 237 BOOLEAN p_IsConstant(const poly p, const ring r); 238 #define pIsConstant(p) p_IsConstant(p,currRing) 238 239 BOOLEAN pIsConstantPoly(poly p); 239 240 #define pIsPurePower(p) p_IsPurePower(p, currRing) 240 #define pIsVector(p) (pGetComp(p)!=0)241 #define pIsVector(p) (pGetComp(p)>0) 241 242 BOOLEAN pHasNotCF(poly p1, poly p2); /*has no common factor ?*/ 242 243 void pSplit(poly p, poly * r); /*p => IN(p), r => REST(p) */ -
Singular/polys1.cc
rfb4232 r3b58e9 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys1.cc,v 1.5 5 2000-11-23 17:44:07Singular Exp $ */4 /* $Id: polys1.cc,v 1.56 2000-12-07 12:22:42 Singular Exp $ */ 5 5 6 6 /* … … 32 32 *test if the monomial is a constant 33 33 */ 34 BOOLEAN p IsConstant(const poly p)34 BOOLEAN p_IsConstant(const poly p, const ring r) 35 35 { 36 36 if (p!=NULL) 37 37 { 38 38 int i; 39 for (i= pVariables;i;i--)40 { 41 if (p GetExp(p,i)!=0) return FALSE;42 } 43 if (p GetComp(p)) return FALSE;39 for (i=r->N;i;i--) 40 { 41 if (p_GetExp(p,i,r)!=0) return FALSE; 42 } 43 if (p_GetComp(p,r)>0) return FALSE; 44 44 } 45 45 return TRUE; … … 873 873 { 874 874 lnumber c=(lnumber)pGetCoeff(qq); 875 c->z->e[-perm[i]-1]+=e/*p_GetExp( p,i,oldRing)*/;875 napAddExp(c->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/); 876 876 mapped_to_par=1; 877 877 } … … 951 951 } 952 952 953 #if 0 954 /*2 955 *returns a re-ordered copy of a polynomial, with permutation of the variables 956 */ 957 poly p_PermPoly (poly p, int * perm, ring oldRing, 958 int *par_perm, int OldPar, ring newRing) 959 { 960 int OldpVariables = oldRing->N; 961 poly result = NULL; 962 poly result_last = NULL; 963 poly aq=NULL; /* the map coefficient */ 964 poly qq; /* the mapped monomial */ 965 966 while (p != NULL) 967 { 968 if (OldPar==0) 969 { 970 qq = pInit(); 971 number n=newRing->cf->nMap(pGetCoeff(p)); 972 if ((newRing->minpoly!=NULL) 973 && ((rField_is_Zp_a(newRing)) || (rField_is_Q_a(newRing)))) 974 { 975 newRing->cf->nNormalize(n); 976 } 977 pGetCoeff(qq)=n; 978 // coef may be zero: pTest(qq); 979 } 980 else 981 { 982 qq=p_ISet(1, newRing); 983 aq=naPermNumber(pGetCoeff(p),par_perm,OldPar); 984 if ((newRing->minpoly!=NULL) 985 && ((rField_is_Zp_a(newRing)) || (rField_is_Q_a(newRing)))) 986 { 987 poly tmp=aq; 988 while (tmp!=NULL) 989 { 990 number n=pGetCoeff(tmp); 991 newRing->cf->nNormalize(n); 992 pGetCoeff(tmp)=n; 993 pIter(tmp); 994 } 995 } 996 //pTest(aq); 997 } 998 p_SetComp(qq, p_GetComp(p,oldRing), newRing); 999 if (newRing->cf->nIsZero(pGetCoeff(qq))) 1000 { 1001 p_DeleteLm(&qq, newRing); 1002 } 1003 else 1004 { 1005 int i; 1006 int mapped_to_par=0; 1007 for(i=1; i<=OldpVariables; i++) 1008 { 1009 int e=p_GetExp(p,i,oldRing); 1010 if (e!=0) 1011 { 1012 if (perm==NULL) 1013 { 1014 p_SetExp(qq,i, e, newRing); 1015 } 1016 else if (perm[i]>0) 1017 p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, newRing); 1018 else if (perm[i]<0) 1019 { 1020 lnumber c=(lnumber)pGetCoeff(qq); 1021 napAddExp(c->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/); 1022 mapped_to_par=1; 1023 } 1024 else 1025 { 1026 /* this variable maps to 0 !*/ 1027 p_DeleteLm(&qq, newRing); 1028 break; 1029 } 1030 } 1031 } 1032 if (mapped_to_par 1033 && (newRing->minpoly!=NULL)) 1034 { 1035 number n=pGetCoeff(qq); 1036 newRing->cf->nNormalize(n); 1037 pGetCoeff(qq)=n; 1038 } 1039 } 1040 pIter(p); 1041 if (qq!=NULL) 1042 { 1043 p_Setm(qq, newRing); 1044 //pTest(aq); 1045 //pTest(qq); 1046 if (aq!=NULL) qq=pMult(aq,qq); 1047 aq = qq; 1048 while (pNext(aq) != NULL) pIter(aq); 1049 if (result_last==NULL) 1050 { 1051 result=qq; 1052 } 1053 else 1054 { 1055 pNext(result_last)=qq; 1056 } 1057 result_last=aq; 1058 aq = NULL; 1059 } 1060 else if (aq!=NULL) 1061 { 1062 p_Delete(&aq, newRing); 1063 } 1064 } 1065 result=pOrdPolyMerge(result); 1066 //pTest(result); 1067 return result; 1068 } 1069 #endif 1070 953 1071 poly pJet(poly p, int m) 954 1072 {
Note: See TracChangeset
for help on using the changeset viewer.