My Project
Loading...
Searching...
No Matches
Functions
pCoeff.cc File Reference
#include "misc/auxiliary.h"
#include "coeffs/coeffs.h"
#include "coeffs/longrat.h"
#include "polys/monomials/p_polys.h"
#include "polys/pCoeff.h"
#include "simpleideals.h"

Go to the source code of this file.

Functions

number p_CoeffTerm (poly p, poly m, const ring r)
 find coeff of (polynomial) m in polynomial p find coeff of (vector) m in vector p More...
 
poly p_CoeffTermV (poly v, poly m, const ring r)
 find vector of coeffs of (polynomial) m in vector v More...
 
ideal id_CoeffTerm (ideal I, poly m, const ring r)
 find coeffs of (polynomial) m in all polynomials from I find coeffs of (vector) m in all vectors from I More...
 
ideal id_CoeffTermV (ideal M, poly m, const ring r)
 find coeffs of (polynomial) m in all vectors from I More...
 
poly p_CoeffTermId (poly v, ideal m, int n, const ring r)
 find coeffs of a vector of a list of given monomials, n>=max_comp(v) More...
 
poly p_CoeffTermMo (poly v, ideal m, int n, const ring r)
 find coeffs of a vector of a matrix(module) of given monomials, n>=max_comp(v) More...
 

Function Documentation

◆ id_CoeffTerm()

ideal id_CoeffTerm ( ideal  I,
poly  m,
const ring  r 
)

find coeffs of (polynomial) m in all polynomials from I find coeffs of (vector) m in all vectors from I

Definition at line 63 of file pCoeff.cc.

64{
65 ideal res=idInit(IDELEMS(I),I->rank);
66 for(int i=IDELEMS(I)-1;i>=0;i--)
67 {
68 number n=p_CoeffTerm(I->m[i],m,r);
69 res->m[i]=p_NSet(n,r);
70 }
71 return res;
72}
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
CanonicalForm res
Definition: facAbsFact.cc:60
number p_CoeffTerm(poly p, poly m, const ring r)
find coeff of (polynomial) m in polynomial p find coeff of (vector) m in vector p
Definition: pCoeff.cc:22
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1473
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define IDELEMS(i)
Definition: simpleideals.h:23

◆ id_CoeffTermV()

ideal id_CoeffTermV ( ideal  M,
poly  m,
const ring  r 
)

find coeffs of (polynomial) m in all vectors from I

Definition at line 75 of file pCoeff.cc.

76{
77 ideal res=idInit(IDELEMS(M),M->rank);
78 for(int i=IDELEMS(M)-1;i>=0;i--)
79 {
80 res->m[i]=p_CoeffTermV(M->m[i],m,r);
81 }
82 return res;
83}
poly p_CoeffTermV(poly v, poly m, const ring r)
find vector of coeffs of (polynomial) m in vector v
Definition: pCoeff.cc:39
#define M
Definition: sirandom.c:25

◆ p_CoeffTerm()

number p_CoeffTerm ( poly  p,
poly  m,
const ring  r 
)

find coeff of (polynomial) m in polynomial p find coeff of (vector) m in vector p

Definition at line 22 of file pCoeff.cc.

23{
24 if (m!=NULL)
25 {
26 while (p!=NULL)
27 {
28 if (p_LmCmp(p,m,r)==0)
29 {
30 return n_Copy(p_GetCoeff(p,r),r->cf);
31 }
32 pIter(p);
33 }
34 }
35 return n_Init(0,r->cf);
36}
int p
Definition: cfModGcd.cc:4078
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:448
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:535
#define pIter(p)
Definition: monomials.h:37
#define p_GetCoeff(p, r)
Definition: monomials.h:50
#define NULL
Definition: omList.c:12
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1578

◆ p_CoeffTermId()

poly p_CoeffTermId ( poly  v,
ideal  m,
int  n,
const ring  r 
)

find coeffs of a vector of a list of given monomials, n>=max_comp(v)

Definition at line 86 of file pCoeff.cc.

87{
88 if ((n<=0)||(v==NULL)) return NULL;
89 poly q;
90 poly u=NULL;
91 int dummy;
92 const int ncols_m=IDELEMS(m);
93 v=p_Copy(v,r);
94 for(int i=1;i<=n;i++)
95 {
96 p_TakeOutComp(&v,i,&q,&dummy,r);
97 for(int j=0;j<ncols_m;j++)
98 {
99 number n=p_CoeffTerm(q,m->m[j],r);
100 poly uu=p_NSet(n,r);
101 if (uu!=NULL)
102 {
103 p_SetComp(uu,(i-1)*ncols_m+j+1,r);
104 u=p_Add_q(u,uu,r);
105 }
106 }
107 if (v==NULL) break;
108 }
109 return u;
110}
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
int j
Definition: facHensel.cc:110
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3496
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:934
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:245
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844

◆ p_CoeffTermMo()

poly p_CoeffTermMo ( poly  v,
ideal  m,
int  n,
const ring  r 
)

find coeffs of a vector of a matrix(module) of given monomials, n>=max_comp(v)

find coeffs of a vector of a matrix(as module) of given monomials, n>=max_comp(v)

Definition at line 113 of file pCoeff.cc.

114{
115 poly res=NULL;
116 int to_shift=0;
117 poly q;
118 int dummy;
119 v=p_Copy(v,r);
120 for(int i=0;i<IDELEMS(m);i++)
121 {
122 if (v==NULL) break;
123 p_TakeOutComp(&v,i+1,&q,&dummy,r);
124 ideal mm=id_Vec2Ideal(m->m[i],r);
125 p_SetCompP(q,1,r);
126 poly tmp=p_CoeffTermId(q,mm,1,r);
127 if (i>0)
128 {
129 to_shift+=p_MaxComp(m->m[i-1],r);
130 p_Shift(&tmp,to_shift,r);
131 res=p_Add_q(res,tmp,r);
132 }
133 else
134 res=tmp;
135 }
136 return res;
137}
poly p_CoeffTermId(poly v, ideal m, int n, const ring r)
find coeffs of a vector of a list of given monomials, n>=max_comp(v)
Definition: pCoeff.cc:86
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4706
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:252
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:290
ideal id_Vec2Ideal(poly vec, const ring R)

◆ p_CoeffTermV()

poly p_CoeffTermV ( poly  v,
poly  m,
const ring  r 
)

find vector of coeffs of (polynomial) m in vector v

Definition at line 39 of file pCoeff.cc.

40{
41 poly res=NULL;
42 if (m!=NULL)
43 {
44 while (v!=NULL)
45 {
46 p_SetComp(m,p_GetComp(v,r),r);
47 if (p_LmCmp(v,m,r)==0)
48 {
49 p_SetComp(m,0,r);
50 poly p=p_Init(r);
52 p_SetComp(p,p_GetComp(v,r),r);
53 res=p_Add_q(res,p,r);
54 }
55 pIter(v);
56 }
57 }
58 return res;
59}
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:60
#define p_GetComp(p, r)
Definition: monomials.h:64
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1318