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

Go to the source code of this file.

## Functions

static int * | find_perm_for_map (const ring preimage_r, const ring image_r, const ideal image)
matrix | ma_ApplyPermForMap (const matrix to_map, const ring preimage_r, const ideal image, const ring image_r, const nMapFunc nMap)
| helper function for maMapIdeal mapping ideal/matrix/module for the case of a permutation: maps the ideal/module/matrix to_map via the map from preimage_r with image image and mapping of coefficients via nMap (or return NULL)

## Function Documentation

## find_perm_for_map()

int * find_perm_for_map | ( | const ring | preimage_r,
|  | const ring | image_r,
|  | const ideal | image )

static

Definition at line 19 of file find_perm.cc.

{
int i;
int *perm=(int *)omAlloc0((preimage_r->N+1)*sizeof(int));
for (i=si_min(IDELEMS(image),preimage_r->N)-1; i>=0; i--)
{
if (image->m[i]!=NULL)
{
if((pNext(image->m[i])==NULL)
&& (n_IsOne(pGetCoeff(image->m[i]),image_r->cf)))
{
int v=p_IsUnivariate(image->m[i],image_r);
if (v<=0) /*not univariate */
{
omFreeSize(perm,(preimage_r->N+1)*sizeof(int));
return NULL;
}
else if (v>0) /* image is univaritate */
{
if (p_GetExp(image->m[i],v,image_r)==1)
{
perm[i+1]=v; /* and of exp 1 */
}
else
{
omFreeSize(perm,(preimage_r->N+1)*sizeof(int));
return NULL;
}
}
}
else /* image is not a monomial */
{
omFreeSize(perm,(preimage_r->N+1)*sizeof(int));
return NULL;
}
}
}
//Print("elms:%d, N:%d\n",IDELEMS(image),preimage_r->N);
//iiWriteMatrix((matrix)image,"_",1,image_r,0);
//PrintS("\npreimage:\n");rWrite(preimage_r);
//PrintS("image:\n");rWrite(image_r);
//PrintS("\nperm:");
//for (i=1; i<=preimage_r->N; i++)
//{
// Print(" %d",perm[i]);
//}
//PrintLn();
return perm;
}
si_min
static int si_min(const int a, const int b)
Definition auxiliary.h:126
i
int i
Definition cfEzgcd.cc:132
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition coeffs.h:474
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
pNext
#define pNext(p)
Definition monomials.h:36
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
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
p_IsUnivariate
int p_IsUnivariate(poly p, const ring r)
return i, if poly depends only on var(i)
Definition p_polys.cc:1248
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
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23

## ma_ApplyPermForMap()

matrix ma_ApplyPermForMap | ( | const matrix | to_map,
|  | const ring | preimage_r,
|  | const ideal | image,
|  | const ring | image_r,
|  | const nMapFunc | nMap )

helper function for maMapIdeal mapping ideal/matrix/module for the case of a permutation: maps the ideal/module/matrix to_map via the map from preimage_r with image image and mapping of coefficients via nMap (or return NULL)

Definition at line 69 of file find_perm.cc.

{
if ((rPar(preimage_r)>0)||(rPar(image_r)>0)) return NULL; /* not applicable */
int *perm=find_perm_for_map(preimage_r,image_r,image);
if (perm==NULL) return NULL; /* could not find permutation */
int C=to_map->cols();
int R=to_map->rows();
matrix m=mpNew(R,C);
for (int i=R*C-1;i>=0;i--)
{
if (to_map->m[i]!=NULL)
{
m->m[i]=p_PermPoly(to_map->m[i],perm,preimage_r,image_r, nMap,NULL,0);
p_Test(m->m[i],image_r);
}
}
ideal ii=(ideal)m;
ii->rank=((ideal)to_map)->rank;
omFreeSize(perm,(preimage_r->N+1)*sizeof(int));
return m;
}
m
int m
Definition cfEzgcd.cc:128
ip_smatrix::m
poly * m
Definition matpol.h:18
ip_smatrix::cols
int & cols()
Definition matpol.h:24
ip_smatrix::rows
int & rows()
Definition matpol.h:23
find_perm_for_map
static int * find_perm_for_map(const ring preimage_r, const ring image_r, const ideal image)
Definition find_perm.cc:19
mpNew
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition matpol.cc:37
matrix
ip_smatrix * matrix
Definition matpol.h:43
p_PermPoly
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition p_polys.cc:4256
p_Test
#define p_Test(p, r)
Definition p_polys.h:161
rPar
static int rPar(const ring r)
(r->cf->P)
Definition ring.h:605
R
#define R
Definition sirandom.c:27