| version 1.27, 2000/08/16 22:38:52 |
version 1.36, 2007/07/03 22:28:11 |
|
|
| /* $OpenXM: OpenXM/src/k097/lib/minimal/minimal.k,v 1.26 2000/08/10 02:59:08 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/k097/lib/minimal/minimal.k,v 1.35 2007/07/03 22:05:46 takayama Exp $ */ |
| #define DEBUG 1 |
#define DEBUG 1 |
| Sordinary = false; |
Sordinary = false; |
| /* If you run this program on openxm version 1.1.2 (FreeBSD), |
/* If you run this program on openxm version 1.1.2 (FreeBSD), |
|
|
| |
|
| */ |
*/ |
| |
|
| |
/* We cannot use load command in the if statement. */ |
| |
load("lib/minimal/cohom.k"); |
| |
Load_sm1(["k0-tower.sm1","lib/minimal/k0-tower.sm1"],"k0-tower.sm1.loaded"); |
| |
Load_sm1(["new.sm1","lib/minimal/new.sm1"],"new.sm1.loaded"); |
| |
sm1(" oxNoX "); |
| |
|
| load("cohom.k"); |
|
| def load_tower() { |
|
| if (Boundp("k0-tower.sm1.loaded")) { |
|
| }else{ |
|
| sm1(" [(parse) (k0-tower.sm1) pushfile ] extension "); |
|
| sm1(" [(parse) (new.sm1) pushfile ] extension "); |
|
| sm1(" /k0-tower.sm1.loaded 1 def "); |
|
| } |
|
| sm1(" oxNoX "); |
|
| } |
|
| load_tower(); |
|
| SonAutoReduce = true; |
SonAutoReduce = true; |
| def Factor(f) { |
def Factor(f) { |
| sm1(f, " fctr /FunctionValue set"); |
sm1(f, " fctr /FunctionValue set"); |
|
|
| HelpAdd(["Max", |
HelpAdd(["Max", |
| ["Max(v) returns the maximal element in v."]]); |
["Max(v) returns the maximal element in v."]]); |
| |
|
| |
def Kernel(f,v) { |
| |
local ans; |
| |
/* v : string or ring */ |
| |
if (Length(Arglist) < 2) { |
| |
sm1(" [f] syz /ans set "); |
| |
}else{ |
| |
sm1(" [f v] syz /ans set "); |
| |
} |
| |
return(ans); |
| |
} |
| |
def Syz(f) { |
| |
sm1(" [f] syz /FunctionValue set "); |
| |
} |
| |
HelpAdd(["Kernel", |
| |
["Kernel(f) returns the syzygy of f.", |
| |
"Return value [b, c]: b is a set of generators of the syzygies of f", |
| |
" : c=[gb, backward transformation, syzygy without", |
| |
" dehomogenization", |
| |
"Example: Weyl(\"x,y\",[[\"x\",-1,\"Dx\",1]]); ", |
| |
" s=Kernel([x*Dx+1,Dx^2+x^5]); s[0]:"]]); |
| |
/* cf. sm1_syz in cohom.k */ |
| |
def Gb(f) { |
| |
sm1(" [f] gb /FunctionValue set "); |
| |
} |
| |
HelpAdd(["Gb", |
| |
["Gb(f) returns the Groebner basis of f.", |
| |
"cf. Kernel, Weyl."]]); |
| |
|
| |
|
| /* End of standard functions that should be moved to standard libraries. */ |
/* End of standard functions that should be moved to standard libraries. */ |
| def test0() { |
def test0() { |
| local f; |
local f; |
|
|
| } |
} |
| |
|
| |
|
| |
|
| def Sweyl(v,w) { |
def Sweyl(v,w) { |
| /* extern WeightOfSweyl ; */ |
/* extern WeightOfSweyl ; */ |
| local ww,i,n; |
local ww,i,n; |
| Line 224 def StoTower() { |
|
| Line 246 def StoTower() { |
|
| } |
} |
| |
|
| def SsetTower(tower) { |
def SsetTower(tower) { |
| sm1(" [(AvoidTheSameRing)] pushEnv |
sm1(" [(AvoidTheSameRing)] pushEnv \ |
| [ [(AvoidTheSameRing) 0] system_variable |
[ [(AvoidTheSameRing) 0] system_variable \ |
| [(gbListTower) tower (list) dc] system_variable |
[(gbListTower) tower (list) dc] system_variable \ |
| ] pop popEnv "); |
] pop popEnv "); |
| /* sm1("(hoge) message show_ring "); */ |
/* sm1("(hoge) message show_ring "); */ |
| } |
} |
| Line 336 def NewPolynomialVector(size) { |
|
| Line 358 def NewPolynomialVector(size) { |
|
| } |
} |
| |
|
| def SturnOffHomogenization() { |
def SturnOffHomogenization() { |
| sm1(" |
sm1(" \ |
| [(Homogenize)] system_variable 1 eq |
[(Homogenize)] system_variable 1 eq \ |
| { Sverbose { |
{ Sverbose { \ |
| (Warning: Homogenization and ReduceLowerTerms options are automatically turned off.) message } { } ifelse |
(Warning: Homogenization and ReduceLowerTerms options are automatically turned off.) message } { } ifelse \ |
| [(Homogenize) 0] system_variable |
[(Homogenize) 0] system_variable \ |
| [(ReduceLowerTerms) 0] system_variable |
[(ReduceLowerTerms) 0] system_variable \ |
| } { } ifelse |
} { } ifelse \ |
| "); |
"); |
| } |
} |
| /* NOTE!!! Be careful these changes of global environmental variables. |
/* NOTE!!! Be careful these changes of global environmental variables. |
| Line 350 def SturnOffHomogenization() { |
|
| Line 372 def SturnOffHomogenization() { |
|
| after computation and interruption. August 15, 2000. |
after computation and interruption. August 15, 2000. |
| */ |
*/ |
| def SturnOnHomogenization() { |
def SturnOnHomogenization() { |
| sm1(" |
sm1(" \ |
| [(Homogenize)] system_variable 0 eq |
[(Homogenize)] system_variable 0 eq \ |
| { Sverbose { |
{ Sverbose { \ |
| (Warning: Homogenization and ReduceLowerTerms options are automatically turned ON.) message } { } ifelse |
(Warning: Homogenization and ReduceLowerTerms options are automatically turned ON.) message } { } ifelse \ |
| [(Homogenize) 1] system_variable |
[(Homogenize) 1] system_variable \ |
| [(ReduceLowerTerms) 1] system_variable |
[(ReduceLowerTerms) 1] system_variable \ |
| } { } ifelse |
} { } ifelse \ |
| "); |
"); |
| } |
} |
| |
|
| Line 987 HelpAdd(["Sminimal", |
|
| Line 1009 HelpAdd(["Sminimal", |
|
| " Sweyl(\"x,y\",[[\"x\",-1,\"y\",-1,\"Dx\",1,\"Dy\",1]]);", |
" Sweyl(\"x,y\",[[\"x\",-1,\"y\",-1,\"Dx\",1,\"Dy\",1]]);", |
| " b = ReParse(a[0]); sm1_pmat(b); ", |
" b = ReParse(a[0]); sm1_pmat(b); ", |
| " IsExact_h(b,[x,y]):", |
" IsExact_h(b,[x,y]):", |
| "Note: a[0] is the V-minimal resolution. a[3] is the Schreyer resolution."]]); |
"Note: a[0] is the V-minimal resolution. a[3] is the Schreyer resolution.", |
| |
" ---> D^{m_3} --b[2]--> D^{m_2} --b[1]--> D^{m_1} --b[0]--> D^{m_0} ", |
| |
" Here D^{m_i} are the set of row vectors. " |
| |
]]); |
| |
|
| def Sminimal(g,opt) { |
def Sminimal(g,opt) { |
| local r, freeRes, redundantTable, reducer, maxLevel, |
local r, freeRes, redundantTable, reducer, maxLevel, |
| Line 1006 def Sminimal(g,opt) { |
|
| Line 1031 def Sminimal(g,opt) { |
|
| redundantTable = r[1]; |
redundantTable = r[1]; |
| reducer = r[2]; |
reducer = r[2]; |
| bettiTable = SbettiTable(redundantTable); |
bettiTable = SbettiTable(redundantTable); |
| Sprintln2("Betti numbers are ------"); |
Sprintln2("BettiTable ------"); |
| if (Sverbose || Sverbose2) {sm1_pmat(bettiTable);} |
if (Sverbose || Sverbose2) {sm1_pmat(bettiTable);} |
| minRes = SnewArrayOfFormat(freeRes); |
minRes = SnewArrayOfFormat(freeRes); |
| seq = 0; |
seq = 0; |
| Line 1070 def Sminimal(g,opt) { |
|
| Line 1095 def Sminimal(g,opt) { |
|
| Println("0: minimal resolution, 3: Schreyer resolution "); |
Println("0: minimal resolution, 3: Schreyer resolution "); |
| Println("------------ Resolution Summary --------------"); |
Println("------------ Resolution Summary --------------"); |
| Print("Betti numbers : "); |
Print("Betti numbers : "); |
| Println(Map(ansSminimal[0],"Length")); |
Println(Join([Length(ansSminimal[0,0,0])],Map(ansSminimal[0],"Length"))); |
| Print("Betti numbers of the Schreyer frame: "); |
Print("Betti numbers of the Schreyer frame: "); |
| Println(Map(ansSminimal[3],"Length")); |
Println(Join([Length(ansSminimal[3,0,0])],Map(ansSminimal[3],"Length"))); |
| Println("-----------------------------------------------"); |
Println("-----------------------------------------------"); |
| |
|
| sm1(" restoreEnvAfterResolution "); |
sm1(" restoreEnvAfterResolution "); |
| Line 1454 HelpAdd(["IsSameIdeal_h", |
|
| Line 1479 HelpAdd(["IsSameIdeal_h", |
|
| "cf. ReParse" |
"cf. ReParse" |
| ]]); |
]]); |
| |
|
| def ReParse(a) { |
/* |
| local c; |
Output of S* functions may cause a trouble because it uses Schreyer orders. |
| if (IsArray(a)) { |
In this case, use ReParse(). |
| 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) { |
def ScheckIfSchreyer(s) { |
| local ss; |
local ss; |
| Line 1509 HelpAdd(["SgetShift", |
|
| Line 1521 HelpAdd(["SgetShift", |
|
| def SgetShifts(resmat,w) { |
def SgetShifts(resmat,w) { |
| local i,n,ans,m0; |
local i,n,ans,m0; |
| n = Length(resmat); |
n = Length(resmat); |
| ans = NewArray(n); |
ans = NewArray(n+1); |
| m0 = NewArray(Length(resmat[0,0])); |
m0 = NewArray(Length(resmat[0,0])); |
| ans[0] = m0; |
ans[0] = m0; |
| for (i=0; i<n-1; i++) { |
for (i=0; i<n; i++) { |
| ans[i+1] = SgetShift(resmat[i],w,m0); |
ans[i+1] = SgetShift(resmat[i],w,m0); |
| m0 = ans[i+1]; |
m0 = ans[i+1]; |
| } |
} |
| Line 1564 def SbettiTable(rtable) { |
|
| Line 1576 def SbettiTable(rtable) { |
|
| ans[i] = pp; |
ans[i] = pp; |
| } |
} |
| return(ans); |
return(ans); |
| } |
|
| |
|
| |
} |
| |
|
| |
def BfRoots1(G,V) { |
| |
local bb,ans; |
| |
sm1(" /BFparlist [ ] def "); |
| |
if (IsString(V)) { |
| |
sm1(" [ V to_records pop ] /V set "); |
| |
}else { |
| |
sm1(" V { toString } map /V set "); |
| |
} |
| |
sm1(" /BFvarlist V def "); |
| |
|
| |
sm1(" G flatten { toString } map /G set "); |
| |
sm1(" G V bfm /bb set "); |
| |
if (IsSm1Integer(bb)) { |
| |
return([ ]); |
| |
} |
| |
sm1(" bb 0 get findIntegralRoots { (universalNumber) dc } map /ans set "); |
| |
return([ans, bb]); |
| |
} |
| |
|
| |
HelpAdd(["BfRoots1", |
| |
["BfRoots1(g,v) returns the integral roots of g with respect to the weight", |
| |
"vector (1,1,...,1) and the b-function itself", |
| |
"Example: BfRoots1([x*Dx-2, y*Dy-3],[x,y]);" |
| |
]]); |
| |
|
| |
|
| |
|