@@ -566,17 +566,32 @@ RedispatchOnCondition( CoxRing, true, [ IsToricVariety, IsString ], [ HasNoTorus
566
566
# #
567
567
InstallMethod( CoxRing,
568
568
" for convex toric varieties." ,
569
- [ IsToricVariety and HasNoTorusfactor, IsString ] ,
569
+ [ IsToricVariety and HasNoTorusfactor, IsList ] ,
570
570
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;
573
573
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, " ," );
574
581
raylist := RayGenerators( FanOfVariety( variety ) );
575
582
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 ;
577
594
578
- indeterminates := JoinStringsWithSeparator( indeterminates, " ," );
579
-
580
595
ring := GradedRing( DefaultGradedFieldForToricVarieties() * indeterminates );
581
596
582
597
SetDegreeGroup( ring, ClassGroup( variety ) );
@@ -1439,40 +1454,108 @@ end );
1439
1454
1440
1455
# #
1441
1456
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;
1446
1478
1479
+ # construct the fan and test that it is pointed
1480
+ fan := Fan( rays, cones );
1447
1481
if not IsPointed( fan ) then
1448
1482
1449
1483
Error( " input fan must only contain strictly convex cones\n " );
1450
1484
1451
1485
fi ;
1452
1486
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
+
1453
1512
variety := rec ( WeilDivisors := WeakPointerObj( [ ] ) );
1454
1513
1455
1514
ObjectifyWithAttributes(
1456
1515
variety, TheTypeFanToricVariety,
1457
1516
FanOfVariety, fan
1458
1517
);
1459
1518
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 ;
1464
1529
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" );
1466
1545
1467
1546
fi ;
1468
1547
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 ,
1471
1550
TorusInvariantDivisorGroup( variety ),
1472
- Length( degrees [ 1 ] ) * HOMALG_MATRICES.ZZ
1551
+ Length( shuffled_gradings [ 1 ] ) * HOMALG_MATRICES.ZZ
1473
1552
);
1474
1553
SetMapFromWeilDivisorsToClassGroup( variety, map );
1475
1554
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
+
1476
1559
# and return the variety
1477
1560
return variety;
1478
1561
0 commit comments