Skip to content

Commit 6bec852

Browse files
Merge branch 'pr-249' into devel
* pr-249: Minor adjustment in new extended method for CoxRing Added examples on new constructor to the docu Added convenient methods for construction of toric varieties Added tests to exemplify the new ways in which a Cox ring can be created Extended method CoxRing of toric varieties
2 parents cc25353 + 7c2b36b commit 6bec852

File tree

4 files changed

+177
-33
lines changed

4 files changed

+177
-33
lines changed

ToricVarieties/doc/Doc.autodoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Sebastian Gutsche
2929
@Subsection A smooth, complete toric variety which is not projective
3030
@InsertSystem nonprojective
3131

32+
@Subsection Convenient construction of toric varieties
33+
@InsertSystem ConvenientConstructors
34+
3235
@Chapter Toric subvarieties
3336

3437
@Chapter Affine toric varieties

ToricVarieties/examples/examplesmanual/P1P1.g

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,67 @@ IsSmooth( P1 );
5252
#! true
5353
Dimension( P1 );
5454
#! 1
55+
CoxRing( P1, "q" );
56+
#! Q[q_1,q_2]
57+
#! (weights: [ 1, 1 ])
5558
P1xP1 := P1*P1;
5659
#! <A projective smooth toric variety of dimension 2 which is a product
5760
#! of 2 toric varieties>
5861
ByASmallerPresentation( ClassGroup( P1xP1 ) );
5962
#! <A free left module of rank 2 on free generators>
60-
CoxRing( P1xP1 );
61-
#! Q[x_1,x_2,x_3,x_4]
63+
CoxRing( P1xP1, "x1,y1,y2,x2" );
64+
#! Q[x1,y1,y2,x2]
6265
#! (weights: [ ( 0, 1 ), ( 1, 0 ), ( 1, 0 ), ( 0, 1 ) ])
6366
Display( SRIdeal( P1xP1 ) );
64-
#! x_1*x_4,
65-
#! x_2*x_3
67+
#! x1*x2,
68+
#! y1*y2
6669
#!
6770
#! A (left) ideal generated by the 2 entries of the above matrix
6871
#!
6972
#! (graded, degrees of generators: [ ( 0, 2 ), ( 2, 0 ) ])
7073
Display( IrrelevantIdeal( P1xP1 ) );
71-
#! x_1*x_2,
72-
#! x_1*x_3,
73-
#! x_2*x_4,
74-
#! x_3*x_4
74+
#! x1*y1,
75+
#! x1*y2,
76+
#! y1*x2,
77+
#! y2*x2
7578
#!
7679
#! A (left) ideal generated by the 4 entries of the above matrix
7780
#!
7881
#! (graded, degrees of generators: [ ( 1, 1 ), ( 1, 1 ), ( 1, 1 ), ( 1, 1 ) ])
7982
#! @EndExample
83+
84+
85+
86+
#! @System ConvenientConstructors
87+
88+
#! @Example
89+
rays := [ [1,0],[-1,0],[0,1],[0,-1] ];
90+
#! [ [ 1, 0 ], [ -1, 0 ], [ 0, 1 ], [ 0, -1 ] ]
91+
cones := [ [1,3],[1,4],[2,3],[2,4] ];
92+
#! [ [1,3],[1,4],[2,3],[2,4] ]
93+
weights := [ [1,0],[1,0],[0,1],[0,1] ];
94+
#! [ [1,0],[1,0],[0,1],[0,1] ]
95+
weights2 := [ [1,1],[1,1],[1,2],[1,2] ];
96+
#! [ [1,1],[1,1],[1,2],[1,2] ]
97+
tor1 := ToricVariety( rays, cones, weights, "x1,x2,y1,y2" );
98+
#! <A toric variety of dimension 2>
99+
CoxRing( tor1 );
100+
#! Q[x2,y2,y1,x1]
101+
#! (weights: [ ( 1, 0 ), ( 0, 1 ), ( 0, 1 ), ( 1, 0 ) ])
102+
tor2:= ToricVariety( rays, cones, weights, "q" );
103+
#! <A toric variety of dimension 2>
104+
CoxRing( tor2 );
105+
#! Q[q_2,q_4,q_3,q_1]
106+
#! (weights: [ ( 1, 0 ), ( 0, 1 ), ( 0, 1 ), ( 1, 0 ) ])
107+
tor3:= ToricVariety( rays, cones, weights );
108+
#! <A toric variety of dimension 2>
109+
CoxRing( tor3 );
110+
#! Q[x_2,x_4,x_3,x_1]
111+
#! (weights: [ ( 1, 0 ), ( 0, 1 ), ( 0, 1 ), ( 1, 0 ) ])
112+
tor4:= ToricVariety( rays, cones, weights2, "x1,x2,z1,z2" );
113+
#! <A toric variety of dimension 2>
114+
CoxRing( tor4 );
115+
#! Q[x2,z2,z1,x1]
116+
#! (weights: [ ( 1, 1 ), ( 1, 2 ), ( 1, 2 ), ( 1, 1 ) ])
117+
118+
#! @EndExample

ToricVarieties/gap/ToricVarieties.gd

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,15 @@ DeclareOperation( "CharacterToRationalFunction",
343343
[ IsList, IsToricVariety ] );
344344

345345
#! @Description
346-
#! Computes the Cox ring of the variety <A>vari</A>. <A>vars</A> needs to be a string containing one variable,
347-
#! which will be numbered by the method.
346+
#! Computes the Cox ring of the variety <A>vari</A>. <A>vars</A> needs to be a string. We allow for two
347+
#! different formats. Either, it is a string which does not contain ",". Then this string will be index and
348+
#! the resulting strings are then used as names for the variables of the Cox ring. Alternatively, one can also
349+
#! use a string containing ",". In this case, a "," is considered as separator and one can provide individual
350+
#! names for all variables of the Cox ring.
348351
#! @Returns a ring
349352
#! @Arguments vari, vars
350353
DeclareOperation( "CoxRing",
351-
[ IsToricVariety, IsString ] );
354+
[ IsToricVariety, IsList ] );
352355

353356
#! @Description
354357
#! Returns a list of the currently defined Divisors of the toric variety.
@@ -424,9 +427,25 @@ DeclareOperation( "ToricVariety",
424427
[ IsConvexObject ] );
425428

426429
#! @Description
427-
#! Creates a toric variety out of the convex object <A>conv</A>. In addition it takes a list of integers.
428-
#! Those are used to set the degrees of the variables in the Cox ring of the variety.
430+
#! Creates a toric variety from a list <A>rays</A> of ray generators and cones <A>cones</A>.
431+
#! Beyond the functionality of the other methods, this constructor allows to assign specific
432+
#! gradings to the homogeneous variables of the Cox ring.
433+
#! With respect to the order in which the rays appear in the list <A>rays</A>, we assign gradings
434+
#! as provided by the third argument <A>degree_list</A> . The latter is a list of integers.
429435
#! @Returns a variety
430-
#! @Arguments conv
436+
#! @Arguments rays, cones, degree_list
437+
DeclareOperation( "ToricVariety",
438+
[ IsList, IsList, IsList ] );
439+
440+
#! @Description
441+
#! Creates a toric variety from a list <A>rays</A> of ray generators and cones <A>cones</A>.
442+
#! Beyond the functionality of the other methods, this constructor allows to assign specific
443+
#! gradings and homogeneous variable names to the ray generators of this toric variety.
444+
#! With respect to the order in which the rays appear in the list <A>rays</A>, we assign gradings
445+
#! and variable names as provided by the third and fourth argument. These are the list of gradings
446+
#! <A>degree_list</A> and the list of variables names <A>var_list</A>. The former is a list of
447+
#! integers and the latter a list of strings.
448+
#! @Returns a variety
449+
#! @Arguments rays, cones, degree_list, var_list
431450
DeclareOperation( "ToricVariety",
432-
[ IsConvexObject, IsList ] );
451+
[ IsList, IsList, IsList, IsList ] );

ToricVarieties/gap/ToricVarieties.gi

Lines changed: 101 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -566,17 +566,32 @@ RedispatchOnCondition( CoxRing, true, [ IsToricVariety, IsString ], [ HasNoTorus
566566
##
567567
InstallMethod( CoxRing,
568568
"for convex toric varieties.",
569-
[ IsToricVariety and HasNoTorusfactor, IsString ],
569+
[ IsToricVariety and HasNoTorusfactor, IsList ],
570570

571-
function( variety, variable )
572-
local raylist, indeterminates, ring, class_list;
571+
function( variety, variable_names )
572+
local var_list, raylist, indeterminates, ring, class_list;
573573

574+
# test for valid input
575+
if not IsString( variable_names ) then
576+
Error( "the variable names must be specified as a string" );
577+
fi;
578+
579+
# identify the individual names and the ray generators
580+
var_list := SplitString( variable_names, "," );
574581
raylist := RayGenerators( FanOfVariety( variety ) );
575582

576-
indeterminates := List( [ 1 .. Length( raylist ) ], i -> JoinStringsWithSeparator( [ variable, i ], "_" ) );
583+
# check for valid input and, if provided, form list of final variable names
584+
if ( Length( var_list ) <> 1 and Length( var_list ) <> Length( raylist ) ) then
585+
Error( "either one variable name, or a variable name for each ray generator must be specified" );
586+
fi;
587+
588+
if Length( var_list ) = 1 then
589+
indeterminates := List( [ 1 .. Length( raylist ) ], i -> JoinStringsWithSeparator( [ var_list[ 1 ], i ], "_" ) );
590+
indeterminates := JoinStringsWithSeparator( indeterminates, "," );
591+
else
592+
indeterminates := var_list;
593+
fi;
577594

578-
indeterminates := JoinStringsWithSeparator( indeterminates, "," );
579-
580595
ring := GradedRing( DefaultGradedFieldForToricVarieties() * indeterminates );
581596

582597
SetDegreeGroup( ring, ClassGroup( variety ) );
@@ -1439,40 +1454,108 @@ end );
14391454

14401455
##
14411456
InstallMethod( ToricVariety,
1442-
" for homalg fans and a list of weights for the variables in the Cox ring",
1443-
[ IsFan, IsList ],
1444-
function( fan, degrees )
1445-
local variety, matrix1, matrix2, map;
1457+
" for lists of rays, cones and weights for the variables in the Cox ring",
1458+
[ IsList, IsList, IsList ],
1459+
function( rays, cones, degrees )
1460+
local vars;
1461+
1462+
# install standard list of variable names
1463+
vars := JoinStringsWithSeparator(
1464+
List( [ 1 .. Length( rays ) ],
1465+
i -> JoinStringsWithSeparator( [ TORIC_VARIETIES.CoxRingIndet, i ], "_" ) ), "," );
1466+
1467+
# and return result from method below
1468+
return ToricVariety( rays, cones, degrees, vars );
1469+
1470+
end );
1471+
1472+
##
1473+
InstallMethod( ToricVariety,
1474+
" for lists of rays, cones, gradings and variable names",
1475+
[ IsList, IsList, IsList, IsList ],
1476+
function( rays, cones, gradings, indeterminates )
1477+
local fan, var_names_buffer, var_names, variety, rays_in_fan, shuffled_gradings, shuffled_var_names, i, pos, matrix1, matrix2, map;
14461478

1479+
# construct the fan and test that it is pointed
1480+
fan := Fan( rays, cones );
14471481
if not IsPointed( fan ) then
14481482

14491483
Error( "input fan must only contain strictly convex cones\n" );
14501484

14511485
fi;
14521486

1487+
# check that gradings are of correct lengths
1488+
if not Length( gradings ) = Length( rays ) then
1489+
1490+
Error( "For each ray generators a grading has to be provided" );
1491+
return false;
1492+
1493+
fi;
1494+
1495+
# test if the var_names have been given as correct input
1496+
if not IsString( indeterminates ) then
1497+
Error( "the variables names have to be provided as string" );
1498+
fi;
1499+
1500+
# next seperate them by ","
1501+
var_names_buffer := SplitString( indeterminates, "," );
1502+
if ( Length( var_names_buffer ) <> 1 and Length( var_names_buffer ) <> Length( rays ) ) then
1503+
Error( "either one variable name, or a variable name for each ray generator must be specified" );
1504+
fi;
1505+
if Length( var_names_buffer ) = 1 then
1506+
var_names := List( [ 1 .. Length( rays ) ],
1507+
i -> JoinStringsWithSeparator( [ var_names_buffer[ 1 ], i ], "_" ) );
1508+
else
1509+
var_names := var_names_buffer;
1510+
fi;
1511+
14531512
variety := rec( WeilDivisors := WeakPointerObj( [ ] ) );
14541513

14551514
ObjectifyWithAttributes(
14561515
variety, TheTypeFanToricVariety,
14571516
FanOfVariety, fan
14581517
);
14591518

1460-
# check for valid input
1461-
matrix1 := Involution( HomalgMatrix( RayGenerators( fan ), HOMALG_MATRICES.ZZ ) );
1462-
matrix2 := HomalgMatrix( degrees, HOMALG_MATRICES.ZZ );
1463-
if not IsZero( matrix1 * matrix2 ) then
1519+
# The ray generators in fan = Fan( rays, cones ) are shuffled w.r.t. the provided inputlist rays.
1520+
# Let us therefore determine the permutation matrix
1521+
rays_in_fan := RayGenerators( FanOfVariety( variety ) );
1522+
shuffled_gradings := [];
1523+
shuffled_var_names := [];
1524+
for i in [ 1 .. Length( rays_in_fan ) ] do
1525+
pos := Position( rays, rays_in_fan[ i ] );
1526+
shuffled_gradings[ i ] := gradings[ pos ];
1527+
shuffled_var_names[ i ] := var_names[ pos ];
1528+
od;
14641529

1465-
Error( "corrupted input - the given weights must form (a) cokernel of the ray generators of the given fan" );
1530+
# if vari does not have a torus factor, then the gradings are set by the cokernel
1531+
# of the matrix, in which the rays are the rows (Cox-Schenk-Little, theorem 4.1.3)
1532+
# we proceed under this assumption thus
1533+
if HasTorusfactor( variety ) then
1534+
Error( Concatenation( "The method of setting the gradings by hand is currently supported ",
1535+
"only for toric variety without torus factor" ) );
1536+
return false;
1537+
fi;
1538+
1539+
# now check, that the provided gradings are valid
1540+
matrix1 := HomalgMatrix( rays_in_fan, HOMALG_MATRICES.ZZ );
1541+
matrix2 := HomalgMatrix( shuffled_gradings, HOMALG_MATRICES.ZZ );
1542+
if not IsZero( Involution( matrix2 ) * matrix1 ) then
1543+
1544+
Error( "corrupted input - the given gradings must form (a) cokernel of the ray generators of the given fan" );
14661545

14671546
fi;
14681547

1469-
# compute the map from the Weil divisors to the class group according to the given degrees
1470-
map := HomalgMap( degrees,
1548+
# now use this information to set the map from WeilDivisors to the class group
1549+
map := HomalgMap( shuffled_gradings,
14711550
TorusInvariantDivisorGroup( variety ),
1472-
Length( degrees[ 1 ] ) * HOMALG_MATRICES.ZZ
1551+
Length( shuffled_gradings[ 1 ] ) * HOMALG_MATRICES.ZZ
14731552
);
14741553
SetMapFromWeilDivisorsToClassGroup( variety, map );
14751554

1555+
# finally install the Cox ring with the prescribed names
1556+
# this here needs to join the shuffled_var_names by "," Banane
1557+
CoxRing( variety, JoinStringsWithSeparator( shuffled_var_names, "," ) );
1558+
14761559
# and return the variety
14771560
return variety;
14781561

0 commit comments

Comments
 (0)