ToricVariety
ToricVariety
¶
A toric variety defined by a star triangulation of a polytope.
This class handles various computations relating to toric varieties. It can be used to compute intersection numbers and the Kähler cone, among other things.
Warning
Generally, objects of this class should not be constructed directly by
the end user. Instead, they should be created with the
get_toric_variety
method of Triangulation.
Tip
Only star triangulations of reflexive polytopes are fully supported. There is experimental support for other kinds of triangulations, but they may not always work. See experimental features for more details.
Parameters:
-
triang(Triangulation) –A star triangulation. Regularity is not checked.
Raises:
-
ValueError–If the triangulation is not star.
-
Exception–If the polytope is not reflexive, or if the resulting variety is not compact, and the experimental features are not enabled.
Examples:
We construct a toric variety from a regular, star triangulation of a
reflexive polytope. Since this class is not intended to be initialized
by the end user, we create it with the
get_toric_variety
method of Triangulation. In this
example we obtain \(\mathbb{P}^4\).
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-1,-1]])
>>> t = p.triangulate()
>>> t.get_toric_variety()
A smooth compact 4-dimensional toric variety with 5 affine patches
Methods:
-
canonical_divisor_is_smooth–Return whether the canonical divisor is smooth.
-
clear_cache–Clear the cached results of any previous computation.
-
curve_basis–Return the current basis of curves of the toric variety.
-
dimension–Return the complex dimension of the toric variety.
-
divisor_basis–Return the current basis of divisors of the toric variety.
-
effective_cone–Return the cone of effective divisors of the toric variety.
-
fan_cones–Return the cones of the fan defined by the star triangulation.
-
get_cy–Return the Calabi-Yau hypersurface or complete intersection.
-
glsm_charge_matrix–Compute the GLSM charge matrix of the theory resulting from this variety.
-
glsm_linear_relations–Compute the linear relations among the columns of the GLSM charge matrix.
-
intersection_numbers–Return the intersection numbers of the toric variety.
-
is_compact–Return whether the toric variety is compact.
-
is_smooth–Return whether the toric variety is smooth.
-
kahler_cone–Return the Kähler cone of the toric variety in the current divisor basis.
-
mori_cone–Return the Mori cone of the toric variety.
-
polytope–Return the polytope whose triangulation gives rise to the toric variety.
-
prime_toric_divisors–Return the point indices corresponding to the prime toric divisors.
-
set_curve_basis–Set a basis of curves of the toric variety.
-
set_divisor_basis–Set a basis of divisors of the toric variety.
-
sr_ideal–Return the generators of the Stanley–Reisner ideal of the toric variety.
-
triangulation–Return the triangulation giving rise to the toric variety.
canonical_divisor_is_smooth
¶
Return whether the canonical divisor is smooth.
More precisely, this checks whether a generic anticanonical hypersurface (i.e. the Calabi-Yau hypersurface) is smooth. This is done by verifying that all lattice points of the polytope not interior to facets are used in the triangulation and, for varieties of dimension greater than 4, that all \((d-1)\)-dimensional cones of the fan lying in \((d-2)\)-dimensional faces of the polytope are smooth, where \(d\) is the dimension of the variety. The result is cached.
Returns:
-
bool–Whether the canonical divisor is smooth.
Examples:
We construct a toric variety and check if its canonical divisor is smooth.
clear_cache
¶
Clear the cached results of any previous computation.
Note that a full cache clear (only_in_basis=False) also discards any
basis of divisors or curves that was previously set, so the default
basis is used afterwards.
Parameters:
-
recursive(bool, default:False) –Whether to also clear the cache of the defining triangulation and polytope. This is ignored when
only_in_basis=True. -
only_in_basis(bool, default:False) –Whether to only clear the cache of computations that depend on the choice of basis (the Mori cone in the current basis, the effective cone, and the intersection numbers in the current basis).
Examples:
We construct a toric variety, compute its Mori cone, clear the cache and then compute it again.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> v.mori_cone()
A 2-dimensional rational polyhedral cone in RR^7 generated by 3 rays
>>> v.clear_cache() # Clears the cached result
>>> v.mori_cone() # The Mori cone is recomputed
A 2-dimensional rational polyhedral cone in RR^7 generated by 3 rays
curve_basis
¶
Return the current basis of curves of the toric variety.
If no basis has been set, a default integral basis of divisors is
chosen and set, and its dual basis of curves is returned. A different
basis can be set with
set_curve_basis
or
set_divisor_basis.
Parameters:
-
include_origin(bool, default:True) –Whether the indexing of the returned vector (or the columns of the returned matrix) includes the origin, i.e. the canonical divisor at index 0.
-
as_matrix(bool, default:False) –Whether to return the basis as a matrix instead of a vector of indices. If a generic (matrix) basis was set, then it is always returned as a matrix.
Returns:
-
ndarray–A vector of indices of the standard basis of the lattice dual to the lattice of prime toric divisors that form the basis of curves. If
as_matrixis true, or if a generic (matrix) basis has been set, a matrix is returned instead, where each row gives the intersection numbers of a basis curve with the canonical divisor and the prime toric divisors.
Raises:
-
Exception–If
include_origin=Falsebut the current basis includes the index of the canonical divisor.
Examples:
We consider a simple toric variety with two independent curves. If no basis has been set, then this function finds one. If a basis has been set, then this function returns it.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> v.curve_basis() # We haven't set any basis
array([5, 6])
>>> v.set_curve_basis([5,6]) # Here we set a basis
>>> v.curve_basis() # We get the basis we set
array([5, 6])
>>> v.curve_basis(as_matrix=True) # We get the basis in matrix form
array([[-18, 1, 9, 6, 1, 1, 0],
[ -6, 0, 3, 2, 0, 0, 1]])
dimension
¶
Return the complex dimension of the toric variety.
Also available as dim.
Returns:
-
int–The complex dimension of the toric variety.
Examples:
We construct a toric variety and find its dimension.
divisor_basis
¶
Return the current basis of divisors of the toric variety.
If no basis has been set, a default integral basis of prime toric
divisors is chosen and set. A different basis can be set with
set_divisor_basis
or set_curve_basis.
Parameters:
-
include_origin(bool, default:True) –Whether the indexing of the returned vector (or the columns of the returned matrix) includes the origin, i.e. the canonical divisor at index 0.
-
as_matrix(bool, default:False) –Whether to return the basis as a matrix instead of a vector of indices of prime toric divisors. If a generic (matrix) basis was set, then it is always returned as a matrix.
Returns:
-
ndarray–A vector of the indices of the prime toric divisors that form the basis. If
as_matrixis true, or if a generic (matrix) basis has been set, a matrix is returned instead, where each row is a basis element expressed as a linear combination of the canonical divisor and the prime toric divisors.
Raises:
-
Exception–If
include_origin=Falsebut the current basis includes the canonical divisor.
Examples:
We consider a simple toric variety with two independent divisors. If no basis has been set, then this function finds one. If a basis has been set, then this function returns it.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> v.divisor_basis() # We haven't set any basis
array([5, 6])
>>> v.set_divisor_basis([5,6]) # Here we set a basis
>>> v.divisor_basis() # We get the basis we set
array([5, 6])
>>> v.divisor_basis(as_matrix=True) # We get the basis in matrix form
array([[0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 1]])
effective_cone
¶
Return the cone of effective divisors of the toric variety.
The effective cone is generated by the classes of the prime toric divisors, expressed in the current basis of divisors. The result is cached.
Returns:
-
Cone–The effective cone of the toric variety.
Examples:
We construct a toric variety and find its effective cone.
fan_cones
¶
Return the cones of the fan defined by the star triangulation.
The dimension of the desired cones can be specified, and one can also restrict to cones that lie in faces of the polytope of a particular dimension. The cones are generated by the points of the triangulation (the origin is never a generator), and the results are cached.
Parameters:
-
d(int | None, default:None) –The dimension of the desired cones. If not specified, it defaults to
face_dimif that is given, and otherwise to the dimension of the variety (i.e. the maximal cones are returned). -
face_dim(int | None, default:None) –Restricts to cones whose generators lie in a common face of the polytope of this dimension. If not specified, then no restriction is imposed.
Returns:
Raises:
-
ValueError–If
dis not between 1 and the dimension of the variety.
Examples:
We construct a toric variety and find the maximal and 2-dimensional cones of the defining fan.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> max_cones = v.fan_cones() # By default it returns the maximal cones
>>> len(max_cones)
9
>>> cones_2d = v.fan_cones(d=2) # We can select cones of a given dimension
>>> len(cones_2d)
15
get_cy
¶
Return the Calabi-Yau hypersurface or complete intersection.
By default, this returns a CalabiYau
object corresponding to the anticanonical hypersurface in the toric
variety, which requires the triangulation to be fine. If a
nef-partition is specified, then it returns the complete intersection
Calabi-Yau that it defines. The result is cached as long as the same
nef-partition is used.
Note
Only Calabi-Yau 3-fold hypersurfaces are fully supported. Other dimensions, non-favorable polytopes, and CICYs require enabling the experimental features of CYTools. See experimental features for more details.
Parameters:
-
nef_partition(list[tuple[int, ...]] | None, default:None) –A list of tuples of point indices specifying a nef-partition of the polytope, which defines a complete intersection Calabi-Yau. If not specified, the anticanonical hypersurface is returned.
Returns:
-
CalabiYau–The Calabi-Yau arising from the triangulation.
Raises:
-
ValueError–If the triangulation is not fine, if it uses neither exactly the points not interior to facets nor all the points of the polytope, or if the nef-partition is invalid.
-
Exception–If the experimental features are required but not enabled.
Examples:
We construct a toric variety and obtain its Calabi-Yau hypersurface.
glsm_charge_matrix
¶
Compute the GLSM charge matrix of the theory resulting from this variety.
The columns correspond to the points of the triangulation, in the same
order as
Triangulation.points.
The first column corresponds to the origin (i.e. the canonical divisor)
and the remaining ones to the prime toric divisors. The result is
cached, and a copy is returned.
Parameters:
-
include_origin(bool, default:True) –Whether to include the column corresponding to the origin (i.e. the canonical divisor).
Returns:
-
ndarray–The GLSM charge matrix, with one row per independent \(U(1)\) charge.
Examples:
We construct a toric variety and find the GLSM charge matrix.
glsm_linear_relations
¶
Compute the linear relations among the columns of the GLSM charge matrix.
Each row is a vector of coefficients \(r\) such that
\(\sum_j r_j Q_{\cdot j} = 0\), where \(Q\) is the GLSM charge matrix
returned by
glsm_charge_matrix.
The columns follow the same ordering as the columns of the charge
matrix. The result is cached, and a copy is returned.
Parameters:
-
include_origin(bool, default:True) –Whether to include the origin (i.e. the canonical divisor). If false, the first row and the first column of the matrix are removed.
Returns:
-
ndarray–A matrix whose rows are linear relations among the columns of the GLSM charge matrix.
Examples:
We construct a toric variety and find the linear relations of its GLSM charge matrix. By definition, their product with the transposed charge matrix must vanish.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> v.glsm_linear_relations()
array([[ 1, 0, 0, 0, 0, 18, 6],
[ 0, 1, 0, 0, 0, -1, 0],
[ 0, 0, 1, 0, 0, -9, -3],
[ 0, 0, 0, 1, 0, -6, -2],
[ 0, 0, 0, 0, 1, -1, 0]])
>>> v.glsm_linear_relations().dot(v.glsm_charge_matrix().T)
array([[0, 0],
[0, 0],
[0, 0],
[0, 0],
[0, 0]])
intersection_numbers
¶
intersection_numbers(in_basis=False, format='dok', zero_as_anticanonical=False, backend='all', check=True, backend_error_tol=0.001, round_to_zero_threshold=0.001, round_to_integer_error_tol=0.05, verbose=0, exact_arithmetic=False)
Return the intersection numbers of the toric variety.
The intersection numbers of distinct prime toric divisors spanning a
simplex of the triangulation are computed from the simplex volumes, and
the rest are found by solving a sparse linear system obtained from the
linear relations among the divisors. Intersection numbers involving the
canonical divisor (index 0) are then computed from these. If the
variety is smooth, all intersection numbers are rounded to integers,
and if its canonical divisor is smooth (see
canonical_divisor_is_smooth), the ones involving the canonical divisor
exactly once are rounded to integers. Otherwise, they are floating-point
numbers.
Only the nonzero intersection numbers are stored, and the results are
cached for each combination of in_basis, format,
zero_as_anticanonical, and exact_arithmetic. The remaining
parameters only affect the first computation.
Tip
The intersection numbers are computed as floating-point numbers by
default, but there is the experimental option to turn them into
exact rationals with exact_arithmetic=True. The process is fairly
quick, but it is unreliable at large \(h^{1,1}\). Furthermore,
verifying that they are correct becomes very slow at large
\(h^{1,1}\).
Parameters:
-
in_basis(bool, default:False) –Whether to return the intersection numbers in the current basis of divisors (see
divisor_basis). In this case, the indices refer to the basis elements. -
format(str, default:'dok') –The output format of the intersection numbers. The options are
"dok","coo", and"dense". When set to"dok"(Dictionary Of Keys), a dictionary is returned where the keys are tuples of divisor indices in ascending order and the values are the corresponding intersection numbers. When set to"coo"(COOrdinate format), a numpy array is returned with rows of the form[a, b, ..., c, K_ab...c], i.e. all but the last entry of each row are divisor indices in ascending order, and the last entry is their intersection number. When set to"dense", the full dense array of intersection numbers is returned. -
zero_as_anticanonical(bool, default:False) –Whether to treat the zeroth index as corresponding to the anticanonical divisor instead of the canonical divisor. This is ignored when
in_basis=True. -
backend(str, default:'all') –The sparse linear solver to use. Options are
"all","sksparse", and"scipy". When set to"all", every solver is tried in order until one succeeds. -
check(bool, default:True) –Whether to explicitly check the solution to the linear system.
-
backend_error_tol(float, default:0.001) –Error tolerance for the solution of the linear system.
-
round_to_zero_threshold(float, default:0.001) –Intersection numbers with magnitude smaller than this threshold are rounded to zero (i.e. dropped).
-
round_to_integer_error_tol(float, default:0.05) –Maximum allowed distance from an integer for intersection numbers that are expected to be integral, i.e. all of them when the variety is smooth, and those involving the canonical divisor exactly once when the canonical divisor is smooth.
-
verbose(int, default:0) –The verbosity level. If 0, nothing is printed. If 1 or higher, warnings from the linear backends are printed.
-
exact_arithmetic(bool, default:False) –Whether to convert the intersection numbers into exact rational numbers (
flint.fmpq). This requires the experimental features to be enabled.
Returns:
-
dict[tuple[int, ...], float] | ndarray–The intersection numbers in the requested format: a dictionary for
"dok", a 2D array for"coo", or a dense array of rank equal to the dimension of the variety for"dense". A shallow copy of the cached result is returned.
Raises:
-
ValueError–If
formatorbackendis not a valid option, or ifexact_arithmetic=Trueand the experimental features are not enabled. -
RuntimeError–If the linear system could not be solved, if the conversion to rational numbers failed, or if non-integer intersection numbers are found where integers are expected.
Examples:
We construct a toric variety and compute its intersection numbers. By default, the intersection numbers of the canonical divisor (index 0) and the prime toric divisors are returned as a dictionary whose keys are the divisor indices in ascending order.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> intnums = v.intersection_numbers()
>>> print(intnums[(1, 2, 3, 4)])
1.0
>>> print(intnums[(1, 2, 4, 6)])
0.5
>>> print(intnums[(0, 1, 2, 3)])
-18
We can also compute the intersection numbers in the current basis
of divisors. In this case, the indices refer to the basis elements,
so the key (0, 0, 1, 1) corresponds to the intersection of the
divisors 5, 5, 6, and 6.
>>> v.divisor_basis()
array([5, 6])
>>> intnums_basis = v.intersection_numbers(in_basis=True)
>>> print(round(intnums_basis[(0, 0, 1, 1)], 6))
0.166667
The intersection numbers can also be obtained in the "coo" and
"dense" formats.
is_compact
¶
Return whether the toric variety is compact.
The variety is compact when the origin is an interior point of the polytope, so that the fan defined by the star triangulation is complete.
Returns:
-
bool–Whether the toric variety is compact.
Examples:
We construct a toric variety and check if it is compact.
is_smooth
¶
Return whether the toric variety is smooth.
The variety is smooth if every simplex of the triangulation (i.e. every maximal cone of the fan) is unimodular. The result is cached.
Returns:
-
bool–Whether the toric variety is smooth.
Examples:
We construct two toric varieties and check if they are smooth.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t1 = p.triangulate()
>>> v1 = t1.get_toric_variety()
>>> v1.is_smooth()
False
>>> t2 = p.triangulate(include_points_interior_to_facets=True)
>>> v2 = t2.get_toric_variety()
>>> v2.is_smooth()
True
kahler_cone
¶
Return the Kähler cone of the toric variety in the current divisor basis.
It is computed as the dual of the Mori cone in the current basis of
curves (see mori_cone).
Returns:
-
Cone–The Kähler cone of the toric variety.
Examples:
We construct a toric variety and find its Kähler cone.
mori_cone
¶
Return the Mori cone of the toric variety.
By default, the Mori cone is computed as the dual of the secondary cone of the triangulation. Without a choice of basis, each ray is given by the intersection numbers of a curve with the canonical divisor and the prime toric divisors. The results are cached.
Parameters:
-
in_basis(bool, default:False) –Whether to use the current basis of curves, which is dual to the basis returned by
divisor_basis. -
include_origin(bool, default:True) –Whether to include the coordinate corresponding to the origin of the polytope, i.e. the canonical divisor. This parameter is ignored when
in_basis=True. -
from_intersection_numbers(bool, default:False) –Whether to compute the rays of the Mori cone using the intersection numbers of the variety. This can be faster if they are already computed. The set of rays may be different, but they define the same cone. This parameter only has an effect the first time the Mori cone is computed, since the result is cached.
Returns:
-
Cone–The Mori cone of the toric variety.
Examples:
We construct a toric variety and find its Mori cone in an \(h^{1,1}+d+1\) dimensional lattice (i.e. without a particular choice of basis) and in an \(h^{1,1}\) dimensional lattice (i.e. after picking a basis of curves).
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> v.mori_cone() # By default it does not use a basis of curves
A 2-dimensional rational polyhedral cone in RR^7 generated by 3 rays
>>> v.mori_cone(in_basis=True) # Uses the dual of the divisor basis
A 2-dimensional rational polyhedral cone in RR^2 generated by 3 rays
polytope
¶
Return the polytope whose triangulation gives rise to the toric variety.
Returns:
-
Polytope–The polytope whose triangulation gives rise to the toric variety.
Examples:
We construct a toric variety and check that the polytope that this function returns is the same as the one we used to construct it.
prime_toric_divisors
¶
Return the point indices corresponding to the prime toric divisors.
These are the indices (with respect to the points of the polytope) of the points used in the triangulation, excluding the origin at index 0. The result is cached.
Returns:
Examples:
We construct a toric variety and find the list of prime toric divisors.
set_curve_basis
¶
Set a basis of curves of the toric variety.
This in turn induces the dual basis of divisors. The basis can be
specified with a vector of indices of the standard basis of the lattice
dual to the lattice of prime toric divisors, which is equivalent to
passing the same vector to
set_divisor_basis.
If the experimental features are enabled, it can also be specified
with a matrix whose rows give the intersection numbers of each basis
curve with the canonical divisor and the prime toric divisors. Cached
results that depend on the choice of basis are cleared.
Note
Only integral bases are supported by CYTools, meaning that all toric curves must be able to be written as an integral linear combination of the basis curves.
Parameters:
-
basis(ArrayLike) –Vector or matrix specifying a basis. When a vector is used, its entries are taken as indices of the standard basis of the lattice dual to the lattice of prime toric divisors (with index 0 corresponding to the canonical divisor). When a matrix is used, its rows are taken as linear combinations of the aforementioned elements. The matrix may omit the column of the canonical divisor, in which case it is computed as minus the sum of the other entries of the row.
-
include_origin(bool, default:True) –Whether to interpret the indices in the input vector as including the origin at index 0. This is only used when
basisis a vector.
Raises:
-
ValueError–If the input does not specify a valid integral basis.
-
Exception–If a matrix is given and the experimental features are not enabled.
Examples:
We consider a simple toric variety with two independent curves. We first find the default basis of curves it picks and then set a basis of our choice.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> v.curve_basis() # We haven't set any basis
array([5, 6])
>>> v.set_curve_basis([5,6]) # Here we set a basis
>>> v.curve_basis() # We get the basis we set
array([5, 6])
>>> v.curve_basis(as_matrix=True) # We get the basis in matrix form
array([[-18, 1, 9, 6, 1, 1, 0],
[ -6, 0, 3, 2, 0, 0, 1]])
Note that when setting a curve basis with a vector, this function
behaves exactly the same as
set_divisor_basis.
The two functions differ for generic (matrix) bases. An example can
be found in the experimental
features
section.
set_divisor_basis
¶
Set a basis of divisors of the toric variety.
This also sets the dual basis of curves. The basis can be specified with a vector of indices of prime toric divisors or, if the experimental features are enabled, with a matrix whose rows are linear combinations of the canonical divisor and the prime toric divisors. Cached results that depend on the choice of basis are cleared.
Note
Only integral bases are supported by CYTools, meaning that all prime toric divisors must be able to be written as an integral linear combination of the basis divisors.
Parameters:
-
basis(ArrayLike) –Vector or matrix specifying a basis. When a vector is used, its entries are taken as the indices of the prime toric divisors (i.e. of the points of the triangulation, with the origin, corresponding to the canonical divisor, at index 0); the indices are sorted before being stored. When a matrix is used, its rows are taken as linear combinations of the aforementioned divisors. The matrix may omit the column of the canonical divisor, in which case its coefficient is set to zero.
-
include_origin(bool, default:True) –Whether to interpret the indices in the input vector as including the origin at index 0. This is only used when
basisis a vector.
Raises:
-
ValueError–If the input does not specify a valid integral basis.
-
Exception–If a matrix is given and the experimental features are not enabled.
Examples:
We consider a simple toric variety with two independent divisors. We first find the default basis it picks and then we set a basis of our choice.
>>> from cytools import Polytope
>>> p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-6,-9]])
>>> t = p.triangulate()
>>> v = t.get_toric_variety()
>>> v.divisor_basis() # We haven't set any basis
array([5, 6])
>>> v.set_divisor_basis([5,6]) # Here we set a basis
>>> v.divisor_basis() # We get the basis we set
array([5, 6])
>>> v.divisor_basis(as_matrix=True) # We get the basis in matrix form
array([[0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 1]])
An example with more generic basis choices can be found in the experimental features section.
sr_ideal
¶
Return the generators of the Stanley–Reisner ideal of the toric variety.
This is computed by
Triangulation.sr_ideal.
Each generator is a set of prime toric divisors (given by the labels of
the corresponding points) that do not all lie in a common simplex of the
triangulation, and that is minimal with this property.
Returns:
-
tuple[tuple[int, ...], ...]–The generators of the Stanley–Reisner ideal, each given as a sorted tuple of point labels. The generators are sorted by length and then lexicographically.
Examples:
We construct a toric variety and find its SR ideal. Here we convert the labels to plain integers for readability.
triangulation
¶
Return the triangulation giving rise to the toric variety.
Returns:
-
Triangulation–The triangulation giving rise to the toric variety.
Examples:
We construct a toric variety and check that the triangulation that this function returns is the same as the one we used to construct it.