Changeset a4081e5 in git
- Timestamp:
- Mar 23, 2011, 1:49:38 PM (13 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
- Children:
- e0d8d1b3734f485420a004dfc86eb0b5c5cc62e9
- Parents:
- 58ea04393add5871d2f9f54b118b57b5395f173f
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-03-23 13:49:38+01:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:04:10+01:00
- Location:
- libpolys/polys
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/Makefile.am
r58ea04 ra4081e5 14 14 operations/pShallowCopyDelete.cc operations/p_Mult_q.cc \ 15 15 templates/p_Procs_Lib.cc \ 16 polys0.cc p olys1.cc prCopy.cc prCopyTemplate.cc \16 polys0.cc prCopy.cc prCopyTemplate.cc \ 17 17 kbuckets.cc sbuckets.cc templates/p_Procs.cc weight.cc 18 18 -
libpolys/polys/monomials/p_polys.cc
r58ea04 ra4081e5 3462 3462 } 3463 3463 3464 /***************************************************************/ 3465 3466 poly p_Series(int n,poly p,poly u, intvec *w, const ring R) 3467 { 3468 short *ww=iv2array(w,R); 3469 if(p!=NULL) 3470 { 3471 if(u==NULL) 3472 p=p_JetW(p,n,ww,R); 3473 else 3474 p=p_JetW(p_Mult_q(p,p_Invers(n-p_MinDeg(p,w,R),u,w,R),R),n,ww,R); 3475 } 3476 omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short)); 3477 return p; 3478 } 3479 3480 poly p_Invers(int n,poly u,intvec *w, const ring R) 3481 { 3482 if(n<0) 3483 return NULL; 3484 number u0=n_Invers(pGetCoeff(u),R->cf); 3485 poly v=p_NSet(u0,R); 3486 if(n==0) 3487 return v; 3488 short *ww=iv2array(w,R); 3489 poly u1=p_JetW(p_Sub(p_One(R),p_Mult_nn(u,u0,R),R),n,ww,R); 3490 if(u1==NULL) 3491 { 3492 omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short)); 3493 return v; 3494 } 3495 poly v1=p_Mult_nn(p_Copy(u1,R),u0,R); 3496 v=p_Add_q(v,p_Copy(v1,R),R); 3497 for(int i=n/p_MinDeg(u1,w,R);i>1;i--) 3498 { 3499 v1=p_JetW(p_Mult_q(v1,p_Copy(u1,R),R),n,ww,R); 3500 v=p_Add_q(v,p_Copy(v1,R),R); 3501 } 3502 p_Delete(&u1,R); 3503 p_Delete(&v1,R); 3504 omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short)); 3505 return v; 3506 } 3507 3464 3508 /*************************************************************** 3465 3509 * -
libpolys/polys/monomials/p_polys.h
r58ea04 ra4081e5 1870 1870 nMapFunc nMap, int *par_perm=NULL, int OldPar=0); 1871 1871 1872 /*----------------------------------------------------*/ 1873 poly p_Series(int n,poly p,poly u, intvec *w, const ring R); 1874 poly p_Invers(int n,poly u,intvec *w, const ring R); 1875 1876 1872 1877 #endif // P_POLYS_H 1873 1878 -
libpolys/polys/polys.h
r58ea04 ra4081e5 322 322 #define pJetW(p,m,iv) p_JetW(p,m,iv,currRing) 323 323 #define pMinDeg(p,w) p_MinDeg(p,w,currRing) 324 poly pSeries(int n,poly p,poly u=NULL,intvec *w=NULL); 325 poly pInvers(int n, poly p,intvec *w=NULL); 324 #define pSeries(n,p,u,w) p_series(n,p,u,w,currRing) 325 #define pInvers(n,p,w) p_Invers(n,p,w,currRing) 326 326 // maximum weigthed degree of all monomials of p, w is indexed from 327 327 // 1..pVariables -
libpolys/polys/polys1.cc
r58ea04 ra4081e5 1 </****************************************2 * Computer Algebra System SINGULAR *3 ****************************************/4 /* $Id$ */5 6 /*7 * ABSTRACT - all basic methods to manipulate polynomials:8 * independent of representation9 */10 11 /* includes */12 #include <string.h>13 #include "polys/config.h"14 // #include <polys/options.h>15 #include <coeffs/numbers.h>16 #include <coeffs/ffields.h>17 #include <omalloc/omalloc.h>18 // #include <???/febase.h>19 // #include <???/weight.h>20 // #include <???/intvec.h>21 #include <polys/ext_fields/longalg.h>22 #include <polys/monomials/ring.h>23 // #include <???/ideals.h>24 // #include <polys/polys.h>25 // #include "ipid.h"26 #ifdef HAVE_FACTORY27 // #include <???/clapsing.h>28 #endif29 30 #ifdef HAVE_RATGRING31 // #include <polys/ratgring.h>32 #endif33 34 35 poly pSeries(int n,poly p,poly u, intvec *w)36 {37 short *ww=iv2array(w);38 if(p!=NULL)39 {40 if(u==NULL)41 p=pJetW(p,n,ww);42 else43 p=pJetW(pMult(p,pInvers(n-pMinDeg(p,w),u,w)),n,ww);44 }45 omFreeSize((ADDRESS)ww,(pVariables+1)*sizeof(short));46 return p;47 }48 49 poly pInvers(int n,poly u,intvec *w)50 {51 short *ww=iv2array(w);52 if(n<0)53 return NULL;54 number u0=nInvers(pGetCoeff(u));55 poly v=pNSet(u0);56 if(n==0)57 return v;58 poly u1=pJetW(pSub(pOne(),pMult_nn(u,u0)),n,ww);59 if(u1==NULL)60 return v;61 poly v1=pMult_nn(pCopy(u1),u0);62 v=pAdd(v,pCopy(v1));63 for(int i=n/pMinDeg(u1,w);i>1;i--)64 {65 v1=pJetW(pMult(v1,pCopy(u1)),n,ww);66 v=pAdd(v,pCopy(v1));67 }68 pDelete(&u1);69 pDelete(&v1);70 omFreeSize((ADDRESS)ww,(pVariables+1)*sizeof(short));71 return v;72 }73 74 /*-----------type conversions ----------------------------*/75 #if 076 /*277 * convert a vector to a set of polys,78 * allocates the polyset, (entries 0..(*len)-1)79 * the vector will not be changed80 */81 void pVec2Polys(poly v, polyset *p, int *len)82 {83 poly h;84 int k;85 86 *len=pMaxComp(v);87 if (*len==0) *len=1;88 *p=(polyset)omAlloc0((*len)*sizeof(poly));89 while (v!=NULL)90 {91 h=pHead(v);92 k=pGetComp(h);93 pSetComp(h,0);94 (*p)[k-1]=pAdd((*p)[k-1],h);95 pIter(v);96 }97 }98 99 int p_Var(poly m,const ring r)100 {101 if (m==NULL) return 0;102 if (pNext(m)!=NULL) return 0;103 int i,e=0;104 for (i=r->N; i>0; i--)105 {106 int exp=p_GetExp(m,i,r);107 if (exp==1)108 {109 if (e==0) e=i;110 else return 0;111 }112 else if (exp!=0)113 {114 return 0;115 }116 }117 return e;118 }119 120 /*2121 * returns TRUE if p1 = p2122 */123 BOOLEAN p_EqualPolys(poly p1,poly p2, const ring r)124 {125 while ((p1 != NULL) && (p2 != NULL))126 {127 if (! p_LmEqual(p1, p2,r))128 return FALSE;129 if (! n_Equal(p_GetCoeff(p1,r), p_GetCoeff(p2,r),r ))130 return FALSE;131 pIter(p1);132 pIter(p2);133 }134 return (p1==p2);135 }136 137 1 /*2 138 2 *returns TRUE if p1 is a skalar multiple of p2
Note: See TracChangeset
for help on using the changeset viewer.