version 1.2, 2000/01/16 07:55:39 |
version 1.4, 2001/05/04 01:06:24 |
|
|
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/order.c,v 1.3 2000/06/09 08:02:02 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
Line 21 static void warningOrder(char *s); |
|
Line 21 static void warningOrder(char *s); |
|
static void errorOrder(char *s); |
static void errorOrder(char *s); |
|
|
void setOrderByMatrix(order,n,c,l,omsize) |
void setOrderByMatrix(order,n,c,l,omsize) |
int order[]; |
int order[]; |
int n,c,l,omsize; |
int n,c,l,omsize; |
{ |
{ |
int i,j; |
int i,j; |
int *Order; |
int *Order; |
extern struct ring *CurrentRingp; |
extern struct ring *CurrentRingp; |
|
|
switch_mmLarger("default"); |
switch_mmLarger("default"); |
/* q-case */ |
/* q-case */ |
if ( l-c > 0) { |
if ( l-c > 0) { |
switch_mmLarger("qmatrix"); |
switch_mmLarger("qmatrix"); |
} |
} |
Line 46 int n,c,l,omsize; |
|
Line 46 int n,c,l,omsize; |
|
} |
} |
|
|
void showRing(level,ringp) |
void showRing(level,ringp) |
int level; |
int level; |
struct ring *ringp; |
struct ring *ringp; |
{ |
{ |
int i,j; |
int i,j; |
FILE *fp; |
FILE *fp; |
Line 81 struct ring *ringp; |
|
Line 81 struct ring *ringp; |
|
fprintf(fp,"where "); |
fprintf(fp,"where "); |
for (i=M; i<N; i++) { |
for (i=M; i<N; i++) { |
fprintf(fp," %s %s - %s %s = 1, ",TransD[i],TransX[i], |
fprintf(fp," %s %s - %s %s = 1, ",TransD[i],TransX[i], |
TransX[i],TransD[i]); |
TransX[i],TransD[i]); |
} |
} |
fprintf(fp,"\n\n"); |
fprintf(fp,"\n\n"); |
} |
} |
Line 93 struct ring *ringp; |
|
Line 93 struct ring *ringp; |
|
fprintf(fp,"where "); |
fprintf(fp,"where "); |
for (i=L; i<M; i++) { |
for (i=L; i<M; i++) { |
fprintf(fp," %s %s - %s %s = %s, ",TransD[i],TransX[i], |
fprintf(fp," %s %s - %s %s = %s, ",TransD[i],TransX[i], |
TransX[i],TransD[i], |
TransX[i],TransD[i], |
TransD[i]); |
TransD[i]); |
} |
} |
fprintf(fp,"\n\n"); |
fprintf(fp,"\n\n"); |
} |
} |
Line 106 struct ring *ringp; |
|
Line 106 struct ring *ringp; |
|
fprintf(fp,"where "); |
fprintf(fp,"where "); |
for (i=C; i<L; i++) { |
for (i=C; i<L; i++) { |
fprintf(fp," %s %s = %s %s %s, ",TransD[i],TransX[i], |
fprintf(fp," %s %s = %s %s %s, ",TransD[i],TransX[i], |
TransX[0], |
TransX[0], |
TransX[i],TransD[i]); |
TransX[i],TransD[i]); |
} |
} |
fprintf(fp,"\n\n"); |
fprintf(fp,"\n\n"); |
} |
} |
Line 166 struct ring *ringp; |
|
Line 166 struct ring *ringp; |
|
mtype = "unknown"; |
mtype = "unknown"; |
} |
} |
fprintf(fp,"Multiplication function --%s(%xH).\n", |
fprintf(fp,"Multiplication function --%s(%xH).\n", |
mtype,(unsigned int) ringp->multiplication); |
mtype,(unsigned int) ringp->multiplication); |
if (ringp->schreyer) { |
if (ringp->schreyer) { |
fprintf(fp,"schreyer=1, gbListTower="); |
fprintf(fp,"schreyer=1, gbListTower="); |
printObjectList((struct object *)(ringp->gbListTower)); |
printObjectList((struct object *)(ringp->gbListTower)); |
Line 203 if (isD(i)) D_{itod(i)} |
|
Line 203 if (isD(i)) D_{itod(i)} |
|
*/ |
*/ |
|
|
void printOrder(ringp) |
void printOrder(ringp) |
struct ring *ringp; |
struct ring *ringp; |
{ |
{ |
int i,j; |
int i,j; |
FILE *fp; |
FILE *fp; |
Line 245 struct ring *ringp; |
|
Line 245 struct ring *ringp; |
|
fprintf(fp,"\n"); |
fprintf(fp,"\n"); |
|
|
/* print D: differential DE: differential, should be eliminated |
/* print D: differential DE: differential, should be eliminated |
E: difference |
E: difference |
Q: q-difference |
Q: q-difference |
C: commutative |
C: commutative |
*/ |
*/ |
if (strcmp(F_isSameComponent,"x")== 0 || strcmp(F_isSameComponent,"xd")==0) { |
if (strcmp(F_isSameComponent,"x")== 0 || strcmp(F_isSameComponent,"xd")==0) { |
for (i=0; i<N; i++) { |
for (i=0; i<N; i++) { |
Line 316 struct object oGetOrderMatrix(struct ring *ringp) |
|
Line 316 struct object oGetOrderMatrix(struct ring *ringp) |
|
|
|
|
|
int mmLarger_matrix(ff,gg) |
int mmLarger_matrix(ff,gg) |
POLY ff; POLY gg; |
POLY ff; POLY gg; |
{ |
{ |
int exp[2*N0]; /* exponents */ |
int exp[2*N0]; /* exponents */ |
int i,k; |
int i,k; |
Line 369 POLY ff; POLY gg; |
|
Line 369 POLY ff; POLY gg; |
|
|
|
/* This should be used in case of q */ |
/* This should be used in case of q */ |
int mmLarger_qmatrix(ff,gg) |
int mmLarger_qmatrix(ff,gg) |
POLY ff; POLY gg; |
POLY ff; POLY gg; |
{ |
{ |
int exp[2*N0]; /* exponents */ |
int exp[2*N0]; /* exponents */ |
int i,k; |
int i,k; |
Line 418 POLY ff; POLY gg; |
|
Line 418 POLY ff; POLY gg; |
|
|
|
/* x(N-1)>x(N-2)>....>D(N-1)>....>D(0) */ |
/* x(N-1)>x(N-2)>....>D(N-1)>....>D(0) */ |
mmLarger_pureLexicographic(f,g) |
mmLarger_pureLexicographic(f,g) |
POLY f; |
POLY f; |
POLY g; |
POLY g; |
{ |
{ |
int i,r; |
int i,r; |
int n; |
int n; |
|
|
|
|
|
|
void setFromTo(ringp) |
void setFromTo(ringp) |
struct ring *ringp; |
struct ring *ringp; |
{ |
{ |
int n; |
int n; |
int i,j,oasize; |
int i,j,oasize; |
Line 474 struct ring *ringp; |
|
Line 474 struct ring *ringp; |
|
ringp->from[i] = 0; ringp->to[i] = n; |
ringp->from[i] = 0; ringp->to[i] = n; |
for (j=0; j<n; j++) { |
for (j=0; j<n; j++) { |
if (ringp->order[i*n+j] != 0) { |
if (ringp->order[i*n+j] != 0) { |
ringp->from[i] = j; |
ringp->from[i] = j; |
break; |
break; |
} |
} |
} |
} |
for (j=n-1; j>=0; j--) { |
for (j=n-1; j>=0; j--) { |
if (ringp->order[i*n+j] != 0) { |
if (ringp->order[i*n+j] != 0) { |
ringp->to[i] = j+1; |
ringp->to[i] = j+1; |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 490 struct ring *ringp; |
|
Line 490 struct ring *ringp; |
|
/* It ignores h and should be used with mmLarger_tower */ |
/* It ignores h and should be used with mmLarger_tower */ |
/* cf. mmLarger_matrix. h always must be checked at last. */ |
/* cf. mmLarger_matrix. h always must be checked at last. */ |
static int mmLarger_matrix_schreyer(ff,gg) |
static int mmLarger_matrix_schreyer(ff,gg) |
POLY ff; POLY gg; |
POLY ff; POLY gg; |
{ |
{ |
int exp[2*N0]; /* exponents */ |
int exp[2*N0]; /* exponents */ |
int i,k; |
int i,k; |
Line 558 int mmLarger_tower(POLY f,POLY g) { |
|
Line 558 int mmLarger_tower(POLY f,POLY g) { |
|
} |
} |
if (!(f->m->ringp->schreyer) || !(g->m->ringp->schreyer)) |
if (!(f->m->ringp->schreyer) || !(g->m->ringp->schreyer)) |
return(mmLarger_matrix(f,g)); |
return(mmLarger_matrix(f,g)); |
/* modifiable: mmLarger_qmatrix */ |
/* modifiable: mmLarger_qmatrix */ |
gbList = (struct object *)(g->m->ringp->gbListTower); |
gbList = (struct object *)(g->m->ringp->gbListTower); |
if (gbList == NULL) return(mmLarger_matrix(f,g)); |
if (gbList == NULL) return(mmLarger_matrix(f,g)); |
/* modifiable: mmLarger_qmatrix */ |
/* modifiable: mmLarger_qmatrix */ |
if (gbList->tag != Slist) { |
if (gbList->tag != Slist) { |
warningOrder("mmLarger_tower(): gbList must be in Slist.\n"); |
warningOrder("mmLarger_tower(): gbList must be in Slist.\n"); |
return(1); |
return(1); |
} |
} |
if (klength(gbList) ==0) return(mmLarger_matrix(f,g)); |
if (klength(gbList) ==0) return(mmLarger_matrix(f,g)); |
/* modifiable: mmLarger_qmatrix */ |
/* modifiable: mmLarger_qmatrix */ |
|
|
r = mmLarger_tower3(f,g,gbList); |
r = mmLarger_tower3(f,g,gbList); |
/* printf("mmLarger_tower3(%s,%s) --> %d\n",POLYToString(head(f),'*',1),POLYToString(head(g),'*',1),r); */ |
/* printf("mmLarger_tower3(%s,%s) --> %d\n",POLYToString(head(f),'*',1),POLYToString(head(g),'*',1),r); */ |
Line 598 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
Line 598 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
n = f->m->ringp->n; |
n = f->m->ringp->n; |
nn = f->m->ringp->nn; |
nn = f->m->ringp->nn; |
/* critical and modifiable */ /* m e_u > m e_v <==> m g_u > m g_v */ |
/* critical and modifiable */ /* m e_u > m e_v <==> m g_u > m g_v */ |
/* or equal and u < v */ |
/* or equal and u < v */ |
fv = f->m->e[nn].x ; /* extract component (vector) number of f! */ |
fv = f->m->e[nn].x ; /* extract component (vector) number of f! */ |
gv = g->m->e[nn].x ; |
gv = g->m->e[nn].x ; |
if (fv == gv) { /* They have the same component number. */ |
if (fv == gv) { /* They have the same component number. */ |
Line 606 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
Line 606 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
} |
} |
|
|
if (gbList == NULL) return(mmLarger_matrix_schreyer(f,g)); |
if (gbList == NULL) return(mmLarger_matrix_schreyer(f,g)); |
/* modifiable: mmLarger_qmatrix */ |
/* modifiable: mmLarger_qmatrix */ |
if (gbList->tag != Slist) { |
if (gbList->tag != Slist) { |
warningOrder("mmLarger_tower(): gbList must be in Slist.\n"); |
warningOrder("mmLarger_tower(): gbList must be in Slist.\n"); |
return(1); |
return(1); |
} |
} |
if (klength(gbList) ==0) return(mmLarger_matrix(f,g)); |
if (klength(gbList) ==0) return(mmLarger_matrix(f,g)); |
/* modifiable: mmLarger_qmatrix */ |
/* modifiable: mmLarger_qmatrix */ |
gb = car(gbList); /* each entry must be monomials */ |
gb = car(gbList); /* each entry must be monomials */ |
if (gb.tag != Sarray) { |
if (gb.tag != Sarray) { |
warningOrder("mmLarger_tower3(): car(gbList) must be an array.\n"); |
warningOrder("mmLarger_tower3(): car(gbList) must be an array.\n"); |
Line 626 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
Line 626 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
if (fv >= t || gv >= t) { |
if (fv >= t || gv >= t) { |
warningOrder("mmLarger_tower3(): incompatible input and gbList.\n"); |
warningOrder("mmLarger_tower3(): incompatible input and gbList.\n"); |
printf("Length of gb is %d, f is %s, g is %s\n",t,KPOLYToString(f), |
printf("Length of gb is %d, f is %s, g is %s\n",t,KPOLYToString(f), |
KPOLYToString(g)); |
KPOLYToString(g)); |
|
KSexecuteString(" show_ring "); |
return(1); |
return(1); |
} |
} |
/* mpMult_poly is too expensive to call. @@@*/ |
/* mpMult_poly is too expensive to call. @@@*/ |
Line 640 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
Line 641 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
} |
} |
|
|
static void warningOrder(s) |
static void warningOrder(s) |
char *s; |
char *s; |
{ |
{ |
fprintf(stderr,"Warning in order.c: %s\n",s); |
fprintf(stderr,"Warning in order.c: %s\n",s); |
} |
} |
|
|
static void errorOrder(s) |
static void errorOrder(s) |
char *s; |
char *s; |
{ |
{ |
fprintf(stderr,"order.c: %s\n",s); |
fprintf(stderr,"order.c: %s\n",s); |
exit(14); |
exit(14); |