Loading...
Searching...
No Matches
digitech.cc File Reference
`#include "kernel/mod2.h"`
`#include "polys/monomials/ring.h"`
`#include "kernel/digitech.h"`
`#include "polys/kbuckets.h"`
`#include "kernel/ideals.h"`

Go to the source code of this file.

## Functions

void | bit_reduce (poly &f, ring r)
poly | uni_subst_bits (poly outer_uni, poly inner_multi, ring r)

## Variables

STATIC_INST_VAR ideal | zero_ideal

## Function Documentation

## bit_reduce()

void bit_reduce | ( | poly & | f,
|  | ring | r )

Definition at line 15 of file digitech.cc.

{
poly p=f;
kBucket_pt erg_bucket= kBucketCreate(r);
kBucketInit(erg_bucket,NULL,0 /*pLength(P.p)*/);
while(p)
{
poly next=pNext(p);
pNext(p)=NULL;
int i;
int max=rVar(r);
for(i=1;i<=max;i++)
{
unsigned long exp=p_GetExp(p,i,r);
if(exp!=0)
p_SetExp(p,i,1,r);
}
p_Setm(p,r);
int pseudo_len=0;
kBucket_Add_q(erg_bucket,p,&pseudo_len);
p=next;
}
int len=0;
poly erg;
kBucketClear(erg_bucket,&erg, &len);
kBucketDestroy(&erg_bucket);
f=erg;
}
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
f
FILE * f
Definition checklibs.c:9
max
static int max(int a, int b)
Definition fast_mult.cc:264
next
ListNode * next
Definition janet.h:31
kBucketClear
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition kbuckets.cc:521
kBucketDestroy
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition kbuckets.cc:216
kBucketInit
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition kbuckets.cc:493
kBucketCreate
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition kbuckets.cc:209
kBucket_Add_q
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition kbuckets.cc:660
pNext
#define pNext(p)
Definition monomials.h:36
exp
gmp_float exp(const gmp_float &a)
Definition mpr_complex.cc:349
NULL
#define NULL
Definition omList.c:12
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:490
p_Setm
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471
kBucket_pt
kBucket * kBucket_pt
Definition ring.h:26
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598

## uni_subst_bits()

poly uni_subst_bits | ( | poly | outer_uni,
|  | poly | inner_multi,
|  | ring | r )

Definition at line 47 of file digitech.cc.

{
zero_ideal=idInit(0,1);
//assumes outer_uni is univariate and ordering global
int d_max=p_GetExp(outer_uni,1,r);
poly* potences=(poly*) omAlloc((d_max+1)*sizeof(poly));
potences[0]=p_ISet(1,r);
int i;
for(i=1;i<=d_max;i++)
{
potences[i]=pp_Mult_qq(potences[i-1],inner_multi,r);
bit_reduce(potences[i],r);
}
poly p=outer_uni;
kBucket_pt erg_bucket= kBucketCreate(r);
kBucketInit(erg_bucket,NULL,0 /*pLength(P.p)*/);
while(p)
{
int d=p_GetExp(p,1,r);
assume(potences[d]!=NULL); //mustn't always hold, but for most input
int pseudo_len=0;
kBucket_Add_q(erg_bucket,p_Mult_nn(potences[d],p_GetCoeff(p,r),r),&pseudo_len);
potences[d]=NULL;
p=pNext(p);
}
//free potences
for(i=0;i<=d_max;i++)
{
p_Delete(&potences[i],r);
}
omfree(potences);
int len=0;
poly erg;
kBucketClear(erg_bucket,&erg, &len);
kBucketDestroy(&erg_bucket);
return(erg);
}
bit_reduce
void bit_reduce(poly &f, ring r)
Definition digitech.cc:15
zero_ideal
STATIC_INST_VAR ideal zero_ideal
Definition digitech.cc:13
assume
#define assume(x)
Definition mod2.h:389
p_GetCoeff
#define p_GetCoeff(p, r)
Definition monomials.h:50
omfree
#define omfree(addr)
Definition omAllocDecl.h:237
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
p_Mult_nn
static poly p_Mult_nn(poly p, number n, const ring r)
Definition p_polys.h:960
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
pp_Mult_qq
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition p_polys.h:1167
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35

## Variable Documentation

## zero_ideal

STATIC_INST_VAR ideal zero_ideal

Definition at line 13 of file digitech.cc.