[BACK]Return to cohom.k CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097 / lib / minimal

Annotation of OpenXM/src/k097/lib/minimal/cohom.k, Revision 1.2

1.2     ! takayama    1: /* $OpenXM: OpenXM/src/k097/lib/minimal/cohom.k,v 1.1 2000/05/03 06:42:07 takayama Exp $ */
1.1       takayama    2:
1.2     ! takayama    3: /* k0 interface functions for cohom.sm1 */
1.1       takayama    4: def Boundp(a) {
                      5:    local b;
                      6:    sm1("[(parse) [(/) ",a," ( load tag 0 eq
                      7:                           { /FunctionValue 0 def }
                      8:                           { /FunctionValue 1 def } ifelse )] cat ] extension");
                      9: }
                     10:
                     11: def load_cohom() {
                     12:   if (Boundp("cohom.sm1.loaded")) {
                     13:   }else{
                     14:     sm1(" [(parse) (k0-cohom.sm1) pushfile ] extension ");
                     15:   }
                     16: }
                     17:
                     18: load_cohom();
                     19:
                     20: def sm1_deRham(a,b) {
                     21:   local aa,bb;
                     22:   aa = ToString(a);
                     23:   if (IsArray(b)) {
                     24:      bb = Map(b,"ToString");
                     25:   }else{
                     26:      bb = ToString(b);
                     27:   }
                     28:   sm1("[", aa,bb, " ]  deRham /FunctionValue set ");
                     29: }
                     30:
                     31:
                     32: def Weyl(v,w,p) {
                     33:   local a,L;
                     34:   L=Length(Arglist);
                     35:   if (L == 1) {
                     36:     a=RingD(v);
                     37:   } else if (L == 2) {
                     38:     a=RingD(v,w);
                     39:   }else if (L == 3) {
                     40:     a=RingD(v,w,p);
                     41:   }else{
                     42:     Println("Error: argument mismatch");
                     43:     return(null);
                     44:   }
                     45:   sm1(" define_ring_variables ");
                     46:   return(a);
                     47: }
                     48:
                     49: def sm1_pmat(a) {
                     50:   sm1(a," pmat ");
                     51: }
                     52:
                     53: Weyl("x,y");
                     54: /*  See page 8, (2.2).  */
                     55: cech=[
                     56:   [ [x*Dx],
                     57:     [y*Dy]
                     58:   ],
                     59:   [[ y*Dy, -x*Dx]]
                     60: ];
                     61:
                     62: def sm1_v_string(V) {
                     63:   if (IsArray(V)) {
                     64:     V = Map(V,"ToString");
                     65:   }else {
                     66:     V = ToString(V);
                     67:   }
                     68:   return(V);
                     69: }
                     70:
                     71: def sm1_syz(A,V,W) {
                     72:   local L,P;
                     73:   L=Length(Arglist);
                     74:   if (L == 1) {
                     75:     P = [A];
                     76:   }else if (L==2) {
                     77:     V = sm1_v_string(V);
                     78:     P = [A,V];
                     79:   }else if (L==3) {
                     80:     P = [A,V,W];
                     81:   }else {
                     82:     Println("sm1_syz: Argument mismatch");
                     83:     return(null);
                     84:   }
                     85:   sm1(P," syz /FunctionValue set");
                     86: }
                     87: /*
                     88:   sm1_syz([x*Dx,y*Dy],[x,y]):
                     89:   We want to syz_h, too.
                     90:   Step 1: Control by global variable ?  syz ==> syz_generic
                     91:   Step 2: syz and syz_h
                     92: */
                     93:
                     94: def sm1_resol1(I,V,W) {
                     95:   local P,L;
                     96:   L=Length(Arglist);
                     97:   if (L == 1) {
                     98:     P = [I];
                     99:   }else if (L==2) {
                    100:     V = sm1_v_string(V);
                    101:     P = [I,V];
                    102:   }else if (L==3) {
                    103:     P = [I,V,W];
                    104:   }else {
                    105:     Println("sm1_syz: Argument mismatch");
                    106:     return(null);
                    107:   }
                    108:   sm1(P," resol1 /FunctionValue set ");
                    109: }
                    110: /*  sm1_resol1([x^2,x*y],[x,y]):  */
                    111:
                    112: def sm1_res_solv(A,B,C) {
                    113:   local P,L;
                    114:   L=Length(Arglist);
                    115:   if (L == 2) {
                    116:     P = [A,B];
                    117:     sm1(P," res-solv /FunctionValue set");
                    118:   }else if (L==3) {
                    119:     C = sm1_v_string(C);
                    120:     P = [[A,B], C];
                    121:     sm1(P," res*solv /FunctionValue set ");
                    122:   }else{
                    123:     Println("Error: argument mismatch");
                    124:     return(null);
                    125:   }
                    126: }
                    127: /*
                    128:  sm1_res_solv(
                    129:   [[x*Dx + 2, 0],
                    130:    [Dx+3,    x^3],
                    131:    [3,      x],
                    132:    [Dx*(x*Dx + 3) - (x*Dx + 2)*(x*Dx -4), 0]],
                    133:    [1, 0], [x,y]):
                    134:
                    135:  sm1_res_solv([x,1],1,"x"):
                    136:  sm1_res_solv([x,y],y,"x,y"):
                    137: */
                    138:
                    139: def sm1_res_solv_h(A,B,C) {
                    140:   local P;
                    141:   P = [[A,B], C];
                    142:   sm1(P," res*solv*h /FunctionValue set ");
                    143: }
                    144:
                    145: def Reparse(A) {
                    146:   if (IsArray(A)) {
                    147:     return(Map(A,"Reparse"));
                    148:   }else if (IsPolynomial(A) || IsInteger(A)) {
                    149:     return(Poly(ToString(A)));
                    150:   }else{
                    151:     return(A);
                    152:   }
                    153: }
                    154:
                    155: def sm1_res_sub2Q(I,V) {
                    156:   local L,P;
                    157:   L = Length(Arglist);
                    158:   if (L == 1) {
                    159:     P = I;
                    160:   }else if ( L == 2) {
                    161:     V = sm1_v_string(V);
                    162:     if (IsArray(V)) {
                    163:       sm1(V," from_records /V set ");
                    164:     }
                    165:     Weyl(V);
                    166:     P = Reparse(I);
                    167:   }
                    168:   sm1(P," res-sub2Q /FunctionValue set ");
                    169: }
                    170:
                    171: /*
                    172:    sm1_res_sub2Q([x*Dx,Dy]):
                    173:    M res-sub2Q =: J,   M \simeq D^p/J
                    174: */
                    175:
                    176: def ex2_9() {
                    177:   Weyl("x,y,z");
                    178:   I = [ x*Dx+y*Dy+z*Dz+6,
                    179:         z^2*Dy-y^2*Dz,
                    180:         z^2*Dx-x^2*Dz,
                    181:         y^2*Dx-x^2*Dy,
                    182:         x^3*Dz+y^3*Dz+z^3*Dz+6*z^2,
                    183:         x^3*Dy+y^3*Dy+y^2*z*Dz+6*y^2];
                    184:   a = sm1_resol1(I,"x,y,z");
                    185:   return(a);
                    186: }
                    187:
1.2     ! takayama  188: def to_int0(A) {
        !           189:    local i,c,n,r;
        !           190:    if (IsArray(A)) {
        !           191:      n = Length(A);
        !           192:      r = NewArray(n);
        !           193:      for (i=0; i<n; i++) {
        !           194:        r[i] = to_int0(A[i]);
        !           195:      }
        !           196:      return(r);
        !           197:    } else if (IsInteger(A)) {
        !           198:      return(IntegerToSm1Integer(A));
        !           199:    } else {
        !           200:      return(A);
        !           201:    }
        !           202: }
        !           203: HelpAdd(["Translate.to_int0",
        !           204:  ["to_int0(a) :  as same as sm1_push_int0."]]);
        !           205:
        !           206:
        !           207: def GKZ(A,B) {
        !           208:   /* we need sm1_rat_to_p in a future. */
        !           209:   local c;
        !           210:   c = to_int0([A,B]);
        !           211:   sm1(c," gkz /FunctionValue set ");
        !           212: }
        !           213: HelpAdd(["GKZ.GKZ",
        !           214:   ["GKZ(a,b) returns the GKZ systems associated to the matrix a and the vector b",
        !           215:    "The answer is given by strings.",
        !           216:    "Example: GKZ([[1,1,1,1],[0,1,3,4]],[0,2])"]]);
        !           217:
        !           218: def Rest(a) {
        !           219:   sm1(a," rest /FunctionValue set ");
        !           220: }
        !           221: HelpAdd(["Rest",
        !           222: ["Rest(a), list a; "]]);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>