Annotation of OpenXM_contrib2/asir2000/lib/bfct, Revision 1.6
1.2 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.3 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.2 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.6 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/lib/bfct,v 1.5 2000/12/11 02:00:42 noro Exp $
1.2 noro 49: */
1.1 noro 50: /* requires 'primdec' */
51:
1.6 ! noro 52: /* annihilating ideal of F^s */
1.1 noro 53:
54: def ann(F)
55: {
56: V = vars(F);
57: W = append([y1,y2,t],V);
58: N = length(V);
59: B = [1-y1*y2,t-y1*F];
60: for ( I = N-1, DV = []; I >= 0; I-- )
61: DV = cons(strtov("d"+rtostr(V[I])),DV);
62: DW = append([dy1,dy2,dt],DV);
63: for ( I = 0; I < N; I++ ) {
64: B = cons(DV[I]+y1*diff(F,V[I])*dt,B);
65: }
66: dp_nelim(2);
1.4 noro 67: G0 = dp_weyl_gr_main(B,append(W,DW),0,0,6);
1.1 noro 68: G1 = [];
69: for ( T = G0; T != []; T = cdr(T) ) {
70: E = car(T); VL = vars(E);
71: if ( !member(y1,VL) && !member(y2,VL) )
72: G1 = cons(E,G1);
73: }
74: G2 = map(subst,G1,dt,1);
75: G3 = map(b_subst,G2,t);
76: G4 = map(subst,G3,t,-1-s);
77: return G4;
78: }
79:
1.6 ! noro 80: def indicial1(F)
! 81: {
! 82: V = vars(F);
! 83: W = append([y1,t],V);
! 84: N = length(V);
! 85: B = [t-y1*F];
! 86: for ( I = N-1, DV = []; I >= 0; I-- )
! 87: DV = cons(strtov("d"+rtostr(V[I])),DV);
! 88: DW = append([dy1,dt],DV);
! 89: for ( I = 0; I < N; I++ ) {
! 90: B = cons(DV[I]+y1*diff(F,V[I])*dt,B);
! 91: }
! 92: dp_nelim(1);
! 93: G0 = dp_weyl_gr_main(B,append(W,DW),0,0,6);
! 94: G1 = map(subst,G0,y1,1);
! 95: Mat = newmat(2,2,[[-1,1],[0,1]]);
! 96: G2 = map(psi,G1,t,dt);
! 97: G3 = map(subst,G2,t,-s-1);
! 98: return G3;
! 99: }
! 100:
! 101: def psi(F,T,DT)
! 102: {
! 103: D = dp_ptod(F,[T,DT]);
! 104: Wmax = weight(D);
! 105: D1 = dp_rest(D);
! 106: for ( ; D1; D1 = dp_rest(D1) )
! 107: if ( weight(D1) > Wmax )
! 108: Wmax = weight(D1);
! 109: for ( D1 = D, Dmax = 0; D1; D1 = dp_rest(D1) )
! 110: if ( weight(D1) == Wmax )
! 111: Dmax += dp_hm(D1);
! 112: if ( Wmax >= 0 )
! 113: Dmax = dp_weyl_mul(<<Wmax,0>>,Dmax);
! 114: else
! 115: Dmax = dp_weyl_mul(<<0,-Wmax>>,Dmax);
! 116: Rmax = dp_dtop(Dmax,[T,DT]);
! 117: R = b_subst(subst(Rmax,DT,1),T);
! 118: return R;
! 119: }
! 120:
! 121: def weight(D)
! 122: {
! 123: V = dp_etov(D);
! 124: return V[1]-V[0];
! 125: }
! 126:
! 127: def compare_first(A,B)
! 128: {
! 129: A0 = car(A);
! 130: B0 = car(B);
! 131: if ( A0 > B0 )
! 132: return 1;
! 133: else if ( A0 < B0 )
! 134: return -1;
! 135: else
! 136: return 0;
! 137: }
! 138:
1.1 noro 139: /* b-function of F ? */
140:
141: def bfct(F)
142: {
1.6 ! noro 143: G4 = indicial1(F);
1.1 noro 144: V = vars(F);
145: N = length(V);
1.6 ! noro 146: D = newvect(N);
! 147: for ( I = 0; I < N; I++ )
! 148: D[I] = [deg(F,V[I]),V[I]];
! 149: qsort(D,compare_first);
! 150: for ( V = [], I = 0; I < N; I++ )
! 151: V = cons(D[I][1],V);
1.1 noro 152: for ( I = N-1, DV = []; I >= 0; I-- )
153: DV = cons(strtov("d"+rtostr(V[I])),DV);
1.6 ! noro 154: V1 = cons(s,V); DV1 = cons(ds,DV);
! 155: G0 = dp_weyl_gr_main(G4,append(V1,DV1),0,1,0);
! 156: Minipoly = weyl_minipoly(G0,append(V1,DV1),0,s);
! 157: return Minipoly;
! 158: }
! 159:
! 160: def weyl_minipolym(G,V,O,M,V0)
! 161: {
! 162: N = length(V);
! 163: Len = length(G);
! 164: dp_ord(O);
! 165: setmod(M);
! 166: PS = newvect(Len);
! 167: PS0 = newvect(Len);
! 168:
! 169: for ( I = 0, T = G; T != []; T = cdr(T), I++ )
! 170: PS0[I] = dp_ptod(car(T),V);
! 171: for ( I = 0, T = G; T != []; T = cdr(T), I++ )
! 172: PS[I] = dp_mod(dp_ptod(car(T),V),M,[]);
! 173:
! 174: for ( I = Len - 1, GI = []; I >= 0; I-- )
! 175: GI = cons(I,GI);
! 176:
! 177: U = dp_mod(dp_ptod(V0,V),M,[]);
! 178:
! 179: T = dp_mod(<<0>>,M,[]);
! 180: TT = dp_mod(dp_ptod(1,V),M,[]);
! 181: G = H = [[TT,T]];
! 182:
! 183: for ( I = 1; ; I++ ) {
! 184: T = dp_mod(<<I>>,M,[]);
! 185:
! 186: TT = dp_weyl_nf_mod(GI,dp_weyl_mul_mod(TT,U,M),PS,1,M);
! 187: H = cons([TT,T],H);
! 188: L = dp_lnf_mod([TT,T],G,M);
! 189: if ( !L[0] )
! 190: return dp_dtop(L[1],[V0]);
! 191: else
! 192: G = insert(G,L);
! 193: }
! 194: }
! 195:
! 196: def weyl_minipoly(G0,V0,O0,V)
! 197: {
! 198: for ( I = 0; ; I++ ) {
! 199: Prime = lprime(I);
! 200: MP = weyl_minipolym(G0,V0,O0,Prime,V);
! 201: for ( D = deg(MP,V), TL = [], J = 0; J <= D; J++ )
! 202: TL = cons(V^J,TL);
! 203: dp_ord(O0);
! 204: NF = weyl_gennf(G0,TL,V0,O0)[0];
! 205:
! 206: LHS = weyl_nf_tab(-car(TL),NF,V0);
! 207: B = weyl_hen_ttob(cdr(TL),NF,LHS,V0,Prime);
! 208: if ( B ) {
! 209: R = ptozp(B[1]*car(TL)+B[0]);
! 210: return R;
! 211: }
! 212: }
! 213: }
! 214:
! 215: def weyl_gennf(G,TL,V,O)
! 216: {
! 217: N = length(V); Len = length(G); dp_ord(O); PS = newvect(Len);
! 218: for ( I = 0, T = G, HL = []; T != []; T = cdr(T), I++ ) {
! 219: PS[I] = dp_ptod(car(T),V); HL = cons(dp_ht(PS[I]),HL);
! 220: }
! 221: for ( I = 0, DTL = []; TL != []; TL = cdr(TL) )
! 222: DTL = cons(dp_ptod(car(TL),V),DTL);
! 223: for ( I = Len - 1, GI = []; I >= 0; I-- )
! 224: GI = cons(I,GI);
! 225: T = car(DTL); DTL = cdr(DTL);
! 226: H = [weyl_nf(GI,T,T,PS)];
1.1 noro 227:
1.6 ! noro 228: T0 = time()[0];
! 229: while ( DTL != [] ) {
! 230: T = car(DTL); DTL = cdr(DTL);
! 231: if ( dp_gr_print() )
! 232: print(".",2);
! 233: if ( L = search_redble(T,H) ) {
! 234: DD = dp_subd(T,L[1]);
! 235: NF = weyl_nf(GI,dp_weyl_mul(L[0],dp_subd(T,L[1])),dp_hc(L[1])*T,PS);
! 236: } else
! 237: NF = weyl_nf(GI,T,T,PS);
! 238: NF = remove_cont(NF);
! 239: H = cons(NF,H);
! 240: }
! 241: print("");
! 242: TNF = time()[0]-T0;
! 243: if ( dp_gr_print() )
! 244: print("gennf(TAB="+rtostr(TTAB)+" NF="+rtostr(TNF)+")");
! 245: return [H,PS,GI];
! 246: }
1.1 noro 247:
1.6 ! noro 248: def weyl_nf(B,G,M,PS)
! 249: {
! 250: for ( D = 0; G; ) {
! 251: for ( U = 0, L = B; L != []; L = cdr(L) ) {
! 252: if ( dp_redble(G,R=PS[car(L)]) > 0 ) {
! 253: GCD = igcd(dp_hc(G),dp_hc(R));
! 254: CG = idiv(dp_hc(R),GCD); CR = idiv(dp_hc(G),GCD);
! 255: U = CG*G-dp_weyl_mul(CR*dp_subd(G,R),R);
! 256: if ( !U )
! 257: return [D,M];
! 258: D *= CG; M *= CG;
! 259: break;
! 260: }
! 261: }
! 262: if ( U )
! 263: G = U;
! 264: else {
! 265: D += dp_hm(G); G = dp_rest(G);
! 266: }
! 267: }
! 268: return [D,M];
! 269: }
! 270:
! 271: def weyl_nf_mod(B,G,PS,Mod)
! 272: {
! 273: for ( D = 0; G; ) {
! 274: for ( U = 0, L = B; L != []; L = cdr(L) ) {
! 275: if ( dp_redble(G,R=PS[car(L)]) > 0 ) {
! 276: CR = dp_hc(G)/dp_hc(R);
! 277: U = G-dp_weyl_mul_mod(CR*dp_mod(dp_subd(G,R),Mod,[]),R,Mod);
! 278: if ( !U )
! 279: return D;
1.1 noro 280: break;
1.6 ! noro 281: }
! 282: }
! 283: if ( U )
! 284: G = U;
! 285: else {
! 286: D += dp_hm(G); G = dp_rest(G);
1.1 noro 287: }
288: }
1.6 ! noro 289: return D;
! 290: }
! 291:
! 292: def weyl_hen_ttob(T,NF,LHS,V,MOD)
! 293: {
! 294: if ( length(T) == 1 )
! 295: return car(T);
! 296: T0 = time()[0]; M = etom(weyl_leq_nf(T,NF,LHS,V)); TE = time()[0] - T0;
! 297: T0 = time()[0]; U = henleq(M,MOD); TH = time()[0] - T0;
! 298: if ( dp_gr_print() ) {
! 299: print("(etom="+rtostr(TE)+" hen="+rtostr(TH)+")");
! 300: }
! 301: return U ? vtop(T,U,LHS) : 0;
! 302: }
! 303:
! 304: def weyl_leq_nf(TL,NF,LHS,V)
! 305: {
! 306: TLen = length(NF);
! 307: T = newvect(TLen); M = newvect(TLen);
! 308: for ( I = 0; I < TLen; I++ ) {
! 309: T[I] = dp_ht(NF[I][1]);
! 310: M[I] = dp_hc(NF[I][1]);
! 311: }
! 312: Len = length(TL); INDEX = newvect(Len); COEF = newvect(Len);
! 313: for ( L = TL, J = 0; L != []; L = cdr(L), J++ ) {
! 314: D = dp_ptod(car(L),V);
! 315: for ( I = 0; I < TLen; I++ )
! 316: if ( D == T[I] )
! 317: break;
! 318: INDEX[J] = I; COEF[J] = strtov("u"+rtostr(J));
! 319: }
! 320: if ( !LHS ) {
! 321: COEF[0] = 1; NM = 0; DN = 1;
! 322: } else {
! 323: NM = LHS[0]; DN = LHS[1];
! 324: }
! 325: for ( J = 0, S = -NM; J < Len; J++ ) {
! 326: DNJ = M[INDEX[J]];
! 327: GCD = igcd(DN,DNJ); CS = DNJ/GCD; CJ = DN/GCD;
! 328: S = CS*S + CJ*NF[INDEX[J]][0]*COEF[J];
! 329: DN *= CS;
! 330: }
! 331: for ( D = S, E = []; D; D = dp_rest(D) )
! 332: E = cons(dp_hc(D),E);
! 333: BOUND = LHS ? 0 : 1;
! 334: for ( I = Len - 1, W = []; I >= BOUND; I-- )
! 335: W = cons(COEF[I],W);
! 336: return [E,W];
! 337: }
! 338:
! 339: def weyl_nf_tab(A,NF,V)
! 340: {
! 341: TLen = length(NF);
! 342: T = newvect(TLen); M = newvect(TLen);
! 343: for ( I = 0; I < TLen; I++ ) {
! 344: T[I] = dp_ht(NF[I][1]);
! 345: M[I] = dp_hc(NF[I][1]);
! 346: }
! 347: A = dp_ptod(A,V);
! 348: for ( Z = A, Len = 0; Z; Z = dp_rest(Z), Len++ );
! 349: INDEX = newvect(Len); COEF = newvect(Len);
! 350: for ( Z = A, J = 0; Z; Z = dp_rest(Z), J++ ) {
! 351: D = dp_ht(Z);
! 352: for ( I = 0; I < TLen; I++ )
! 353: if ( D == T[I] )
! 354: break;
! 355: INDEX[J] = I; COEF[J] = dp_hc(Z);
! 356: }
! 357: for ( J = 0, S = 0, DN = 1; J < Len; J++ ) {
! 358: DNJ = M[INDEX[J]];
! 359: GCD = igcd(DN,DNJ); CS = DNJ/GCD; CJ = DN/GCD;
! 360: S = CS*S + CJ*NF[INDEX[J]][0]*COEF[J];
! 361: DN *= CS;
! 362: }
! 363: return [S,DN];
1.1 noro 364: }
365:
366: def remove_zero(L)
367: {
368: for ( R = []; L != []; L = cdr(L) )
369: if ( car(L) )
370: R = cons(car(L),R);
371: return R;
372: }
373:
374: def z_subst(F,V)
375: {
376: for ( ; V != []; V = cdr(V) )
377: F = subst(F,car(V),0);
378: return F;
379: }
380:
381: def flatmf(L) {
382: for ( S = []; L != []; L = cdr(L) )
383: if ( type(F=car(car(L))) != NUM )
384: S = append(S,[F]);
385: return S;
386: }
387:
388: def member(A,L) {
389: for ( ; L != []; L = cdr(L) )
390: if ( A == car(L) )
391: return 1;
392: return 0;
393: }
394:
395: def intersection(A,B)
396: {
397: for ( L = []; A != []; A = cdr(A) )
398: if ( member(car(A),B) )
399: L = cons(car(A),L);
400: return L;
401: }
402:
403: def b_subst(F,V)
404: {
405: D = deg(F,V);
406: C = newvect(D+1);
407: for ( I = D; I >= 0; I-- )
408: C[I] = coef(F,I,V);
409: for ( I = 0, R = 0; I <= D; I++ )
410: if ( C[I] )
411: R += C[I]*v_factorial(V,I);
412: return R;
413: }
414:
415: def v_factorial(V,N)
416: {
417: for ( J = N-1, R = 1; J >= 0; J-- )
418: R *= V-J;
419: return R;
420: }
421: end$
422:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>