version 1.5, 2003/07/19 06:03:57 |
version 1.7, 2003/07/30 09:00:52 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.4 2003/07/17 23:47:44 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.6 2003/07/29 08:36:40 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "extern2.h" |
#include "extern2.h" |
Line 36 static POLY ecartCheckSyz0(POLY cf,POLY r_0,POLY syz, |
|
Line 36 static POLY ecartCheckSyz0(POLY cf,POLY r_0,POLY syz, |
|
struct gradedPolySet *gg,POLY r); |
struct gradedPolySet *gg,POLY r); |
|
|
extern int DebugReductionRed; |
extern int DebugReductionRed; |
|
int DebugReductionEcart = 0; |
|
|
/* This is used for goHomogenization */ |
/* This is used for goHomogenization */ |
extern int DegreeShifto_size; |
extern int DegreeShifto_size; |
Line 186 static struct ecartReducer ecartFindReducer(POLY r,str |
|
Line 187 static struct ecartReducer ecartFindReducer(POLY r,str |
|
} |
} |
} |
} |
|
|
if (DebugReductionRed) { |
if (DebugReductionRed || (DebugReductionEcart&1)) { |
printf("ecartFindReducer(): ell1=%d, ell2=%d, minGrade=%d, minGseti=%d, minGgi=%d\n",ell1,ell2,minGrade,minGseti,minGgi); |
printf("ecartFindReducer(): ell1=%d, ell2=%d, minGrade=%d, minGseti=%d, minGgi=%d\n",ell1,ell2,minGrade,minGseti,minGgi); |
} |
} |
if (ell1 <= ell2) { |
if (ell1 <= ell2) { |
Line 290 static POLY reduction_ecart0(r,gset,needSyz,syzp) |
|
Line 291 static POLY reduction_ecart0(r,gset,needSyz,syzp) |
|
} |
} |
} |
} |
|
|
|
if (DebugReductionEcart&1) printf("--------------------------------------\n"); |
do { |
do { |
if (DebugReductionRed) printf("r=%s\n",POLYToString(r,'*',1)); |
if (DebugReductionRed) printf("r=%s\n",POLYToString(r,'*',1)); |
|
if (DebugReductionEcart & 1) printf("r=%s+...\n",POLYToString(head(r),'*',1)); |
ells = ecartFindReducer(r,gset,gg); |
ells = ecartFindReducer(r,gset,gg); |
ell = ells.ell; |
ell = ells.ell; |
if (ell > 0) { |
if (ell > 0) { |
|
if (DebugReductionEcart & 2) printf("*"); |
if (needSyz) { |
if (needSyz) { |
gg = ecartPutPolyInG(r,gg,cf,syz); |
gg = ecartPutPolyInG(r,gg,cf,syz); |
}else{ |
}else{ |
Line 305 static POLY reduction_ecart0(r,gset,needSyz,syzp) |
|
Line 309 static POLY reduction_ecart0(r,gset,needSyz,syzp) |
|
if (ells.first) { |
if (ells.first) { |
pp = ((gset->polys[ells.grade])->gh)[ells.gseti]; |
pp = ((gset->polys[ells.grade])->gh)[ells.gseti]; |
}else{ |
}else{ |
|
if (DebugReductionEcart & 4) printf("#"); |
pp = (gg->pa)[ells.ggi]; |
pp = (gg->pa)[ells.ggi]; |
} |
} |
if (ell > 0) r = mpMult(cxx(1,0,ell,rp),r); /* r = s^ell r */ |
if (ell > 0) r = mpMult(cxx(1,0,ell,rp),r); /* r = s^ell r */ |
Line 323 static POLY reduction_ecart0(r,gset,needSyz,syzp) |
|
Line 328 static POLY reduction_ecart0(r,gset,needSyz,syzp) |
|
cf = ppAdd(cf,ppMult(cg,cf_o)); |
cf = ppAdd(cf,ppMult(cg,cf_o)); |
syz = cpMult(toSyzCoeff(cc),syz); |
syz = cpMult(toSyzCoeff(cc),syz); |
syz = ppAdd(syz,cpMult(toSyzCoeff(cg),syz_o)); |
syz = ppAdd(syz,cpMult(toSyzCoeff(cg),syz_o)); |
/* Note. 2003.07.19 */ |
/* Note. 2003.07.19 */ |
} |
} |
if (DebugReductionRed) { |
if (DebugReductionRed) { |
POLY tp; |
POLY tp; |
tp = ecartCheckSyz0(cf,r_0,syz,gset,r); |
tp = ecartCheckSyz0(cf,r_0,syz,gset,r); |
if (tp != POLYNULL) { |
if (tp != POLYNULL) { |
fprintf(stderr,"reduction_ecart0(): sygyzy is broken. Return the Current values.\n"); |
fprintf(stderr,"reduction_ecart0(): sygyzy is broken. Return the Current values.\n"); |
fprintf(stderr,"%s\n",POLYToString(tp,'*',1)); |
fprintf(stderr,"%s\n",POLYToString(tp,'*',1)); |
syzp->cf = cf; |
syzp->cf = cf; |
syzp->syz = syz; |
syzp->syz = syz; |
return r; |
return r; |
} |
} |
} |
} |
} |
} |
if (r ISZERO) goto ss; |
if (r ISZERO) goto ss; |
Line 396 static POLY reduction_ecart1(r,gset,needSyz,syzp) |
|
Line 401 static POLY reduction_ecart1(r,gset,needSyz,syzp) |
|
r = goHomogenize11(r,DegreeShifto_vec,DegreeShifto_size,-1,1); |
r = goHomogenize11(r,DegreeShifto_vec,DegreeShifto_size,-1,1); |
/* 1 means homogenize only s */ |
/* 1 means homogenize only s */ |
|
|
|
if (DebugReductionEcart&1) printf("=======================================\n"); |
do { |
do { |
if (DebugReductionRed) printf("r=%s\n",POLYToString(r,'*',1)); |
if (DebugReductionRed) printf("(ecart1(d)) r=%s\n",POLYToString(r,'*',1)); |
|
if (DebugReductionEcart & 1) printf("r=%s+,,,\n",POLYToString(head(r),'*',1)); |
|
|
ells = ecartFindReducer(r,gset,gg); |
ells = ecartFindReducer(r,gset,gg); |
ell = ells.ell; |
ell = ells.ell; |
if (ell > 0) { |
if (ell > 0) { |
|
if (DebugReductionEcart & 2) printf("%"); |
gg = ecartPutPolyInG(r,gg,POLYNULL,POLYNULL); |
gg = ecartPutPolyInG(r,gg,POLYNULL,POLYNULL); |
} |
} |
if (ell >= 0) { |
if (ell >= 0) { |
if (ells.first) { |
if (ells.first) { |
pp = ((gset->polys[ells.grade])->gh)[ells.gseti]; |
pp = ((gset->polys[ells.grade])->gh)[ells.gseti]; |
}else{ |
}else{ |
|
if (DebugReductionEcart & 4) printf("+"); |
pp = (gg->pa)[ells.ggi]; |
pp = (gg->pa)[ells.ggi]; |
} |
} |
if (ell > 0) r = mpMult(cxx(1,0,ell,rp),r); /* r = s^ell r */ |
if (ell > 0) r = mpMult(cxx(1,0,ell,rp),r); /* r = s^ell r */ |
Line 417 static POLY reduction_ecart1(r,gset,needSyz,syzp) |
|
Line 427 static POLY reduction_ecart1(r,gset,needSyz,syzp) |
|
syz = cpMult(toSyzCoeff(cc),syz); |
syz = cpMult(toSyzCoeff(cc),syz); |
syz = ppAddv(syz,toSyzPoly(cg,ells.grade,ells.gseti)); |
syz = ppAddv(syz,toSyzPoly(cg,ells.grade,ells.gseti)); |
}else{ |
}else{ |
fprintf(stderr,"It has not yet implemented.\n"); |
fprintf(stderr,"It has not yet implemented.\n"); |
exit(10); |
exit(10); |
/* BUG: not yet */ |
/* BUG: not yet */ |
} |
} |
} |
} |
Line 432 static POLY reduction_ecart1(r,gset,needSyz,syzp) |
|
Line 442 static POLY reduction_ecart1(r,gset,needSyz,syzp) |
|
syzp->cf = cf; /* cf is in the CurrentRingp */ |
syzp->cf = cf; /* cf is in the CurrentRingp */ |
syzp->syz = syz; /* syz is in the SyzRingp */ |
syzp->syz = syz; /* syz is in the SyzRingp */ |
/* BUG: dehomogenize the syzygy */ |
/* BUG: dehomogenize the syzygy */ |
fprintf(stderr,"It has not yet implemented.\n"); |
fprintf(stderr,"It has not yet implemented.\n"); |
exit(10); |
exit(10); |
} |
} |
|
|
r = goDeHomogenizeS(r); |
r = goDeHomogenizeS(r); |