version 1.6, 2002/09/08 10:49:50 |
version 1.11, 2004/05/13 06:30:51 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/order.c,v 1.5 2002/02/09 06:21:02 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/order.c,v 1.10 2004/05/13 04:38:28 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
Line 180 void showRing(level,ringp) |
|
Line 180 void showRing(level,ringp) |
|
printObjectList((struct object *)(ringp->gbListTower)); |
printObjectList((struct object *)(ringp->gbListTower)); |
fprintf(fp,"\n"); |
fprintf(fp,"\n"); |
} |
} |
|
if (ringp->degreeShiftSize) { |
|
fprintf(fp,"degreeShift vector (N=%d,Size=%d)= \n[\n",ringp->degreeShiftN,ringp->degreeShiftSize); |
|
{ |
|
int i,j; |
|
for (i=0; i<ringp->degreeShiftN; i++) { |
|
fprintf(fp," ["); |
|
for (j=0; j< ringp->degreeShiftSize; j++) { |
|
fprintf(fp," %d ",ringp->degreeShift[i*(ringp->degreeShiftSize)+j]); |
|
} |
|
fprintf(fp,"]\n"); |
|
} |
|
} |
|
fprintf(fp,"]\n"); |
|
} |
|
fprintf(fp,"--- weight vectors ---\n"); |
if (level) printOrder(ringp); |
if (level) printOrder(ringp); |
|
|
if (ringp->next != (struct ring *)NULL) { |
if (ringp->next != (struct ring *)NULL) { |
Line 336 int mmLarger_matrix(ff,gg) |
|
Line 350 int mmLarger_matrix(ff,gg) |
|
int in2; |
int in2; |
int *from, *to; |
int *from, *to; |
int omsize; |
int omsize; |
|
int dssize; |
|
int dsn; |
|
int *degreeShiftVector; |
|
|
if (ff == POLYNULL ) { |
if (ff == POLYNULL ) { |
if (gg == POLYNULL) return( 2 ); |
if (gg == POLYNULL) return( 2 ); |
Line 353 int mmLarger_matrix(ff,gg) |
|
Line 370 int mmLarger_matrix(ff,gg) |
|
from = rp->from; |
from = rp->from; |
to = rp->to; |
to = rp->to; |
omsize = rp->orderMatrixSize; |
omsize = rp->orderMatrixSize; |
|
if (dssize = rp->degreeShiftSize) { |
|
degreeShiftVector = rp->degreeShift; /* Note. 2003.06.26 */ |
|
dsn = rp->degreeShiftN; |
|
} |
|
|
flag = 1; |
flag = 1; |
for (i=N-1,k=0; i>=0; i--,k++) { |
for (i=N-1,k=0; i>=0; i--,k++) { |
Line 369 int mmLarger_matrix(ff,gg) |
|
Line 390 int mmLarger_matrix(ff,gg) |
|
sum = 0; in2 = i*2*N; |
sum = 0; in2 = i*2*N; |
/* for (k=0; k<2*N; k++) sum += exp[k]*Order[in2+k]; */ |
/* for (k=0; k<2*N; k++) sum += exp[k]*Order[in2+k]; */ |
for (k=from[i]; k<to[i]; k++) sum += exp[k]*Order[in2+k]; |
for (k=from[i]; k<to[i]; k++) sum += exp[k]*Order[in2+k]; |
|
if (dssize && ( i < dsn)) { /* Note, 2003.06.26 */ |
|
if ((f->e[N-1].x < dssize) && (f->e[N-1].x >= 0) && |
|
(g->e[N-1].x < dssize) && (g->e[N-1].x >= 0)) { |
|
sum += degreeShiftVector[i*dssize+ (f->e[N-1].x)] |
|
-degreeShiftVector[i*dssize+ (g->e[N-1].x)]; |
|
}else{ |
|
/*warningOrder("Size mismatch in the degree shift vector. It is ignored.");*/ |
|
} |
|
} |
if (sum > 0) return(1); |
if (sum > 0) return(1); |
if (sum < 0) return(0); |
if (sum < 0) return(0); |
} |
} |
Line 647 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
Line 677 int mmLarger_tower3(POLY f,POLY g,struct object *gbLis |
|
else if (fv > gv) return(0); /* modifiable */ |
else if (fv > gv) return(0); /* modifiable */ |
else if (fv < gv) return(1); /* modifiable */ |
else if (fv < gv) return(1); /* modifiable */ |
} |
} |
|
|
|
static struct object auxPruneZeroRow(struct object ob) { |
|
int i,m,size; |
|
struct object obt; |
|
struct object rob; |
|
m = getoaSize(ob); |
|
size=0; |
|
for (i=0; i<m; i++) { |
|
obt = getoa(ob,i); |
|
if (getoaSize(obt) != 0) size++; |
|
} |
|
if (size == m) return ob; |
|
rob = newObjectArray(size); |
|
for (i=0, size=0; i<m; i++) { |
|
obt = getoa(ob,i); |
|
if (getoaSize(obt) != 0) { |
|
putoa(rob,size,obt); size++; |
|
} |
|
} |
|
return rob; |
|
} |
|
struct object oRingToOXringStructure(struct ring *ringp) |
|
{ |
|
struct object rob,ob2; |
|
struct object obMat; |
|
struct object obV; |
|
struct object obShift; |
|
struct object obt; |
|
char **TransX; char **TransD; |
|
int n,i,j,m,p,nonzero; |
|
int *om; |
|
n = ringp->n; |
|
m = ringp->orderMatrixSize; |
|
om = ringp->order; |
|
TransX = ringp->x; TransD = ringp->D; |
|
if (m<=0) m = 1; |
|
/*test: (1). getRing /rr set rr (oxRingStructure) dc */ |
|
obMat = newObjectArray(m); |
|
for (i=0; i<m; i++) { |
|
nonzero = 0; |
|
for (j=0; j<2*n; j++) { |
|
if (om[2*n*i+j] != 0) nonzero++; |
|
} |
|
ob2 = newObjectArray(nonzero*2); |
|
nonzero=0; |
|
for (j=0; j<2*n; j++) { |
|
/* fprintf(stderr,"%d, ",nonzero); */ |
|
if (om[2*n*i+j] != 0) { |
|
if (j < n) { |
|
putoa(ob2,nonzero,KpoString(TransX[n-1-j])); nonzero++; |
|
}else{ |
|
putoa(ob2,nonzero,KpoString(TransD[n-1-(j-n)])); nonzero++; |
|
} |
|
putoa(ob2,nonzero,KpoUniversalNumber(newUniversalNumber(om[2*n*i+j]))); nonzero++; |
|
} |
|
} |
|
/* printObject(ob2,0,stderr); fprintf(stderr,".\n"); */ |
|
putoa(obMat,i,ob2); |
|
} |
|
obMat = auxPruneZeroRow(obMat); |
|
/* printObject(obMat,0,stderr); */ |
|
|
|
obV = newObjectArray(2*n); |
|
for (i=0; i<n; i++) putoa(obV,i,KpoString(TransX[n-1-i])); |
|
for (i=0; i<n; i++) putoa(obV,i+n,KpoString(TransD[n-1-i])); |
|
/* printObject(obV,0,stderr); */ |
|
|
|
if (ringp->degreeShiftSize) { |
|
/*test: |
|
[(x) ring_of_differential_operators [[(x)]] weight_vector 0 |
|
[(weightedHomogenization) 1 (degreeShift) [[1 2 1]]] ] define_ring ; |
|
(1). getRing /rr set rr (oxRingStructure) dc message |
|
*/ |
|
obShift = newObjectArray(ringp->degreeShiftN); |
|
for (i=0; i<ringp->degreeShiftN; i++) { |
|
obt = newObjectArray(ringp->degreeShiftSize); |
|
for (j=0; j< ringp->degreeShiftSize; j++) { |
|
putoa(obt,j,KpoUniversalNumber(newUniversalNumber(ringp->degreeShift[i*(ringp->degreeShiftSize)+j]))); |
|
} |
|
putoa(obShift,i,obt); |
|
} |
|
/* printObject(obShift,0,stderr); */ |
|
} |
|
|
|
p = 0; |
|
if (ringp->degreeShiftSize) { |
|
rob = newObjectArray(3); |
|
obt = newObjectArray(2); |
|
putoa(obt,0,KpoString("degreeShift")); |
|
putoa(obt,1,obShift); |
|
putoa(rob,p, obt); p++; |
|
}else { |
|
rob = newObjectArray(2); |
|
} |
|
|
|
obt = newObjectArray(2); |
|
putoa(obt,0,KpoString("v")); |
|
putoa(obt,1,obV); |
|
putoa(rob,p, obt); p++; |
|
|
|
obt = newObjectArray(2); |
|
putoa(obt,0,KpoString("order")); |
|
putoa(obt,1,obMat); |
|
putoa(rob,p, obt); p++; |
|
|
|
return(rob); |
|
} |
|
|
static void warningOrder(s) |
static void warningOrder(s) |
char *s; |
char *s; |
{ |
{ |