Annotation of OpenXM/src/asir-contrib/testing/noro/mpmat.rr, Revision 1.2
1.2 ! noro 1: def printsys(F,V,Name) {
! 2: D = map(dp_ptod,F,V);
! 3: output(Name);
! 4: print(length(V),0); print(" ",0); print(length(F));
! 5: map(printpoly,D);
! 6: output();
! 7: }
! 8:
! 9: def printpoly(F)
! 10: {
! 11: for ( I = 0, T = F; T; T = dp_rest(T), I++ );
! 12: print(I);
! 13: for ( T = F; T; T = dp_rest(T) ) {
! 14: print(dp_hc(T),0); print(" ",0); print(dp_etov(dp_ht(T)));
! 15: }
! 16: }
! 17:
! 18: def allmat(F,V,O,Name) {
! 19: printsys(F,V,Name);
! 20: G = nd_gr_trace(F,V,1,1,O);
! 21: N = length(V);
! 22: T = ttttt;
! 23: for ( I = 0; I < N; I++ ) {
! 24: NameI = Name+rtostr(I+1);
! 25: UI = minipoly_mat(G,V,O,V[I],T);
! 26: utabout(UI,NameI);
! 27: }
! 28: }
! 29:
1.1 noro 30: def utabout(U,Name)
31: {
32: output(Name);
33: M = U[0][0];
34: D = U[0][1];
35: F = U[1];
36: N = size(M)[0];
37: for ( I = 0; I < N; I++ ) {
38: for ( J = 0; J < N; J++ ) { print(M[I][J],0); print(" ",0); }
39: print("");
40: }
41: print("");
42: print(D);
43: print("");
44: for ( D = deg(F,var(F)), I = 0; I <= D; I++ ) {
45: print(I,0); print(" ",0); print(coef(F,I));
46: }
47: output();
48: }
49:
50: def minipoly_mat(G,V,O,V1,V0)
51: {
52: if ( !zero_dim(hmlist(G,V,O),V,O) )
53: error("tolex : ideal is not zero-dimensional!");
54:
55: N = length(V);
56: dp_ord(O);
57:
58: HM = hmlist(G,V,O);
59: MB = dp_mbase(map(dp_ptod,HM,V));
60: Mat = utabtomat(G,V,V1,MB);
61:
62: for ( J = 0; ; J++ ) {
63: M = lprime(J);
64: if ( !valid_modulus(HM,M) )
65: continue;
66: MP = minipolym(G,V,O,V1,V0,M);
67: MP = subst(MP,V0,V1);
68: for ( D = deg(MP,V1), TL = [], J = 0; J <= D; J++ )
69: TL = cons(V1^J,TL);
70: NF = gennf(G,TL,V,O,V1,1)[0];
71: R = tolex_main(V,O,NF,[MP],M,MB);
1.2 ! noro 72: return [Mat,sqpart(subst(ptozp(R[0]),V1,V0))];
1.1 noro 73: }
74: }
75:
76: def utabtomat(G,V,V1,MB)
77: {
78: Len = length(G); PS = vector(Len);
79: for ( I = 0, T = G; T != []; T = cdr(T), I++ ) PS[I] = dp_ptod(car(T),V);
80: for ( I = Len - 1, GI = []; I >= 0; I-- ) GI = cons(I,GI);
81: N = length(MB);
82: U = dp_ptod(V1,V);
83: UTAB = newvect(N);
84: for ( I = 0; I < N; I++ ) {
85: UTAB[I] = [MB[I],remove_cont(dp_true_nf(GI,U*MB[I],PS,1))];
86: if ( dp_gr_print() )
87: print(".",2);
88: }
89: if ( dp_gr_print() )
90: print("");
91:
92: M = matrix(N,N);
93: for ( I = 0, LCM = 1; I < N; I++ ) LCM = ilcm(UTAB[I][1][1],LCM);
94: for ( I = 0; I < N; I++ ) {
95: F = UTAB[I][1][0]; Mul = LCM/UTAB[I][1][1];
96: for ( K = 0; K < N; K++ )
97: if ( MB[K] == dp_ht(F) ) {
98: M[K][I] = Mul*dp_hc(F);
99: F = dp_rest(F);
100: }
101: }
102: return [M,LCM];
103: }
1.2 ! noro 104:
! 105: def sqpart(F)
! 106: {
! 107: G = gcd(F,diff(F,var(F)));
! 108: return sdiv(F,G);
! 109: }
1.1 noro 110: end$
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>