version 1.1, 1999/10/08 02:12:02 |
version 1.6, 2001/05/04 01:06:25 |
|
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/resol.c,v 1.5 2000/07/26 02:21:30 takayama Exp $ */ |
/* resol.c */ |
/* resol.c */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
|
|
static void shellForMonomialSyz(struct monomialSyz **p,int size); |
static void shellForMonomialSyz(struct monomialSyz **p,int size); |
static struct arrayOfMonomialSyz schreyerSkelton0(struct arrayOfPOLY g,int i); |
static struct arrayOfMonomialSyz schreyerSkelton0(struct arrayOfPOLY g,int i); |
static struct arrayOfMonomialSyz putMonomialSyz(struct arrayOfMonomialSyz a, |
static struct arrayOfMonomialSyz putMonomialSyz(struct arrayOfMonomialSyz a, |
struct monomialSyz *s); |
struct monomialSyz *s); |
|
|
|
static int RemoveRedundantInSchreyerSkelton = 1; |
|
|
struct monomialSyz *newMonomialSyz(void) |
struct monomialSyz *newMonomialSyz(void) |
{ |
{ |
struct monomialSyz *s; |
struct monomialSyz *s; |
Line 41 struct arrayOfMonomialSyz enlargeArrayOfMonomialSyz(st |
|
Line 44 struct arrayOfMonomialSyz enlargeArrayOfMonomialSyz(st |
|
|
|
|
|
static struct arrayOfMonomialSyz schreyerSkelton0(struct arrayOfPOLY g,int i) |
static struct arrayOfMonomialSyz schreyerSkelton0(struct arrayOfPOLY g,int i) |
/* return value will be changed by the next call of this function. */ |
/* return value will be changed by the next call of this function. */ |
{ |
{ |
int m,j,k; |
int m,j,k,flag; |
static int s_ij_size = 0; |
static int s_ij_size = 0; |
static struct monomialSyz **s_ij = NULL; |
static struct monomialSyz **s_ij = NULL; |
struct monomialSyz *s; |
struct monomialSyz *s; |
struct spValue sv; |
struct spValue sv; |
struct arrayOfMonomialSyz ans; |
struct arrayOfMonomialSyz ans; |
|
extern int RemoveRedundantInSchreyerSkelton; |
|
/* It was 1. */ |
|
|
m = g.n; |
m = g.n; |
if (m > s_ij_size) { |
if (m > s_ij_size) { |
s_ij_size = m+1; |
s_ij_size = m+1; |
s_ij = (struct monomialSyz **)sGC_malloc(sizeof(struct monomialSyz *)* |
s_ij = (struct monomialSyz **)sGC_malloc(sizeof(struct monomialSyz *)* |
s_ij_size); |
s_ij_size); |
if (s_ij == NULL) errorGradedSet("schreyerSkelton(): no memory"); |
if (s_ij == NULL) errorGradedSet("schreyerSkelton(): no memory"); |
} |
} |
for (j=i+1; j<m; j++) { |
for (j=i+1; j<m; j++) { |
Line 69 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
Line 74 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
} |
} |
} |
} |
shellForMonomialSyz(s_ij,m-i-1); |
shellForMonomialSyz(s_ij,m-i-1); |
for (j=0; j<m-i-1;j++) { |
if (RemoveRedundantInSchreyerSkelton) { |
s = s_ij[j]; |
do { |
if (s->deleted != 1) { |
flag = 0; |
for (k=j+1; k<m-i-1; k++) { |
for (j=0; j<m-i-1;j++) { |
if (s_ij[k]->deleted != 1) { |
if (s_ij[j]->deleted != 1) { |
if ((*isReducible)(s_ij[k]->a,s->a)) s_ij[k]->deleted = 1; |
for (k=0; k<m-i-1;k++) { |
} |
if ((j != k) && (s_ij[k]->deleted != 1)) { |
|
if ((*isReducible)(s_ij[k]->a,s_ij[j]->a)) { |
|
s_ij[k]->deleted = 1; |
|
flag = 1; |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
}while (flag); |
} |
} |
ans.size = m-i-1; |
ans.size = m-i-1; |
ans.limit = s_ij_size; |
ans.limit = s_ij_size; |
Line 86 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
Line 98 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
} |
} |
|
|
static struct arrayOfMonomialSyz putMonomialSyz(struct arrayOfMonomialSyz a, |
static struct arrayOfMonomialSyz putMonomialSyz(struct arrayOfMonomialSyz a, |
struct monomialSyz *s) |
struct monomialSyz *s) |
{ |
{ |
if (a.limit <= a.size) { |
if (a.limit <= a.size) { |
a = enlargeArrayOfMonomialSyz(a); |
a = enlargeArrayOfMonomialSyz(a); |
Line 112 struct arrayOfMonomialSyz schreyerSkelton(struct array |
|
Line 124 struct arrayOfMonomialSyz schreyerSkelton(struct array |
|
ipart = schreyerSkelton0(g,i); |
ipart = schreyerSkelton0(g,i); |
for (k=0; k< ipart.size; k++) { |
for (k=0; k< ipart.size; k++) { |
if ((ipart.p)[k]->deleted != 1) { |
if ((ipart.p)[k]->deleted != 1) { |
ans = putMonomialSyz(ans,(ipart.p)[k]); |
ans = putMonomialSyz(ans,(ipart.p)[k]); |
} |
} |
} |
} |
} |
} |
Line 127 static void shellForMonomialSyz(struct monomialSyz **p |
|
Line 139 static void shellForMonomialSyz(struct monomialSyz **p |
|
for (gap = n/2; gap > 0; gap /= 2) { |
for (gap = n/2; gap > 0; gap /= 2) { |
for (i = gap; i < n; i++) { |
for (i = gap; i < n; i++) { |
for (j = i - gap ; j >= 0; j -= gap) { |
for (j = i - gap ; j >= 0; j -= gap) { |
r = (*mmLarger)(p[j+gap]->a, p[j]->a); |
r = (*mmLarger)(p[j+gap]->a, p[j]->a); |
if ( r >= 1) break; |
if ( r >= 1) break; |
temp = p[j]; |
temp = p[j]; |
p[j] = p[j+gap]; |
p[j] = p[j+gap]; |
p[j+gap] = temp; |
p[j+gap] = temp; |
} |
} |
} |
} |
} |
} |