MCPcopy Create free account
hub / github.com/Singular/Singular / uni_subst_bits

Function uni_subst_bits

kernel/digitech.cc:47–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r)
48{
49 zero_ideal=idInit(0,1);
50 //assumes outer_uni is univariate and ordering global
51 int d_max=p_GetExp(outer_uni,1,r);
52 poly* potences=(poly*) omAlloc((d_max+1)*sizeof(poly));
53 potences[0]=p_ISet(1,r);
54 int i;
55 for(i=1;i<=d_max;i++)
56 {
57 potences[i]=pp_Mult_qq(potences[i-1],inner_multi,r);
58 bit_reduce(potences[i],r);
59 }
60
61 poly p=outer_uni;
62 kBucket_pt erg_bucket= kBucketCreate(r);
63 kBucketInit(erg_bucket,NULL,0 /*pLength(P.p)*/);
64
65
66 while(p)
67 {
68 int d=p_GetExp(p,1,r);
69 assume(potences[d]!=NULL); //mustn't always hold, but for most input
70 int pseudo_len=0;
71 kBucket_Add_q(erg_bucket,p_Mult_nn(potences[d],p_GetCoeff(p,r),r),&pseudo_len);
72 potences[d]=NULL;
73 p=pNext(p);
74 }
75
76 //free potences
77 for(i=0;i<=d_max;i++)
78 {
79 p_Delete(&potences[i],r);
80 }
81 omfree(potences);
82 int len=0;
83 poly erg;
84 kBucketClear(erg_bucket,&erg, &len);
85 kBucketDestroy(&erg_bucket);
86 return(erg);
87}

Callers 1

jjEXTENDED_SYSTEMFunction · 0.85

Calls 12

idInitFunction · 0.85
p_GetExpFunction · 0.85
p_ISetFunction · 0.85
pp_Mult_qqFunction · 0.85
bit_reduceFunction · 0.85
kBucketCreateFunction · 0.85
kBucketInitFunction · 0.85
kBucket_Add_qFunction · 0.85
p_Mult_nnFunction · 0.85
p_DeleteFunction · 0.85
kBucketDestroyFunction · 0.85
kBucketClearFunction · 0.50

Tested by

no test coverage detected