=================================================================== RCS file: /home/cvs/OpenXM/src/k097/lib/minimal/minimal.k,v retrieving revision 1.9 retrieving revision 1.16 diff -u -p -r1.9 -r1.16 --- OpenXM/src/k097/lib/minimal/minimal.k 2000/05/06 13:41:12 1.9 +++ OpenXM/src/k097/lib/minimal/minimal.k 2000/06/15 07:38:36 1.16 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/k097/lib/minimal/minimal.k,v 1.8 2000/05/06 10:45:43 takayama Exp $ */ +/* $OpenXM: OpenXM/src/k097/lib/minimal/minimal.k,v 1.15 2000/06/14 07:44:05 takayama Exp $ */ #define DEBUG 1 /* #define ORDINARY 1 */ /* If you run this program on openxm version 1.1.2 (FreeBSD), @@ -6,7 +6,7 @@ ln -s /usr/bin/cpp /lib/cpp */ #define OFFSET 0 -#define TOTAL_STRATEGY +#define TOTAL_STRATEGY 1 /* #define OFFSET 20*/ /* Test sequences. Use load["minimal.k"];; @@ -132,13 +132,25 @@ sm1(" [(AvoidTheSameRing)] pushEnv [ [(AvoidTheSameRing) 0] system_variable [(gbListTower) tower (list) dc] system_variable ] pop popEnv "); + /* sm1("(hoge) message show_ring "); */ } def SresolutionFrameWithTower(g,opt) { local gbTower, ans, ff, count, startingGB, opts, skelton,withSkel, autof, - gbasis; + gbasis, nohomog; + nohomog = false; + count = -1; if (Length(Arglist) >= 2) { - if (IsInteger(opt)) count = opt; + if (IsInteger(opt)) { + count = opt; + }else if (IsString(opt)) { + if (opt == "homogenized") { + nohomog = true; + }else{ + Println("Warning: unknown option"); + Println(opt); + } + } }else{ count = -1; } @@ -152,7 +164,12 @@ def SresolutionFrameWithTower(g,opt) { */ sm1(" (mmLarger) (matrix) switch_function "); - g = Map(g,"Shomogenize"); + if (! nohomog) { + Println("Automatic homogenization."); + g = Map(g,"Shomogenize"); + }else{ + Println("No automatic homogenization."); + } if (SonAutoReduce) { sm1("[ (AutoReduce) ] system_variable /autof set "); sm1("[ (AutoReduce) 1 ] system_variable "); @@ -192,12 +209,13 @@ def SresolutionFrameWithTower(g,opt) { } HelpAdd(["SresolutionFrameWithTower", ["It returs [resolution of the initial, gbTower, skelton, gbasis]", + "option: \"homogenized\" (no automatic homogenization) ", "Example: Sweyl(\"x,y\");", " a=SresolutionFrameWithTower([x^3,x*y,y^3-1]);"]]); def SresolutionFrame(f,opt) { local ans; - ans = SresolutionFrameWithTower(f); + ans = SresolutionFrameWithTower(f,opt); return(ans[0]); } /* ---------------------------- */ @@ -291,7 +309,10 @@ def Sres0FrameWithSkelton(g) { def StotalDegree(f) { - sm1(" [(grade) f] gbext (universalNumber) dc /FunctionValue set "); + local d0; + sm1(" [(grade) f] gbext (universalNumber) dc /d0 set "); + /* Print("degree of "); Print(f); Print(" is "); Println(d0); */ + return(d0); } /* Sord_w(x^2*Dx*Dy,[x,-1,Dx,1]); */ @@ -359,6 +380,10 @@ def Sdegree(f,tower,level) { def SgenerateTable(tower) { local height, n,i,j, ans, ans_at_each_floor; + + /* + Print("SgenerateTable: tower=");Println(tower); + sm1(" print_switch_status "); */ height = Length(tower); ans = NewArray(height); for (i=0; i The betti numbers are 3, 2. @@ -1080,6 +1176,15 @@ def Sannfs3(f) { */ +def Sannfs3_laScala2(f) { + local p,pp; + p = Sannfs(f,"x,y,z"); + sm1(" p 0 get { [(x) (y) (z) (Dx) (Dy) (Dz)] laplace0 } map /p set "); + Sweyl("x,y,z",[["x",1,"y",1,"z",1,"Dx",1,"Dy",1,"Dz",1,"h",1], + ["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]]); + pp = Map(p,"Spoly"); + return(Sminimal(pp)); +} /* The below does not use LaScala-Stillman's algorithm. */ @@ -1095,6 +1200,10 @@ def Sschreyer(g) { rf = SresolutionFrameWithTower(g); redundant_seq = 1; redundant_seq_ordinary = 1; tower = rf[1]; + Println("Generating reduction table which gives an order of reduction."); + Println("But, you are in Sschreyer...., you may not use LaScala-Stillman"); + Print("WeghtOfSweyl="); Println(WeightOfSweyl); + Print("tower"); Println(tower); reductionTable = SgenerateTable(tower); skel = rf[2]; redundantTable = SnewArrayOfFormat(rf[1]); @@ -1274,6 +1383,8 @@ def SpairAndReduction2(skel,level,ii,freeRes,tower,ww, tower2 = StowerOf(tower,level-1); SsetTower(tower2); + Println(["level=",level]); + Println(["tower2=",tower2]); /** sm1(" show_ring "); */ gi = Stoes_vec(bases[i]); @@ -1331,20 +1442,48 @@ def SpairAndReduction2(skel,level,ii,freeRes,tower,ww, Print("vdegree of the original = "); Println(vdeg); Print("vdegree of the remainder = "); Println(vdeg_reduced); + if (!IsNull(vdeg_reduced)) { + if (vdeg_reduced < vdeg) { + Println("--- Special in V-minimal!"); + Println(tmp[0]); + Println("syzygy="); sm1_pmat(t_syz); + Print("[vdeg, vdeg_reduced] = "); Println([vdeg,vdeg_reduced]); + } + } + + SsetTower(StowerOf(tower,level)); pos = SwhereInTower(syzHead,tower[level]); + + SsetTower(StowerOf(tower,level-1)); pos2 = SwhereInTower(tmp[0],tower[level-1]); ans = [tmp[0],t_syz,pos,pos2,vdeg,vdeg_reduced,c2]; /* pos is the place to put syzygy at level. */ /* pos2 is the place to put a new GB at level-1. */ Println(ans); - Println(" "); + Println("--- end of SpairAndReduction2 "); return(ans); } +HelpAdd(["Sminimal_v", +["It constructs the V-minimal free resolution from the Schreyer resolution", + "step by step.", + "This code still contains bugs. It sometimes outputs wrong answer.", + "Example: Sweyl(\"x,y\",[[\"x\",-1,\"y\",-1,\"Dx\",1,\"Dy\",1]]);", + " v=[[2*x*Dx + 3*y*Dy+6, 0],", + " [3*x^2*Dy + 2*y*Dx, 0],", + " [0, x^2+y^2],", + " [0, x*y]];", + " a=Sminimal_v(v);", + " sm1_pmat(a[0]); b=a[0]; b[1]*b[0]:", + "Note: a[0] is the V-minimal resolution. a[3] is the Schreyer resolution."]]); + +/* This code still contains bugs. It sometimes outputs wrong answer. */ +/* See test12() in minimal-test.k. */ +/* There may be remaining 1, too */ def Sminimal_v(g) { local r, freeRes, redundantTable, reducer, maxLevel, minRes, seq, maxSeq, level, betti, q, bases, dr, - betti_levelplus, newbases, i, j,qq; + betti_levelplus, newbases, i, j,qq,tminRes; r = Sschreyer(g); sm1_pmat(r); Debug_Sminimal_v = r; @@ -1399,10 +1538,255 @@ def Sminimal_v(g) { } } } - return([Stetris(minRes,redundantTable), + tminRes = Stetris(minRes,redundantTable); + return([SpruneZeroRow(tminRes), tminRes, [ minRes, redundantTable, reducer,r[3],r[4]],r[0]]); /* r[4] is the redundantTable_ordinary */ /* r[0] is the freeResolution */ } /* Sannfs2("x*y*(x-y)*(x+y)"); is a test problem */ +/* x y (x+y-1)(x-2), x^3-y^2, x^3 - y^2 z^2, + x y z (x+y+z-1) seems to be interesting, because the first syzygy + contains 1. +*/ + +def CopyArray(m) { + local ans,i,n; + if (IsArray(m)) { + n = Length(m); + ans = NewArray(n); + for (i=0; i (homogenized Weyl algebra)", + "cf. ReParse" +]]); + +def ReParse(a) { + local c; + if (IsArray(a)) { + c = Map(a,"ReParse"); + }else{ + sm1(a," toString . /c set"); + } + return(c); +} +HelpAdd(["ReParse", +["Reparse(obj): obj", + "It parses the given object in the current ring.", + "Outputs from SlaScala, Sschreyer may cause a trouble in other functions,", + "because it uses the Schreyer order.", + "In this case, ReParse the outputs from these functions.", + "cf. IsExaxt_h" +]]); + +def ScheckIfSchreyer(s) { + local ss; + sm1(" (report) (grade) switch_function /ss set "); + if (ss != "module1v") { + Print("ScheckIfSchreyer: from "); Println(s); + Error("grade is not module1v"); + } + /* + sm1(" (report) (mmLarger) switch_function /ss set "); + if (ss != "tower") { + Print("ScheckIfSchreyer: from "); Println(s); + Error("mmLarger is not tower"); + } + */ + sm1(" [(Schreyer)] system_variable (universalNumber) dc /ss set "); + if (ss != 1) { + Print("ScheckIfSchreyer: from "); Println(s); + Error("Schreyer order is not set."); + } + /* More check will be necessary. */ + return(true); +} \ No newline at end of file