Changeset d609e1 in git
- Timestamp:
- Feb 8, 2001, 2:13:06 PM (23 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- cd9bd11338310a68a7f540822564453a1bdc9889
- Parents:
- 4cbe5ddf85f8cae8cfd990f0d4cde7d588643de9
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.15 7 2001-02-02 14:40:13Singular Exp $ */4 /* $Id: extra.cc,v 1.158 2001-02-08 13:12:58 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 98 98 #endif 99 99 #endif /* not HAVE_DYNAMIC_LOADING */ 100 101 // procedures to compute with units102 #ifdef HAVE_UNITS103 #include "units.h"104 #endif105 100 106 101 // see clapsing.cc for a description of the `FACTORY_*' options … … 1162 1157 } 1163 1158 else 1164 #ifdef HAVE_UNITS1165 /*==================== units ==================================*/1166 if(strcmp(sys_cmd,"invunit")==0)1167 {1168 return invunit(res,h);1169 }1170 else1171 if(strcmp(sys_cmd,"series")==0)1172 {1173 return series(res,h);1174 }1175 else1176 if(strcmp(sys_cmd,"rednf")==0)1177 {1178 return rednf(res,h);1179 }1180 else1181 #endif1182 1159 #ifdef HAVE_PLURAL 1183 1160 /*==================== PLURAL =================*/ -
Singular/ideals.cc
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ideals.cc,v 1.12 0 2001-01-30 08:55:47 pohlExp $ */4 /* $Id: ideals.cc,v 1.121 2001-02-08 13:12:59 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - all basic methods to manipulate ideals … … 1982 1982 1983 1983 ideal s_h4 = idInitializeQuot (h1,h2,h1IsStb,&addOnlyOne,&kmax); 1984 1984 1985 1985 hom = (tHomog)idHomModule(s_h4,currQuotient,&weights1); 1986 1986 … … 2286 2286 for (j=0;j<pVariables;j++) 2287 2287 if (pGetExp(delVar,j+1)!=0) wv[0][j]=1; 2288 // use this special ordering: like ringorder_a, except that pFDeg, pWeights 2288 // use this special ordering: like ringorder_a, except that pFDeg, pWeights 2289 2289 // ignore it 2290 2290 ord[0] = ringorder_aa; … … 2465 2465 } 2466 2466 #endif 2467 2468 /*22469 *returns TRUE if p is a unit element in the current ring2470 */2471 BOOLEAN pIsUnit(poly p)2472 {2473 int i;2474 2475 if (p == NULL) return FALSE;2476 i = 1;2477 while (i<=pVariables && pGetExp(p,i) == 0) i++;2478 if (i > pVariables && (pGetComp(p) == 0))2479 {2480 if (currRing->OrdSgn == 1 && pNext(p) !=NULL) return FALSE;2481 return TRUE;2482 }2483 return FALSE;2484 }2485 2467 2486 2468 /*2 … … 2672 2654 sBucketClearMerge(bucket, &(result->m[j]), &l); 2673 2655 } 2674 2656 2675 2657 // obachman: need to clean this up 2676 2658 idDelete((ideal*) &mat); … … 2898 2880 for(k=(i->nrows)*(i->ncols)-1;k>=0; k--) 2899 2881 { 2900 r->m[k]=p Jet(i->m[k],d);2882 r->m[k]=ppJet(i->m[k],d); 2901 2883 } 2902 2884 return r; … … 2916 2898 for(k=0; k<IDELEMS(i); k++) 2917 2899 { 2918 r->m[k]=p JetW(i->m[k],d,w);2900 r->m[k]=ppJetW(i->m[k],d,w); 2919 2901 } 2920 2902 omFreeSize((ADDRESS)w,(pVariables+1)*sizeof(short)); 2921 2903 } 2922 2904 return r; 2905 } 2906 2907 ideal idSeries(int n,ideal M,matrix U=NULL) 2908 { 2909 for(int i=IDELEMS(M)-1;i>=0;i--) 2910 { 2911 if(U==NULL) 2912 M->m[i]=pSeries(n,M->m[i]); 2913 else 2914 { 2915 M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1)); 2916 MATELEM(U,i+1,i+1)=NULL; 2917 } 2918 } 2919 if(U!=NULL) 2920 idDelete((ideal*)&U); 2921 return M; 2923 2922 } 2924 2923 … … 3432 3431 } 3433 3432 3433 BOOLEAN idIsZeroDim(ideal I) 3434 { 3435 BOOLEAN *UsedAxis=(BOOLEAN *)omAlloc0(pVariables*sizeof(BOOLEAN)); 3436 int i,n; 3437 poly po; 3438 BOOLEAN res=TRUE; 3439 for(i=IDELEMS(I)-1;i>=0;i--) 3440 { 3441 po=I->m[i]; 3442 if ((po!=NULL) &&((n=pIsPurePower(po))!=0)) UsedAxis[n-1]=TRUE; 3443 } 3444 for(i=pVariables-1;i>=0;i--) 3445 { 3446 if(UsedAxis[i]==FALSE) {res=FALSE; break;} // not zero-dim. 3447 } 3448 omFreeSize(UsedAxis,pVariables*sizeof(BOOLEAN)); 3449 return res; 3450 } -
Singular/ideals.h
r4cbe5d rd609e1 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: ideals.h,v 1.3 0 2000-11-08 15:34:56 obachmanExp $ */6 /* $Id: ideals.h,v 1.31 2001-02-08 13:13:00 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT - all basic methods to manipulate ideals … … 129 129 ideal idJet(ideal i,int d); 130 130 ideal idJetW(ideal i,int d, intvec * iv); 131 ideal idSeries(int n,ideal M,matrix U=NULL); 131 132 133 BOOLEAN idIsZeroDim(ideal i); 132 134 matrix idDiff(matrix i, int k); 133 135 matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE); -
Singular/iparith.cc
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iparith.cc,v 1.25 3 2001-02-06 13:16:20Singular Exp $ */4 /* $Id: iparith.cc,v 1.254 2001-02-08 13:13:01 Singular Exp $ */ 5 5 6 6 /* … … 44 44 #include "sparsmat.h" 45 45 #include "algmap.h" 46 #include "units.h" 46 47 #ifdef HAVE_FACTORY 47 48 #include "clapsing.h" … … 1805 1806 static BOOLEAN jjJET_P(leftv res, leftv u, leftv v) 1806 1807 { 1807 res->data = (char *)pJet((poly)u-> Data(),(int)v->Data());1808 res->data = (char *)pJet((poly)u->CopyD(), (int)v->Data()); 1808 1809 return FALSE; 1809 1810 } … … 4154 4155 { 4155 4156 short *iw=iv2array((intvec *)w->Data()); 4156 res->data = (char *)p JetW((poly)u->Data(),(int)v->Data(),iw);4157 res->data = (char *)ppJetW((poly)u->Data(),(int)v->Data(),iw); 4157 4158 omFreeSize((ADDRESS)iw,(pVariables+1)*sizeof(short)); 4159 return FALSE; 4160 } 4161 static BOOLEAN jjJET_P_P(leftv res, leftv u, leftv v, leftv w) 4162 { 4163 poly ww=(poly)w->Data(); 4164 if (!pIsUnit(ww)) 4165 { 4166 WerrorS("3rd argument must be a unit"); 4167 return TRUE; 4168 } 4169 res->data = (char *)pSeries((int)v->Data(),(poly)u->CopyD(),(poly)w->CopyD()); 4158 4170 return FALSE; 4159 4171 } … … 4162 4174 res->data = (char *)idJetW((ideal)u->Data(),(int)v->Data(), 4163 4175 (intvec *)w->Data()); 4176 return FALSE; 4177 } 4178 static BOOLEAN jjJET_ID_M(leftv res, leftv u, leftv v, leftv w) 4179 { 4180 matrix ww=(matrix)w->Data(); 4181 if (!mpIsDiagUnit(ww)) 4182 { 4183 WerrorS("3rd argument must be a diagonal matrix of units"); 4184 return TRUE; 4185 } 4186 res->data = (char *)idSeries((int)v->Data(),(ideal)u->CopyD(), 4187 (matrix)w->CopyD()); 4164 4188 return FALSE; 4165 4189 } … … 4400 4424 res->data = (char *)idModule2formatedMatrix(m,ul,vl); 4401 4425 test=save_test; 4426 return FALSE; 4427 } 4428 static BOOLEAN jjREDUCE3_CP(leftv res, leftv u, leftv v, leftv w) 4429 { 4430 assumeStdFlag(v); 4431 if (!idIsZeroDim((ideal)v->Data())) 4432 { 4433 Werror("`%s` must be 0-dimensional",v->Name()); 4434 return TRUE; 4435 } 4436 res->data = (char *)rednf((ideal)v->CopyD(),(poly)u->CopyD(), 4437 (poly)w->CopyD()); 4438 return FALSE; 4439 } 4440 static BOOLEAN jjREDUCE3_CID(leftv res, leftv u, leftv v, leftv w) 4441 { 4442 assumeStdFlag(v); 4443 if (!idIsZeroDim((ideal)v->Data())) 4444 { 4445 Werror("`%s` must be 0-dimensional",v->Name()); 4446 return TRUE; 4447 } 4448 res->data = (char *)rednf((ideal)v->CopyD(),(ideal)u->CopyD(), 4449 (matrix)w->CopyD()); 4402 4450 return FALSE; 4403 4451 } … … 4521 4569 ,{jjJET_P_IV, JET_CMD, VECTOR_CMD, VECTOR_CMD, INT_CMD, INTVEC_CMD } 4522 4570 ,{jjJET_ID_IV, JET_CMD, MODUL_CMD, MODUL_CMD, INT_CMD, INTVEC_CMD } 4571 ,{jjJET_P_P, JET_CMD, POLY_CMD, POLY_CMD, INT_CMD, POLY_CMD } 4572 ,{jjJET_P_P, JET_CMD, VECTOR_CMD, VECTOR_CMD, INT_CMD, POLY_CMD } 4573 ,{jjJET_ID_M, JET_CMD, IDEAL_CMD, IDEAL_CMD, INT_CMD, MATRIX_CMD } 4574 ,{jjJET_ID_M, JET_CMD, MODUL_CMD, MODUL_CMD, INT_CMD, MATRIX_CMD } 4523 4575 ,{mpKoszul, KOSZUL_CMD, MATRIX_CMD, INT_CMD, INT_CMD, IDEAL_CMD } 4524 4576 ,{jjCALL3MANY, LIST_CMD, LIST_CMD, DEF_CMD, DEF_CMD, DEF_CMD } … … 4543 4595 ,{jjREDUCE3_ID, REDUCE_CMD, MODUL_CMD, MODUL_CMD, MODUL_CMD, INT_CMD } 4544 4596 ,{jjREDUCE3_ID, REDUCE_CMD, MODUL_CMD, MODUL_CMD, IDEAL_CMD, INT_CMD } 4597 ,{jjREDUCE3_CP, REDUCE_CMD, POLY_CMD, POLY_CMD, IDEAL_CMD, POLY_CMD } 4598 ,{jjREDUCE3_CP, REDUCE_CMD, VECTOR_CMD, VECTOR_CMD, MODUL_CMD, POLY_CMD } 4599 ,{jjREDUCE3_CID, REDUCE_CMD, IDEAL_CMD, IDEAL_CMD, IDEAL_CMD, MATRIX_CMD } 4600 ,{jjREDUCE3_CID, REDUCE_CMD, MODUL_CMD, MODUL_CMD, MODUL_CMD, MATRIX_CMD } 4545 4601 #ifdef OLD_RES 4546 4602 ,{jjRES3, RES_CMD, NONE, IDEAL_CMD, INT_CMD, ANY_TYPE } -
Singular/ipshell.cc
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ipshell.cc,v 1.6 1 2001-01-18 16:21:17Singular Exp $ */4 /* $Id: ipshell.cc,v 1.62 2001-02-08 13:13:02 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 1121 1121 poly iiHighCorner(ideal I, int ak) 1122 1122 { 1123 BOOLEAN *UsedAxis=(BOOLEAN *)omAlloc0(pVariables*sizeof(BOOLEAN)); 1124 int i,n; 1125 poly po; 1126 for(i=IDELEMS(I)-1;i>=0;i--) 1127 { 1128 po=I->m[i]; 1129 if ((po!=NULL) &&((n=pIsPurePower(po))!=0)) UsedAxis[n-1]=TRUE; 1130 } 1131 for(i=pVariables-1;i>=0;i--) 1132 { 1133 if(UsedAxis[i]==FALSE) return NULL; // not zero-dim. 1134 } 1135 po=NULL; 1123 int i; 1124 if(!idIsZeroDim(I)) return NULL; // not zero-dim. 1125 poly po=NULL; 1136 1126 if (currRing->OrdSgn== -1) 1137 1127 { -
Singular/matpol.cc
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: matpol.cc,v 1.3 8 2001-01-12 12:30:32Singular Exp $ */4 /* $Id: matpol.cc,v 1.39 2001-02-08 13:13:03 Singular Exp $ */ 5 5 6 6 /* … … 1871 1871 } 1872 1872 } 1873 1874 BOOLEAN mpIsDiagUnit(matrix U) 1875 { 1876 if(MATROWS(U)!=MATCOLS(U)) 1877 return FALSE; 1878 for(int i=MATCOLS(U);i>=1;i--) 1879 { 1880 for(int j=MATCOLS(U); j>=1; j--) 1881 { 1882 if (i==j) 1883 { 1884 if (!pIsUnit(MATELEM(U,i,i))) return FALSE; 1885 } 1886 else if (MATELEM(U,i,j)!=NULL) return FALSE; 1887 } 1888 } 1889 return TRUE; 1890 } 1891 -
Singular/matpol.h
r4cbe5d rd609e1 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: matpol.h,v 1.1 3 2000-08-14 12:56:38 obachmanExp $ */6 /* $Id: matpol.h,v 1.14 2001-02-08 13:13:03 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 69 69 void mpMinorToResult(ideal, int &, matrix, int, int, ideal); 70 70 71 BOOLEAN mpIsDiagUnit(matrix U); 72 71 73 extern omBin ip_smatrix_bin; 72 74 #endif -
Singular/pInline1.h
r4cbe5d rd609e1 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pInline1.h,v 1.1 6 2001-02-07 12:37:51Singular Exp $9 * Version: $Id: pInline1.h,v 1.17 2001-02-08 13:13:03 Singular Exp $ 10 10 *******************************************************************/ 11 11 #ifndef PINLINE1_H … … 514 514 } 515 515 516 PINLINE1 BOOLEAN p_IsUnit(const poly p, const ring r) 517 { 518 if (p == NULL) return FALSE; 519 return p_LmIsConstant(p, r); 520 } 521 516 522 PINLINE1 BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, 517 523 const ring r) -
Singular/polys.h
r4cbe5d rd609e1 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys.h,v 1.5 3 2001-02-07 12:45:14 Singular Exp $ */6 /* $Id: polys.h,v 1.54 2001-02-08 13:13:04 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT - all basic methods to manipulate polynomials of the … … 237 237 // like above, except that Comp might be != 0 238 238 #define pIsConstant(p) p_IsConstant(p,currRing) 239 // return true if the Lm is a constant <>0 240 #define pIsUnit(p) p_IsUnit(p,currRing) 239 241 // like above, except that p must be != NULL 240 242 #define pLmIsConstantComp(p) p_LmIsConstantComp(p, currRing) … … 398 400 void pNorm(poly p); 399 401 poly pSubst(poly p, int n, poly e); 402 poly ppJet(poly p, int m); 400 403 poly pJet(poly p, int m); 401 poly pJetW(poly p, int m, short * iv); 404 poly ppJetW(poly p, int m, short * iv); 405 poly pSeries(int n,poly p,poly u=NULL); 406 poly pInvers(int n, poly p); 402 407 // maximum weigthed degree of all monomials of p, w is indexed from 403 408 // 1..pVariables -
Singular/polys1.cc
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys1.cc,v 1.6 2 2001-01-09 15:40:13Singular Exp $ */4 /* $Id: polys1.cc,v 1.63 2001-02-08 13:13:04 Singular Exp $ */ 5 5 6 6 /* … … 1106 1106 #endif 1107 1107 1108 poly p Jet(poly p, int m)1108 poly ppJet(poly p, int m) 1109 1109 { 1110 1110 poly r=NULL; … … 1134 1134 } 1135 1135 1136 poly pJetW(poly p, int m, short *w) 1136 poly pJet(poly p, int m) 1137 { 1138 poly r=p; 1139 poly t=NULL; 1140 1141 while (p!=NULL) 1142 { 1143 if (pTotaldegree(p)>m) 1144 { 1145 if (p==r) 1146 { 1147 pLmDelete(&p); 1148 r=p; 1149 } 1150 else 1151 { 1152 pLmDelete(&p); 1153 } 1154 } 1155 pIter(p); 1156 } 1157 return r; 1158 } 1159 1160 poly ppJetW(poly p, int m, short *w) 1137 1161 { 1138 1162 poly r=NULL; … … 1164 1188 ecartWeights=wsave; 1165 1189 return r; 1190 } 1191 1192 poly pSeries(int n,poly p,poly u=NULL) 1193 { 1194 if(p!=NULL) 1195 { 1196 if(u==NULL) 1197 p=pJet(p,n); 1198 else 1199 p=pJet(pMult(p,pInvers(n-pTotaldegree(p),u)),n); 1200 } 1201 return p; 1202 } 1203 1204 poly pInvers(int n,poly u) 1205 { 1206 if(n<0) 1207 return NULL; 1208 number u0=nInvers(pGetCoeff(u)); 1209 poly v=pNSet(u0); 1210 if(n==0) 1211 return v; 1212 /* u0 is pGetCoeff(v) */ 1213 poly u1=pJet(pSub(pOne(),pMult_nn(u,u0)),n); 1214 if(u1==NULL) 1215 return v; 1216 poly v1=pMult_nn(pCopy(u1),u0); 1217 v=pAdd(v,pCopy(v1)); 1218 for(int i=n/pTotaldegree(u1);i>1;i--) 1219 { 1220 v1=pJet(pMult(v1,pCopy(u1)),n); 1221 v=pAdd(v,pCopy(v1)); 1222 } 1223 pDelete(&u1); 1224 pDelete(&v1); 1225 return v; 1166 1226 } 1167 1227 -
Singular/units.cc
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: units.cc,v 1. 5 2001-02-07 12:48:27Singular Exp $ */4 /* $Id: units.cc,v 1.6 2001-02-08 13:13:05 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: procedures to compute with units … … 18 18 #include <units.h> 19 19 20 BOOLEAN isunit(poly u)21 {22 return (u!=NULL) && pIsConstant(u);23 // if(u==NULL||pTotaldegree(u)>0)24 // return FALSE;25 // return TRUE;26 }27 28 BOOLEAN isunit(matrix U)29 {30 if(MATROWS(U)!=MATCOLS(U))31 return FALSE;32 for(int i=MATCOLS(U);i>=1;i--)33 if(!isunit(MATELEM(U,i,i)))34 return FALSE;35 return TRUE;36 }37 38 BOOLEAN invunit(leftv res,leftv h)39 {40 if(h!=NULL&&h->Typ()==INT_CMD)41 {42 int n=(int)h->Data();43 h=h->next;44 if(h!=NULL)45 {46 if(h->Typ()==POLY_CMD)47 {48 poly u=(poly)h->Data();49 if(!isunit(u))50 {51 WerrorS("unit expected");52 return TRUE;53 }54 res->rtyp=POLY_CMD;55 res->data=(void*)invunit(n,pCopy(u));56 return FALSE;57 }58 if(h->Typ()==MATRIX_CMD)59 {60 matrix U=(matrix)h->Data();61 if(!isunit(U))62 {63 WerrorS("diagonal matrix of units expected");64 return TRUE;65 }66 res->rtyp=MATRIX_CMD;67 res->data=(void*)invunit(n,mpCopy(U));68 return FALSE;69 }70 }71 }72 WerrorS("<int>,[<poly>|<matrix>] expected");73 return TRUE;74 }75 76 poly pjet(int n,poly p)77 {78 poly p0=pJet(p,n);79 pDelete(&p);80 return p0;81 }82 83 poly invunit(int n,poly u)84 {85 if(n<0)86 return NULL;87 number u0=nInvers(pGetCoeff(u));88 poly v=pNSet(u0);89 if(n==0)90 return v;91 poly u1=pjet(n,pSub(pOne(),pMult_nn(u,u0)));92 if(u1==NULL)93 return v;94 poly v1=pMult_nn(pCopy(u1),u0);95 v=pAdd(v,pCopy(v1));96 for(int i=n/pTotaldegree(u1);i>1;i--)97 {98 v1=pjet(n,pMult(v1,pCopy(u1)));99 v=pAdd(v,pCopy(v1));100 }101 pDelete(&u1);102 pDelete(&v1);103 return v;104 }105 106 20 matrix invunit(int n,matrix U) 107 21 { 108 assume(MATCOLS( u)==MATROWS(U));22 assume(MATCOLS(U)==MATROWS(U)); 109 23 for(int i=MATCOLS(U);i>=1;i--) 110 MATELEM(U,i,i)= invunit(n,MATELEM(U,i,i));24 MATELEM(U,i,i)=pInvers(n,MATELEM(U,i,i)); 111 25 return U; 112 }113 114 BOOLEAN series(leftv res,leftv h)115 {116 if(h!=NULL&&h->Typ()==INT_CMD)117 {118 int n=(int)h->Data();119 h=h->next;120 if(h!=NULL)121 {122 if(h->Typ()==POLY_CMD||h->Typ()==VECTOR_CMD)123 {124 int typ=h->Typ();125 poly p=(poly)h->Data();126 h=h->next;127 if(h==NULL)128 {129 res->rtyp=typ;130 res->data=(void*)series(n,pCopy(p));131 return FALSE;132 }133 if(h->Typ()==POLY_CMD)134 {135 poly u=(poly)h->Data();136 if(!isunit(u))137 {138 WerrorS("unit expected");139 return TRUE;140 }141 res->rtyp=typ;142 res->data=(void*)series(n,pCopy(p),pCopy(u));143 return FALSE;144 }145 }146 if(h->Typ()==IDEAL_CMD||h->Typ()==MODUL_CMD)147 {148 int typ=h->Typ();149 ideal M=(ideal)h->Data();150 h=h->next;151 if(h==NULL)152 {153 res->rtyp=typ;154 res->data=(void*)series(n,idCopy(M));155 return FALSE;156 }157 if(h->Typ()==MATRIX_CMD)158 {159 matrix U=(matrix)h->Data();160 if(!isunit(U))161 {162 WerrorS("diagonal matrix of units expected");163 return TRUE;164 }165 if(IDELEMS(M)!=MATROWS(U))166 {167 WerrorS("incompatible matrix size");168 return TRUE;169 }170 res->rtyp=typ;171 res->data=(void*)series(n,idCopy(M),mpCopy(U));172 return FALSE;173 }174 }175 }176 }177 WerrorS("<int>,[<poly>[,<poly>]|<ideal>[,<matrix>]] expected");178 return TRUE;179 }180 181 poly series(int n,poly p,poly u=NULL)182 {183 if(p!=NULL)184 if(u==NULL)185 p=pjet(n,p);186 else187 p=pjet(n,pMult(p,invunit(n-pTotaldegree(p),u)));188 return p;189 }190 191 ideal series(int n,ideal M,matrix U=NULL)192 {193 for(int i=IDELEMS(M)-1;i>=0;i--)194 if(U==NULL)195 M->m[i]=series(n,M->m[i]);196 else197 {198 M->m[i]=series(n,M->m[i],MATELEM(U,i+1,i+1));199 MATELEM(U,i+1,i+1)=NULL;200 }201 if(U!=NULL)202 idDelete((ideal*)&U);203 return M;204 }205 206 BOOLEAN rednf(leftv res,leftv h)207 {208 if(h!=NULL)209 {210 assumeStdFlag(h);211 if(h->Typ()==IDEAL_CMD||h->Typ()==MODUL_CMD)212 {213 int typ=h->Typ();214 ideal N=(ideal)h->Data();215 h=h->next;216 if(h!=NULL&&h->Typ()==typ)217 {218 ideal M=(ideal)h->Data();219 h=h->next;220 if(h==NULL)221 {222 res->rtyp=typ;223 res->data=(void*)rednf(idCopy(N),idCopy(M));224 return FALSE;225 }226 if(h->Typ()==MATRIX_CMD)227 {228 matrix U=(matrix)h->Data();229 if(!isunit(U))230 {231 WerrorS("diagonal matrix of units expected");232 return TRUE;233 }234 if(IDELEMS(M)!=MATROWS(U))235 {236 WerrorS("incompatible matrix size");237 return TRUE;238 }239 res->rtyp=typ;240 res->data=(void*)rednf(idCopy(N),idCopy(M),mpCopy(U));241 return FALSE;242 }243 }244 if(typ==IDEAL_CMD&&h->Typ()==POLY_CMD||245 typ==MODUL_CMD&&h->Typ()==VECTOR_CMD)246 {247 typ=h->Typ();248 poly p=(poly)h->Data();249 h=h->next;250 if(h==NULL)251 {252 res->rtyp=typ;253 res->data=(void*)rednf(idCopy(N),pCopy(p));254 return FALSE;255 }256 if(h->Typ()==POLY_CMD)257 {258 poly u=(poly)h->Data();259 if(!isunit(u))260 {261 WerrorS("unit expected");262 return TRUE;263 }264 res->rtyp=typ;265 res->data=(void*)rednf(idCopy(N),pCopy(p),pCopy(u));266 return FALSE;267 }268 }269 }270 }271 WerrorS("<ideal>,[<ideal>[,<matrix>]|<poly>[,<poly>]] expected");272 return TRUE;273 26 } 274 27 -
Singular/units.h
r4cbe5d rd609e1 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: units.h,v 1. 3 2001-02-01 15:54:46 mschulzeExp $ */4 /* $Id: units.h,v 1.4 2001-02-08 13:13:05 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: procedures to compute with units … … 13 13 poly invunit(int n,poly u); 14 14 matrix invunit(int n,matrix U); 15 BOOLEAN series(leftv res,leftv h);16 poly series(int n,poly p,poly u=NULL);17 ideal series(int n,ideal M,matrix U=NULL);18 BOOLEAN rednf(leftv res,leftv h);19 15 ideal rednf(ideal N,ideal M,matrix U=NULL); 20 16 poly rednf(ideal N,poly p,poly u=NULL);
Note: See TracChangeset
for help on using the changeset viewer.