version 1.5, 2000/07/26 02:21:30 |
version 1.6, 2001/05/04 01:06:25 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/resol.c,v 1.4 2000/06/26 11:15:04 takayama Exp $ */ |
/* $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; |
static int RemoveRedundantInSchreyerSkelton = 1; |
|
|
Line 44 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,flag; |
int m,j,k,flag; |
static int s_ij_size = 0; |
static int s_ij_size = 0; |
Line 59 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
Line 59 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
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 75 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
Line 75 static struct arrayOfMonomialSyz schreyerSkelton0(stru |
|
} |
} |
shellForMonomialSyz(s_ij,m-i-1); |
shellForMonomialSyz(s_ij,m-i-1); |
if (RemoveRedundantInSchreyerSkelton) { |
if (RemoveRedundantInSchreyerSkelton) { |
do { |
do { |
flag = 0; |
flag = 0; |
for (j=0; j<m-i-1;j++) { |
for (j=0; j<m-i-1;j++) { |
if (s_ij[j]->deleted != 1) { |
if (s_ij[j]->deleted != 1) { |
for (k=0; k<m-i-1;k++) { |
for (k=0; k<m-i-1;k++) { |
if ((j != k) && (s_ij[k]->deleted != 1)) { |
if ((j != k) && (s_ij[k]->deleted != 1)) { |
if ((*isReducible)(s_ij[k]->a,s_ij[j]->a)) { |
if ((*isReducible)(s_ij[k]->a,s_ij[j]->a)) { |
s_ij[k]->deleted = 1; |
s_ij[k]->deleted = 1; |
flag = 1; |
flag = 1; |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
}while (flag); |
}while (flag); |
} |
} |
ans.size = m-i-1; |
ans.size = m-i-1; |
ans.limit = s_ij_size; |
ans.limit = s_ij_size; |
Line 98 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 139 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; |
} |
} |
} |
} |
} |
} |