Skip to content

Commit

Permalink
improvements to string theory packages and SVD complex packages, part 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestillman committed Jun 20, 2018
1 parent a584ac0 commit 785b1df
Show file tree
Hide file tree
Showing 8 changed files with 449 additions and 168 deletions.
81 changes: 78 additions & 3 deletions M2/Macaulay2/packages/AbstractToricVarieties.m2
@@ -1,3 +1,8 @@
-- TODO:
-- (1) need subToricVariety, and resulting Schubert2 notions: integral, pullback, pushforward, etc.
-- why not just use sectionZeroLocus? Because we get more information, including the fan.
-- and the map can be computed without doing a ideal quotient.
-- (2) examples, doc, tests. especially, what is the point of abstractSheaf here?
newPackage(
"AbstractToricVarieties",
Version => "0.1",
Expand All @@ -12,6 +17,8 @@ newPackage(
)

export {
"abstractPrimeToricDivisor",
"intersectionRingIdeal",
"completeIntersection",
"CompleteIntersectionInToric",
"Ambient",
Expand Down Expand Up @@ -57,13 +64,42 @@ export {
)
)

intersectionRingIdeal = method(Options => {CoefficientRing=>QQ});
intersectionRingIdeal NormalToricVariety := opts -> (X) -> (
kk := opts.CoefficientRing;
if not isSimplicial X then error "intersection ring for non-simplicial toric varieties not yet implemented";
if not X.cache#?(intersectionRingIdeal, kk) then
X.cache#(intersectionRingIdeal, kk) = (
n := # rays X;
t := getSymbol "t";
R := kk(monoid [t_0 .. t_(n-1), Join=>false]);
-- Problem: the code below won't work well if kk is not well-behaved?
B := monomialIdeal apply(max X,
L -> product(n, i -> if member(i,L) then 1_R else R_i));
M := dual B;
L := ideal(vars R * matrix rays X);
M + L
);
X.cache#(intersectionRingIdeal, kk)
)

intersectionRing NormalToricVariety := (X) -> (
I := intersectionRingIdeal X;
(ring I)/I
)

intersectionRing(NormalToricVariety, Ring) := (X, kk) -> (
I := intersectionRingIdeal(X, CoefficientRing=>kk);
(ring I)/I
)

abstractVariety(NormalToricVariety,AbstractVariety) := opts -> (Y,B) -> (
if not isSimplicial Y then error "abstract variety for non-simplicial toric varieties not yet implemented";
if not Y.cache#?(abstractVariety, B) then Y.cache#(abstractVariety,B) = (
kk := intersectionRing B;
IY := intersectionRing Y;
amb := kk[gens ambient IY, Join=>false];
IY = amb/(sub(ideal IY, vars amb));
elapsedTime IY := intersectionRing(Y, kk);
--amb := kk[gens ambient IY, Join=>false];
--IY = amb/(sub(ideal IY, vars amb));
aY := abstractVariety(dim Y, IY);
aY.TangentBundle = abstractSheaf(aY, Rank=>dim Y, ChernClass => product(gens IY, x -> 1+x));
-- Now we determine the mapping 'integral':
Expand All @@ -85,6 +121,45 @@ export {
)
abstractVariety NormalToricVariety := opts -> (Y) -> abstractVariety(Y, point)

-- create an abstract variety which is a codimension one
-- toric subvariety of a toric subvariety.
-- This is a bit HACKED UP: the reason is that for some examples,
-- the computation of the intersection ring of Y is too expensive,
-- yet the intersection ring of a codimension one toric subvariety
-- of Y is not so bad.
abstractPrimeToricDivisor = method(Options => options abstractVariety)
abstractPrimeToricDivisor(NormalToricVariety,AbstractVariety,ZZ) := opts -> (Y,B,rho) -> (
if not isSimplicial Y then error "abstract variety for non-simplicial toric varieties not yet implemented";
if not Y.cache#?(abstractVariety, B, rho) then Y.cache#(abstractVariety, B, rho) = elapsedTime (
kk := intersectionRing B;
JY := intersectionRingIdeal(Y, CoefficientRing => kk);
M := monomialIdeal select(JY_*, f -> size f == 1);
L := ideal select(JY_*, f -> size f > 1);
JD := (M : (ring JY)_rho) + L;
ID := (ring JD)/JD;
aD := abstractVariety(dim Y-1, ID);
aD.TangentBundle = abstractSheaf(aD, Rank=>dim Y-1, ChernClass => product(gens ID, x -> 1+x));
-- Now we determine the mapping 'integral':
raysY := transpose matrix rays Y;
onecone := select(1, max Y, s -> member(rho,s));
assert(#onecone == 1);
onecone = first onecone;
onecone' := sort toList((set onecone) - (set {rho}));
pt := (abs det raysY_onecone) * product(onecone', i -> ID_i);
if size pt != 1 then error "cannot define integral: some strange error has occurred";
mon := leadMonomial pt;
cf := leadCoefficient pt;
if not liftable(cf, QQ) then error "cannot create integral function";
a := 1 / lift(cf, QQ);
integral ID := (f) -> a * coefficient(mon, f);
-- a check:
--maxD := for sigma in max Y list if member(rho,sigma) then (sigma, sort toList(set sigma - set {rho})) else continue;
--assert all(maxD, f -> integral(product(f#1, i -> ID_i)) == 1/(abs(det raysY_(f#0))));
aD
);
Y.cache#(abstractVariety, B, rho)
)

abstractSheaf(NormalToricVariety, AbstractVariety, ToricDivisor) := ops -> (Y,B,D) -> (
aY := abstractVariety(Y,B);
A := intersectionRing aY;
Expand Down
14 changes: 7 additions & 7 deletions M2/Macaulay2/packages/FourTiTwo.m2
Expand Up @@ -99,7 +99,7 @@ toBinomial(Matrix,Ring) := (M,S) -> (
toricMarkov = method(Options=> {InputType => null})
toricMarkov Matrix := Matrix => o -> (A) -> (
filename := getFilename();
<< "using temporary file name " << filename << endl;
if debugLevel >= 1 then << "using temporary file name " << filename << endl;
if o.InputType === "lattice" then
F := openOut(filename|".lat")
else
Expand All @@ -116,7 +116,7 @@ toricMarkov(Matrix,Ring) := o -> (A,S) -> toBinomial(toricMarkov(A,o), S)
toricGroebner = method(Options=>{Weights=>null})
toricGroebner Matrix := o -> (A) -> (
filename := getFilename();
<< "using temporary file name " << filename << endl;
if debugLevel >= 1 then << "using temporary file name " << filename << endl;
F := openOut(filename|".mat");
putMatrix(F,A);
close F;
Expand All @@ -134,7 +134,7 @@ toricGroebner(Matrix,Ring) := o -> (A,S) -> toBinomial(toricGroebner(A,o), S)
toricCircuits = method()
toricCircuits Matrix := Matrix => (A ->(
filename := getFilename();
<< "using temporary file name " << filename << endl;
if debugLevel >= 1 then << "using temporary file name " << filename << endl;
F := openOut(filename|".mat");
putMatrix(F,A);
close F;
Expand All @@ -147,7 +147,7 @@ toricCircuits Matrix := Matrix => (A ->(
toricGraver = method()
toricGraver Matrix := Matrix => (A ->(
filename := getFilename();
<< "using temporary file name " << filename << endl;
if debugLevel >= 1 then << "using temporary file name " << filename << endl;
F := openOut(filename|".mat");
putMatrix(F,A);
close F;
Expand All @@ -161,7 +161,7 @@ toricGraver (Matrix,Ring) := Ideal => ((A,S)->toBinomial(toricGraver(A),S))
hilbertBasis = method(Options=> {InputType => null})
hilbertBasis Matrix := Matrix => o -> (A ->(
filename := getFilename();
<< "using temporary file name " << filename << endl;
if debugLevel >= 1 then << "using temporary file name " << filename << endl;
if o.InputType === "lattice" then
F := openOut(filename|".lat")
else
Expand All @@ -178,7 +178,7 @@ hilbertBasis Matrix := Matrix => o -> (A ->(
rays = method()
rays Matrix := Matrix => (A ->(
filename := getFilename();
<< "using temporary file name " << filename << endl;
if debugLevel >= 1 then << "using temporary file name " << filename << endl;
F := openOut(filename|".mat");
putMatrix(F,A);
close F;
Expand All @@ -196,7 +196,7 @@ rays Matrix := Matrix => (A ->(
toricGraverDegrees = method()
toricGraverDegrees Matrix := Matrix => (A ->(
filename := getFilename();
<< "using temporary file name " << filename << endl;
if debugLevel >= 1 then << "using temporary file name " << filename << endl;
F := openOut(filename|".mat");
putMatrix(F,A);
close F;
Expand Down
24 changes: 12 additions & 12 deletions M2/Macaulay2/packages/NonminimalComplexes.m2
Expand Up @@ -34,7 +34,7 @@ export {
debug Core
needsPackage "SVDComplexes"

{*
-*
-- The following shuold be where?
newChainComplexMap = method()
newChainComplexMap(ChainComplex, ChainComplex, HashTable) := (tar,src,maps) -> (
Expand All @@ -47,7 +47,7 @@ newChainComplexMap(ChainComplex, ChainComplex, HashTable) := (tar,src,maps) -> (
scan(goodspots, i -> f#i = if maps#?i then maps#i else map(tar_i, src_i, 0));
f
)
*}
*-

-----------------------------------------------
-- Code for nonminimal resolutions over QQ ----
Expand Down Expand Up @@ -116,10 +116,10 @@ TEST ///
-- b. allow a single multi-degree
-- constantStrand, constantStrands
-- these are from nonminimal free resolutions over QQ
{*
-*
restart
needsPackage "NonminimalComplexes"
*}
*-

R = QQ[a..e]
I = ideal(a^3, b^3, c^3, d^3, e^3, (a+b+c+d+e)^3)
Expand Down Expand Up @@ -147,7 +147,7 @@ TEST ///
=> 14, (3,{8},8) => 52, (3,{9},9) => 45, (3,{10},10) => 4, (4,{8},8) => 4, (4,{9},9) => 35, (4,{10},10) =>
52, (4,{11},11) => 14, (4,{12},12) => 4, (5,{10},10) => 9, (5,{11},11) => 29, (5,{12},12) => 10, (5,{13},13)
=> 3, (5,{14},14) => 1, (6,{12},12) => 6, (6,{13},13) => 3, (6,{14},14) => 1}
{*
-*
assert(betti'ans ==betti (C1 = getNonminimalRes(C, R1)))
assert(betti'ans == betti (C2 = getNonminimalRes(C, R2)))
assert(betti'ans == betti (C3 = getNonminimalRes(C, R3)))
Expand All @@ -156,14 +156,14 @@ TEST ///
assert(C2.dd^2 == 0)
assert(C3.dd^2 == 0)
assert(C4.dd^2 == 0)
*}
*-
///

TEST ///
{*
-*
restart
needsPackage "NonminimalComplexes"
*}
*-
R = ZZ/32003[a..e]
I = ideal(a^3, b^3, c^3, d^3, e^3, (a+b+c+d+e)^3)
C = res(ideal gens gb I, Strategy=>4.1)
Expand Down Expand Up @@ -422,7 +422,7 @@ TEST ///


end--
{*
-*
Cs2 = (constantStrands(C, RR_1000))#8
kk1 = ZZ/32003
kk2 = ZZ/1073741909
Expand All @@ -433,7 +433,7 @@ Cs2 = (constantStrands(C, RR_1000))#8
netList {{CR.dd_4, CR2.dd_4}, {Cp1.dd_4, Cp2.dd_4}}
netList{(clean(1e-14,CR)).dd_4,(clean(1e-299,CR2)).dd_4}
netList {(clean(1e-14,CR)).dd_4} == netList{(clean(1e-299,CR2)).dd_4}
*}
*-

restart
uninstallPackage "NonminimalComplexes"
Expand Down Expand Up @@ -750,13 +750,13 @@ restart
makeAGR(6,7,50,0)

I = getAGR(6,7,50,0);
{*
-*
R = QQ[a..h]
deg = 6
nextra = 30
F = sum(gens R, x -> x^deg) + sum(nextra, i -> (randomForm(1,R))^deg);
elapsedTime I = ideal fromDual matrix{{F}};
*}
*-

elapsedTime C = res(I, FastNonminimal=>true)
betti C
Expand Down

0 comments on commit 785b1df

Please sign in to comment.