version 1.1.1.1, 1999/10/08 02:12:02 |
version 1.6, 2003/08/24 05:19:43 |
|
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/redm.c,v 1.5 2003/07/17 09:10:54 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "extern2.h" |
#include "extern2.h" |
Line 9 static int DebugReduction = 0; |
|
Line 10 static int DebugReduction = 0; |
|
|
|
|
|
int isReducible_module(f,g) |
int isReducible_module(f,g) |
POLY f; |
POLY f; |
POLY g; |
POLY g; |
{ |
{ |
int n,i; |
int n,i; |
MONOMIAL tf; |
MONOMIAL tf; |
|
|
|
|
|
|
int isSameComponent_x(f,g) |
int isSameComponent_x(f,g) |
POLY f; |
POLY f; |
POLY g; |
POLY g; |
{ |
{ |
static int nn,mm,ll,cc,n,m,l,c; |
static int nn,mm,ll,cc,n,m,l,c; |
static struct ring *cr = (struct ring *)NULL; |
static struct ring *cr = (struct ring *)NULL; |
|
|
} |
} |
|
|
int isSameComponent_xd(f,g) |
int isSameComponent_xd(f,g) |
POLY f; |
POLY f; |
POLY g; |
POLY g; |
{ |
{ |
static int nn,mm,ll,cc,n,m,l,c; |
static int nn,mm,ll,cc,n,m,l,c; |
static struct ring *cr = (struct ring *)NULL; |
static struct ring *cr = (struct ring *)NULL; |
|
|
|
|
|
|
POLY lcm_module(f,g) |
POLY lcm_module(f,g) |
POLY f; |
POLY f; |
POLY g; |
POLY g; |
{ |
{ |
MONOMIAL tf,tg; |
MONOMIAL tf,tg; |
MONOMIAL lcm; |
MONOMIAL lcm; |
|
|
|
|
|
|
int grade_module1v(f) |
int grade_module1v(f) |
POLY f; |
POLY f; |
{ |
{ |
int r; |
int r; |
int i; |
int i; |
|
|
|
|
|
|
int grade_module1(f) |
int grade_module1(f) |
POLY f; |
POLY f; |
{ |
{ |
int r; |
int r; |
int i; |
int i; |
|
|
|
|
|
|
int grade_firstvec(f) /* grading by the first vector and h */ |
int grade_firstvec(f) /* grading by the first vector and h */ |
POLY f; |
POLY f; |
{ |
{ |
int r; |
int r; |
int i,k; |
int i,k; |
|
|
} |
} |
|
|
int eliminated(ff) |
int eliminated(ff) |
POLY ff; |
POLY ff; |
{ |
{ |
#define RULEMAX 10 |
#define RULEMAX 10 |
int r; |
int r; |
|
|
if (tf->e[i].x) return 0; |
if (tf->e[i].x) return 0; |
} |
} |
return(1); |
return(1); |
|
} |
|
|
|
/* Grading by the weight vector (0,1). Note 2003.07.10 |
|
dGrade1 is the grade of the in(f). |
|
*/ |
|
int dGrade1(f) |
|
POLY f; |
|
{ |
|
int r; |
|
int i; |
|
MONOMIAL tf; |
|
static int nn,mm,ll,cc,n,m,l,c; |
|
static struct ring *cr = (struct ring *)NULL; |
|
extern int *DegreeShiftD_vec; |
|
extern int DegreeShiftD_size; |
|
|
|
if (f ISZERO) return(-1); |
|
tf = f->m; |
|
if (tf->ringp != cr) { |
|
n = tf->ringp->n; |
|
m = tf->ringp->m; |
|
l = tf->ringp->l; |
|
c = tf->ringp->c; |
|
nn = tf->ringp->nn; |
|
mm = tf->ringp->mm; |
|
ll = tf->ringp->ll; |
|
cc = tf->ringp->cc; |
|
cr = tf->ringp; |
|
} |
|
|
|
r = 0; |
|
for (i=m; i<nn; i++) { |
|
r += tf->e[i].D; |
|
} |
|
if (DegreeShiftD_size > 0) { |
|
if ((tf->e[n-1].x <DegreeShiftD_size) && (tf->e[n-1].x >= 0)) { |
|
r += DegreeShiftD_vec[tf->e[n-1].x]; |
|
}else{ |
|
/* warning. out of range. */ |
|
} |
|
} |
|
return(r); |
|
} |
|
|
|
/* Grading by the weight vector (0,1). Note 2003.07.10 |
|
*/ |
|
int dGrade(f) |
|
POLY f; |
|
{ |
|
int r, first, t; |
|
if (f ISZERO) return(-1); |
|
first = 1; |
|
while (f != POLYNULL) { |
|
if (first) { |
|
r = dGrade1(f); |
|
first = 0; |
|
}else{ |
|
t = dGrade1(f); |
|
if (t > r) r = t; |
|
} |
|
} |
|
return r; |
|
} |
|
|
|
/* Grading by the weight vector (u,v) |
|
and degree shift ds. Note 2003.07.10 |
|
uvGrade1 is the grade of the in(f). |
|
ei ( element index ). If it is < 0, then e[n-1]->x will be used, |
|
else ei is used. |
|
*/ |
|
int uvGrade1(POLY f,int u[],int v[],int ds[],int dssize,int ei) |
|
{ |
|
int r; |
|
int i,t; |
|
MONOMIAL tf; |
|
static int nn,mm,ll,cc,n,m,l,c; |
|
static struct ring *cr = (struct ring *)NULL; |
|
|
|
if (f ISZERO) return(-1); |
|
tf = f->m; |
|
if (tf->ringp != cr) { |
|
n = tf->ringp->n; |
|
m = tf->ringp->m; |
|
l = tf->ringp->l; |
|
c = tf->ringp->c; |
|
nn = tf->ringp->nn; |
|
mm = tf->ringp->mm; |
|
ll = tf->ringp->ll; |
|
cc = tf->ringp->cc; |
|
cr = tf->ringp; |
|
} |
|
|
|
r = 0; |
|
for (i=0; i<n; i++) { |
|
r += (tf->e[i].x)*u[i]; |
|
r += (tf->e[i].D)*v[i]; |
|
} |
|
/* Degree shift */ |
|
if (ei <0) { |
|
t = tf->e[n-1].x; |
|
if ((t <dssize) && (t >= 0)) { |
|
r += ds[t]; |
|
}else{ |
|
/* Warning! ds[t] is assumed to be zero. */ |
|
} |
|
}else{ |
|
t = ei; |
|
if ((t <dssize) && (t >= 0)) { |
|
r += ds[t]; |
|
}else{ |
|
/* Warning! ds[t] is assumed to be zero. */ |
|
} |
|
} |
|
return(r); |
|
} |
|
|
|
/* Grading by the weight vector (u,v) |
|
and degree shift ds. Note 2003.07.10 |
|
*/ |
|
int uvGrade(POLY f,int u[],int v[],int ds[],int dssize,int ei) |
|
{ |
|
int r, first, t; |
|
if (f ISZERO) return(LARGE_NEGATIVE_NUMBER); |
|
first = 1; |
|
while (f != POLYNULL) { |
|
if (first) { |
|
r = uvGrade1(f,u,v,ds,dssize,ei); |
|
first = 0; |
|
}else{ |
|
t = uvGrade1(f,u,v,ds,dssize,ei); |
|
if (t > r) r = t; |
|
} |
|
} |
|
return r; |
} |
} |
|
|