Loading...
Searching...
No Matches
prCopy.cc File Reference
`#include "misc/auxiliary.h"`
`#include "polys/monomials/ring.h"`
`#include "polys/monomials/p_polys.h"`
`#include "coeffs/numbers.h"`
`#include "polys/simpleideals.h"`
`#include "polys/prCopy.inc"`

Go to the source code of this file.

## Typedefs

typedef poly(* | prCopyProc_t) (poly &src_p, ring src_r, ring dest_r)

## Functions

static void | prCopyEvector (poly dest, ring dest_r, poly src, ring src_r, int max)
poly | prCopyR (poly p, ring src_r, ring dest_r)
poly | prMapR (poly src, nMapFunc nMap, ring src_r, ring dest_r)
poly | prCopyR_NoSort (poly p, ring src_r, ring dest_r)
poly | prMoveR (poly &p, ring src_r, ring dest_r)
poly | prMoveR_NoSort (poly &p, ring src_r, ring dest_r)
poly | prShallowCopyR_NoSort (poly p, ring r, ring dest_r)
poly | prShallowCopyR (poly p, ring r, ring dest_r)
poly | prHeadR (poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
poly | prHeadR (poly p, ring src_r, ring dest_r)
ideal | idrHeadR (ideal id, ring r, ring dest_r)
| Copy leading terms of id[i] via prHeeadR into dest_r.
static ideal | idrCopy (ideal id, ring src_r, ring dest_r, prCopyProc_t prproc)
ideal | idrCopyR (ideal id, ring src_r, ring dest_r)
ideal | idrCopyR_NoSort (ideal id, ring src_r, ring dest_r)
ideal | idrShallowCopyR (ideal id, ring src_r, ring dest_r)
ideal | idrShallowCopyR_NoSort (ideal id, ring src_r, ring dest_r)
static ideal | idrMove (ideal &id, ring src_r, ring dest_r, prCopyProc_t prproc)
ideal | idrMoveR (ideal &id, ring src_r, ring dest_r)
ideal | idrMoveR_NoSort (ideal &id, ring src_r, ring dest_r)

## Typedef Documentation

## prCopyProc_t

typedef poly(* prCopyProc_t) (poly &src_p, ring src_r, ring dest_r)

Definition at line 124 of file prCopy.cc.

## Function Documentation

## idrCopy()

ideal idrCopy | ( | ideal | id,
|  | ring | src_r,
|  | ring | dest_r,
|  | prCopyProc_t | prproc )

inline static

Definition at line 175 of file prCopy.cc.

{
if (id == NULL) return NULL;
assume(src_r->cf==dest_r->cf);
poly p;
ideal res = idInit(IDELEMS(id), id->rank);
int i;
for (i=IDELEMS(id)-1; i>=0; i--)
{
p = id->m[i];
res->m[i] = prproc(p, src_r, dest_r);
p_Test(res->m[i], dest_r);
}
return res;
}
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
res
CanonicalForm res
Definition facAbsFact.cc:60
assume
#define assume(x)
Definition mod2.h:389
NULL
#define NULL
Definition omList.c:12
p_Test
#define p_Test(p, r)
Definition p_polys.h:161
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23

## idrCopyR()

ideal idrCopyR | ( | ideal | id,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 192 of file prCopy.cc.

{
assume(src_r->cf==dest_r->cf);
ideal res;
prCopyProc_t prproc;
if (rField_has_simple_Alloc(dest_r))
prproc = pr_Copy_NoREqual_NSimple_Sort;
else
prproc = pr_Copy_NoREqual_NoNSimple_Sort;
res = idrCopy(id, src_r, dest_r, prproc);
return res;
}
idrCopy
static ideal idrCopy(ideal id, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition prCopy.cc:175
prCopyProc_t
poly(* prCopyProc_t)(poly &src_p, ring src_r, ring dest_r)
Definition prCopy.cc:124
rField_has_simple_Alloc
static BOOLEAN rField_has_simple_Alloc(const ring r)
Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies.
Definition ring.h:558

## idrCopyR_NoSort()

ideal idrCopyR_NoSort | ( | ideal | id,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 205 of file prCopy.cc.

{
assume(src_r->cf==dest_r->cf);
ideal res;
prCopyProc_t prproc;
if (rField_has_simple_Alloc(dest_r))
prproc = pr_Copy_NoREqual_NSimple_NoSort;
else
prproc = pr_Copy_NoREqual_NoNSimple_NoSort;
res = idrCopy(id, src_r, dest_r, prproc);
return res;
}

## idrHeadR()

ideal idrHeadR | ( | ideal | id,
|  | ring | r,
|  | ring | dest_r )

Copy leading terms of id[i] via prHeeadR into dest_r.

Definition at line 156 of file prCopy.cc.

{
if (id == NULL) return NULL;
prCopyProc_t prproc = pr_Copy_NoREqual_NoNSimple_NoSort;
if (rField_has_simple_Alloc(dest_r))
prproc = pr_Copy_NoREqual_NSimple_NoSort;
const int N = IDELEMS(id);
ideal res = idInit(N, id->rank);
for (int i = N - 1; i >= 0; i--)
res->m[i] = prHeadR(id->m[i], r, dest_r, prproc); // !!!
return res;
}
N
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
prHeadR
poly prHeadR(poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition prCopy.cc:126

## idrMove()

ideal idrMove | ( | ideal & | id,
|  | ring | src_r,
|  | ring | dest_r,
|  | prCopyProc_t | prproc )

inline static

Definition at line 233 of file prCopy.cc.

{
assume(src_r->cf==dest_r->cf);
assume( prproc != NULL );
if (id == NULL) return NULL;
ideal res = id; id = NULL;
for (int i = IDELEMS(res) - 1; i >= 0; i--)
res->m[i] = prproc(res->m[i], src_r, dest_r);
return res;
}

## idrMoveR()

ideal idrMoveR | ( | ideal & | id,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 248 of file prCopy.cc.

{
assume(src_r->cf==dest_r->cf);
prCopyProc_t prproc;
ideal res;
if (rField_has_simple_Alloc(dest_r))
prproc = pr_Move_NoREqual_NSimple_Sort;
else
prproc = pr_Move_NoREqual_NoNSimple_Sort;
res = idrMove(id, src_r, dest_r, prproc);
return res;
}
idrMove
static ideal idrMove(ideal &id, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition prCopy.cc:233

## idrMoveR_NoSort()

ideal idrMoveR_NoSort | ( | ideal & | id,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 261 of file prCopy.cc.

{
assume(src_r->cf==dest_r->cf);
prCopyProc_t prproc;
ideal res;
if (rField_has_simple_Alloc(dest_r))
prproc = pr_Move_NoREqual_NSimple_NoSort;
else
prproc = pr_Move_NoREqual_NoNSimple_NoSort;
res = idrMove(id, src_r, dest_r, prproc);
return res;
}

## idrShallowCopyR()

ideal idrShallowCopyR | ( | ideal | id,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 220 of file prCopy.cc.

{
return idrCopy(id, src_r, dest_r, pr_Copy_NoREqual_NSimple_Sort);
}

## idrShallowCopyR_NoSort()

ideal idrShallowCopyR_NoSort | ( | ideal | id,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 225 of file prCopy.cc.

{
return idrCopy(id, src_r, dest_r, pr_Copy_NoREqual_NSimple_NoSort);
}

## prCopyEvector()

void prCopyEvector | ( | poly | dest,
|  | ring | dest_r,
|  | poly | src,
|  | ring | src_r,
|  | int | max )

inline static

Definition at line 18 of file prCopy.cc.

{
//memset(dest->exp,0,dest_r->ExpL_Size*sizeof(long));
int i;
for (i=max; i>0; i--)
{
p_SetExp(dest, i, p_GetExp( src, i,src_r), dest_r);
}
if (rRing_has_Comp(dest_r) && rRing_has_Comp(src_r))
p_SetComp(dest, p_GetComp( src,src_r), dest_r);
p_Setm(dest, dest_r);
}
max
static int max(int a, int b)
Definition fast_mult.cc:264
p_GetComp
#define p_GetComp(p, r)
Definition monomials.h:64
rRing_has_Comp
#define rRing_has_Comp(r)
Definition monomials.h:266
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_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
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

## prCopyR()

poly prCopyR | ( | poly | p,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 34 of file prCopy.cc.

{
poly res;
if (rField_has_simple_Alloc(dest_r))
res = pr_Copy_NoREqual_NSimple_Sort(p, src_r, dest_r);
else
res = pr_Copy_NoREqual_NoNSimple_Sort(p, src_r, dest_r);
p_Test(res, dest_r);
return res;
}

## prCopyR_NoSort()

poly prCopyR_NoSort | ( | poly | p,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 77 of file prCopy.cc.

{
poly res;
if (rField_has_simple_Alloc(dest_r))
res = pr_Copy_NoREqual_NSimple_NoSort(p, src_r, dest_r);
else
res = pr_Copy_NoREqual_NoNSimple_NoSort(p, src_r, dest_r);
p_Test(res, dest_r);
return res;
}

## prHeadR() [1/2]

poly prHeadR | ( | poly | p,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 141 of file prCopy.cc.

{
prCopyProc_t prproc;
if (rField_has_simple_Alloc(dest_r))
prproc = pr_Copy_NoREqual_NSimple_NoSort;
else
prproc = pr_Copy_NoREqual_NoNSimple_NoSort;
const poly res = prHeadR(p, src_r, dest_r, prproc);
p_Test(res, dest_r);
return res;
}

## prHeadR() [2/2]

poly prHeadR | ( | poly | p,
|  | ring | src_r,
|  | ring | dest_r,
|  | prCopyProc_t | prproc )

Definition at line 126 of file prCopy.cc.

{
if (p == NULL) return NULL;
poly tail, head, q = p;
tail = pNext(p);
pNext(p) = NULL;
head = prproc(q, src_r, dest_r);
pNext(p) = tail;
p_Test(p, src_r);
p_Test(head, dest_r);
return head;
}
head
CanonicalForm head(const CanonicalForm &f)
Definition canonicalform.h:360
pNext
#define pNext(p)
Definition monomials.h:36

## prMapR()

poly prMapR | ( | poly | src,
|  | nMapFunc | nMap,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 45 of file prCopy.cc.

{
if (src==NULL) return NULL;
int _min = si_min(dest_r->N, src_r->N);
spolyrec dest_s;
poly dest = &dest_s;
poly prev;
while (src != NULL)
{
pNext(dest) = (poly) p_Init(dest_r);
prev = dest;
pIter(dest);
pSetCoeff0(dest, nMap(pGetCoeff(src),src_r->cf,dest_r->cf));
prCopyEvector(dest, dest_r, src, src_r, _min);
if (n_IsZero(pGetCoeff(dest),dest_r->cf))
{
p_LmDelete(&pNext(prev),dest_r);
dest=prev;
}
pIter(src);
}
pNext(dest) = NULL;
dest = pNext(&dest_s);
dest=p_SortAdd(dest, dest_r);
p_Test(dest, dest_r);
return dest;
}
si_min
static int si_min(const int a, const int b)
Definition auxiliary.h:126
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:470
pIter
#define pIter(p)
Definition monomials.h:37
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
spolyrec
Definition monomials.h:23
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725
p_Init
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1341
p_SortAdd
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition p_polys.h:1240
prCopyEvector
static void prCopyEvector(poly dest, ring dest_r, poly src, ring src_r, int max)
Definition prCopy.cc:18

## prMoveR()

poly prMoveR | ( | poly & | p,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 90 of file prCopy.cc.

{
poly res;
if (rField_has_simple_Alloc(dest_r))
res = pr_Move_NoREqual_NSimple_Sort(p, src_r, dest_r);
else
res = pr_Move_NoREqual_NoNSimple_Sort(p, src_r, dest_r);
p_Test(res, dest_r);
return res;
}

## prMoveR_NoSort()

poly prMoveR_NoSort | ( | poly & | p,
|  | ring | src_r,
|  | ring | dest_r )

Definition at line 101 of file prCopy.cc.

{
poly res;
if (rField_has_simple_Alloc(dest_r))
res = pr_Move_NoREqual_NSimple_NoSort(p, src_r, dest_r);
else
res = pr_Move_NoREqual_NoNSimple_NoSort(p, src_r, dest_r);
p_Test(res, dest_r);
return res;
}

## prShallowCopyR()

poly prShallowCopyR | ( | poly | p,
|  | ring | r,
|  | ring | dest_r )

Definition at line 117 of file prCopy.cc.

{
return pr_Copy_NoREqual_NSimple_Sort(p, r, dest_r);
}

## prShallowCopyR_NoSort()

poly prShallowCopyR_NoSort | ( | poly | p,
|  | ring | r,
|  | ring | dest_r )

Definition at line 112 of file prCopy.cc.

{
return pr_Copy_NoREqual_NSimple_NoSort(p, r, dest_r);
}