Skip to main content

ToricVariety Class

This class handles various computations relating to the toric varieties. It can be used to compute intersection numbers, the Kähler cone, among other things.

info

Generally, objects of this class should not be constructed directly by the end user. Instead, they should be created by the get_toric_variety function of the Triangulation class.

experimental features

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.

Constructor

cytools.toricvariety.ToricVariety

Description: Constructs a ToricVariety object. This is handled by the hidden __init__ function.

Arguments:

  • triang (Triangulation): A star triangulation.
Example

We construct a ToricVariety 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 via the get_toric_variety function of the Triangulation class. In this example we obtain P4\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()
v = t.get_toric_variety()
# A smooth compact 4-dimensional toric variety with 5 affine patches

Functions

canonical_divisor_is_smooth

Description: Returns True if the canonical divisor is smooth.

Arguments: None.

Returns: (bool) The truth value of the canonical divisor being smooth.

Example

We construct a toric variety and check if its canonical divisor is smooth.

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.canonical_divisor_is_smooth()
# True

clear_cache

Description: Clears the cached results of any previous computation.

Arguments:

  • recursive (bool, optional, 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, optional, default=False): Only clears the cache of computations that depend on a choice of basis.

Returns: Nothing.

Example

We construct a toric variety, compute its Mori cone, clear the cache and then compute it again.

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

Description: Returns the current basis of curves of the toric variety.

Arguments:

  • include_origin (bool, optional, default=True): Whether to include the origin in the indexing of the vector, or in the basis matrix.
  • as_matrix (bool, optional, default=False): Indicates whether to return the basis as a matrix intead of a list of indices of prime toric divisors. Note that if a matrix basis was specified, then it will always be returned as a matrix.

Returns: (numpy.ndarray) A list of column indices that form a basis. If a more generic basis has been specified with the set_divisor_basis or set_curve_basis functions then it returns a matrix where the rows are the basis elements specified as a linear combination of the canonical divisor and the prime toric divisors.

Example

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.

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([1, 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]])

dim

Description: Returns the complex dimension of the toric variety.

Arguments: None.

Returns: (int) The complex dimension of the toric variety.

Example

We construct a toric variety and find its dimension.

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()
v = t.get_toric_variety()
v.dim()
# 4

divisor_basis

Description: Returns the current basis of divisors of the toric variety.

Arguments:

  • include_origin (bool, optional, default=True): Whether to include the origin in the indexing of the vector, or in the basis matrix.
  • as_matrix (bool, optional, default=False): Indicates whether to return the basis as a matrix intead of a list of indices of prime toric divisors. Note that if a matrix basis was specified, then it will always be returned as a matrix.

Returns: (numpy.ndarray) A list of column indices that form a basis. If a more generic basis has been specified with the set_divisor_basis or set_curve_basis functions then it returns a matrix where the rows are the basis elements specified as a linear combination of the canonical divisor and the prime toric divisors.

Example

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.

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([1, 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

Description: Returns the effective cone of the toric variety.

Arguments: None.

Returns: (Cone) The effective cone of the toric variety.

Example

We construct a toric variety and find its effective cone.

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.effective_cone()
# A 2-dimensional rational polyhedral cone in RR^2 generated by 6 rays

fan_cones

Description: It returns the cones forming a fan defined by a star triangulation of a reflexive polytope. The dimension of the desired cones can be specified, and one can also restrict to cones that lie in faces of a particular dimension.

Arguments:

  • d (int, optional): The dimension of the desired cones. If not specified, it returns the full-dimensional cones.
  • face_dim (int, optional): Restricts to cones that lie on faces of the polytope of a particular dimension. If not specified, then no restriction is imposed.

Returns: (tuple) The tuple of cones with the specified properties defined by the star triangulation.

Example

We construct a toric variety and find the maximal and 2-dimensional cones of the defining fan..

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
cones_2d = v.fan_cones(d=2) # We can select cones of a specific dimension

get_cy

Description: Returns a CalabiYau object corresponding to the anti-canonical hypersurface on the toric variety defined by the fine, star, regular triangulation. If a nef-partition is specified then it returns the complete intersection Calabi-Yau that it specifies.

note

Only Calabi-Yau 3-fold hypersurfaces are fully supported. Other dimensions and CICYs require enabling the experimental features of CYTools. See experimental features for more details.

Arguments:

  • nef_partition (list, optional): A list of tuples of indices specifying a nef-partition of the polytope, which correspondingly defines a complete intersection Calabi-Yau.

Returns: (CalabiYau) The Calabi-Yau arising from the triangulation.

Example

We construct a toric variety and obtain its Calabi-Yau hypersurface.

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.get_cy()
# A Calabi-Yau 3-fold hypersurface with h11=2 and h21=272 in a 4-dimensional toric variety

glsm_charge_matrix

Description: Computes the GLSM charge matrix of the theory resulting from this toric variety.

Arguments:

  • include_origin (bool, optional, default=True): Indicates whether to use the origin in the calculation. This corresponds to the inclusion of the canonical divisor.

Returns: (numpy.ndarray) The GLSM charge matrix.

Example

We construct a toric variety and find the GLSM charge matrix.

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 = p.get_toric_variety()
v.glsm_charge_matrix()
# array([[-18, 1, 9, 6, 1, 1, 0],
# [ -6, 0, 3, 2, 0, 0, 1]])

glsm_linear_relations

Description: Computes the linear relations of the GLSM charge matrix.

Arguments:

  • include_origin (bool, optional, default=True): Indicates whether to use the origin in the calculation. This corresponds to the inclusion of the canonical divisor.

Returns: (numpy.ndarray) A matrix of linear relations of the columns of the GLSM charge matrix.

Example

We construct a toric variety and find its GLSM charge matrix and linear relations.

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 = p.get_toric_variety()
v.glsm_linear_relations()
# array([[ 1, 1, 1, 1, 1, 1, 1],
# [ 0, 9, -1, 0, 0, 0, 3],
# [ 0, 6, 0, -1, 0, 0, 2],
# [ 0, 1, 0, 0, -1, 0, 0],
# [ 0, 1, 0, 0, 0, -1, 0]])
v.glsm_linear_relations().dot(p.glsm_charge_matrix().T) # By definition this product must be zero
# array([[0, 0],
# [0, 0],
# [0, 0],
# [0, 0],
# [0, 0]])

intersection_numbers

Description: Returns the intersection numbers of the toric variety.

experimental feature

The intersection numbers are computed as floating-point numbers by default, but there is the option to turn them into rationals. The process is fairly quick, but it is unreliable at large h1,1h^{1,1}. Furthermore, verifying that they are correct becomes very slow at large h1,1h^{1,1}.

Arguments:

  • in_basis (bool, optional, default=False): Return the intersection numbers in the current basis of divisors.
  • format (str, optional, default="dok"): The output format of the intersection numbers. The options are "dok", "coo", and "dense". When set to "dok" (Dictionary Of Keys), it returns a dictionary where the keys are divisor indices in ascending order and the corresponding value is their intersection number. When set to "coo" (COOrdinate format), it returns a numpy array in the format [[a,b,...,c,K_ab...c],...], i.e. all but the last entry of each row correspond to divisor indices in ascending order, with the last entry of the row being their intersection number. Lastly, when set to "dense", it returns the full dense array of intersection numbers.
  • zero_as_anticanonical (bool, optional, default=False): Treat the zeroth index as corresponding to the anticanonical divisor instead of the canonical divisor.
  • backend (str, optional, 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, optional, default=True): Whether to explicitly check the solution to the linear system.
  • backend_error_tol (float, optional, default=1e-3): Error tolerance for the solution of the linear system.
  • round_to_zero_treshold (float, optional, default=1e-3): Intersection numbers with magnitude smaller than this treshold are rounded to zero.
  • round_to_integer_error_tol (float, optional, default=5e-2): All intersection numbers of the Calabi-Yau hypersurface must be integers up to errors less than this value, when the CY is smooth.
  • verbose (int, optional, default=0): The verbosity level.
    • verbose = 0: Do not print anything.
    • verbose = 1: Print linear backend warnings.
  • exact_arithmetic (bool, optional, default=False): Converts the intersection numbers into exact rational fractions.

Returns: (dict or numpy.array) When format is set to "dok" (Dictionary Of Keys), it returns a dictionary where the keys are divisor indices in ascending order and the corresponding value is their intersection number. When format is set to "coo" (COOrdinate format), it returns a numpy array in the format [[a,b,...,c,K_ab...c],...], i.e. all but the last entry of each row correspond to divisor indices in ascending order, with the last entry of the row being their intersection number. Lastly, when set to "dense", it returns the full dense array of intersection numbers.

Example

We construct a toric variety and compute its intersection numbers We demonstrate the usage of the in_basis flag and the different available output formats.

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()
# By default this function computes the intersection numbers of the canonical and prime toric divisors
intnum_nobasis = v.intersection_numbers()
# Let's print the output and see how to interpret it
print(intnum_nobasis)
# {(1, 2, 3, 4): 1.0, (1, 2, 3, 5): 1.0, (1, 2, 4, 6): 0.5, (1, 2, 5, 6): 0.5, [the output is too long so we truncate it]
# The above output means that the intersection number of divisors 1, 2, 3, 4 is 1, and so on
# Let us now compute the intersection numbers in a given basis of divisors
# First, let's check the current basis of divisors
v.divisor_basis()
# array([1, 6])
# Now, setting in_basis=True we only compute the intersection numbers of divisors 1 and 6
intnum_basis = v.intersection_numbers(in_basis=True)
# Let's print the output and see how to interpret it
print(intnum_basis)
# {(0, 0, 1, 1): 0.16666666666667923, (0, 1, 1, 1): -1.0000000000000335, (1, 1, 1, 1): 4.500000000000089}
# Here, the indices correspond to indices of the basis divisors
# So the intersection of 1, 1, 6, 6 is 0.1666, and so on
# Now, let's look at the different output formats. The default one is the "dok" (Dictionary Of Keys) format shown above
# There is also the "coo" (COOrdinate format)
print(v.intersection_numbers(in_basis=True, format="coo"))
# [[ 0. 0. 1. 1. 0.16666667]
# [ 0. 1. 1. 1. -1. ]
# [ 1. 1. 1. 1. 4.5 ]]
# In this format, all but the last entry of each row are the indices and the last entry of the row is the intersection number
# Lastrly, there is the "dense" format where it outputs the full dense array
print(v.intersection_numbers(in_basis=True, format="dense"))
# [[[[ 0. 0. ]
# [ 0. 0.16666667]]
#
# [[ 0. 0.16666667]
# [ 0.16666667 -1. ]]]
#
#
# [[[ 0. 0.16666667]
# [ 0.16666667 -1. ]]
#
# [[ 0.16666667 -1. ]
# [-1. 4.5 ]]]]

is_compact

Description: Returns True if the variety is compact and False otherwise.

Arguments: None.

Returns: (bool) The truth value of the variety being compact.

Example

We construct a toric variety and check if it is compact.

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()
v = t.get_toric_variety()
v.is_compact()
# True

is_smooth

Description: Returns True if the toric variety is smooth.

Arguments: None.

Returns: (bool) The truth value of the toric variety being smooth.

Example

We construct two toric varieties and check if they are smooth.

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 = t.get_toric_variety()
v1.is_smooth()
# False
t2 = p.triangulate(include_points_interior_to_facets=True)
v2 = t.get_toric_variety()
v2.is_smooth()
# True

kahler_cone

Description: Returns the Kähler cone of the toric variety in the current basis of divisors.

Arguments: None.

Returns: (Cone) The Kähler cone of the toric variety.

Example

We construct a toric variety and find its Kahler cone.

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.kahler_cone()
# A rational polyhedral cone in RR^2 defined by 3 hyperplanes normals

mori_cone

Description: Returns the Mori cone of the toric variety.

Arguments:

  • in_basis (bool, optional, default=False): Use the current basis of curves, which is dual to the basis returned by the divisor_basis function.
  • include_origin (bool, optional, default=True): Includes the origin of the polytope in the computation, which corresponds to the canonical divisor.
  • from_intersection_numbers (bool, optional, default=False): 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.

Returns: (Cone) The Mori cone of the toric variety.

Example

We construct a toric variety and find its Mori cone in an h1,1+d+1h^{1,1}+d+1 dimensional lattice (i.e. without a particular choice of basis) and in an h1,1h^{1,1} dimensional lattice (i.e. after picking a basis of curves).

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) # It uses the dual basis of curves to the current divisor basis
# A 2-dimensional rational polyhedral cone in RR^2 generated by 3 rays

polytope

Description: Returns the polytope whose triangulation gives rise to the toric variety.

Arguments: None.

Returns: (Polytope) The polytope whose triangulation gives rise to the toric variety.

Example

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.

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()
v = t.get_toric_variety()
v.polytope() is p
# True

prime_toric_divisors

Description: Returns the list of point indices corresponding to prime toric divisors. This list simply corresponds to the indices of the boundary points that are used in the triangulation.

Arguments: None

Returns: (tuple) The point indices corresponding to prime toric divisors.

Example

We construct a toric variety and find the list of prime toric divisors.

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.prime_toric_divisors()
# (1, 2, 3, 4, 5, 6)

set_curve_basis

Description: Specifies a basis of curves of the toric variety, which in turn induces a basis of divisors. This can be done with a vector specifying the indices of the standard basis of the lattice dual to the lattice of prime toric divisors. Note that this case is equivalent to using the same vector in the set_divisor_basis function.

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.

Arguments:

  • basis (array_like): Vector or matrix specifying a basis. When a vector is used, the entries will be taken as indices of the standard basis of the dual to the lattice of prime toric divisors. When a matrix is used, the rows are taken as linear combinations of the aforementioned elements.
  • include_origin (bool, optional, default=True): Whether to interpret the indexing specified by the input vector as including the origin.

Returns: Nothing.

Example

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.

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([1, 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 in this way, the function behaves exactly the same as set_divisor_basis. For a more advanced example involving generic bases these two functions differ. An example can be found in the experimental features section.


set_divisor_basis

Description: Specifies a basis of divisors of the toric variety. This can be done with a vector specifying the indices of the prime toric divisors.

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.

Arguments:

  • basis (array_like): Vector or matrix specifying a basis. When a vector is used, the entries will be taken as the indices of points of the polytope or prime divisors of the toric variety. When a matrix is used, the rows are taken as linear combinations of the aforementioned divisors.
  • include_origin (bool, optional, default=True): Whether to interpret the indexing specified by the input vector as including the origin.

Returns: Nothing.

Example

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.

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([1, 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 for more generic basis choices can be found in the experimental features section.


sr_ideal

Description: Returns the Stanley–Reisner ideal of the toric variety.

Arguments: None.

Returns: (numpy.ndarray) The Stanley–Reisner ideal of the toric variety.

Example

We construct a toric variety and find its SR ideal.

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.sr_ideal()
# array([[1, 4, 5],
# [2, 3, 6]])

triangulation

Description: Returns the triangulation giving rise to the toric variety.

Arguments: None.

Returns: (Triangulation) The triangulation giving rise to the toric variety.

Example

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.

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()
v = t.get_toric_variety()
v.triangulation() is t
# True

Hidden Functions

__eq__

Description: Implements comparison of toric varieties with ==.

Arguments:

  • other (ToricVariety): The other toric variety that is being compared.

Returns: (bool) The truth value of the toric varieties being equal.

Example

We construct two toric varieties and compare them.

p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-1,-1]])
t1 = p.triangulate(backend="qhull")
v1 = t1.get_toric_variety()
t2 = p.triangulate(backend="topcom")
v2 = t2.get_toric_variety()
v1 == v2
# True

__hash__

Description: Implements the ability to obtain hash values from toric varieties.

Arguments: None.

Returns: (int) The hash value of the toric variety.

Example

We compute the hash value of a toric variety. Also, we construct a set and a dictionary with a toric variety, which make use of the hash function.

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()
v = t.get_toric_variety()
h = hash(v) # Obtain hash value
d = {v: 1} # Create dictionary with toric variety keys
s = {v} # Create a set of toric varieties

__init__

Description: Initializes a ToricVariety object.

Arguments:

  • triang (Triangulation): A star triangulation.

Returns: Nothing.

Example

This is the function that is called when creating a new ToricVariety object. We construct a ToricVariety 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 via the get_toric_variety function of the Triangulation class. In this example we obtain P4\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()
v = t.get_toric_variety()
# A smooth compact 4-dimensional toric variety with 5 affine patches

__ne__

Description: Implements comparison of toric varieties with !=.

Arguments:

  • other (ToricVariety): The other toric variety that is being compared.

Returns: (bool) The truth value of the toric varieties being different.

Example

We construct two toric varieties and compare them.

p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-1,-1]])
t1 = p.triangulate(backend="qhull")
v1 = t1.get_toric_variety()
t2 = p.triangulate(backend="topcom")
v2 = t2.get_toric_variety()
v1 != v2
# False

__repr__

Description: Returns a string describing the toric variety.

Arguments: None.

Returns: (str) A string describing the toric variety.

Example

This function can be used to convert the toric variety to a string or to print information about the toric variety.

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()
v = t.get_toric_variety()
var_info = str(v) # Converts to string
print(v) # Prints toric variety info
# A smooth compact 4-dimensional toric variety with 5 affine patches

_compute_mori_rays_from_intersections

Description: Computes the Mori cone rays of the variety using intersection numbers.

note

This function should generally not be called by the user. Instead, it is called by the mori_cone function when the user wants to save some time if the intersection numbers were already computed.

Arguments: None.

Returns: (numpy.ndarray) The list of generating rays of the Mori cone of the toric variety.

Example

This function is not intended to be directly used, but it is used in the following example. We construct a toric variety and compute the Mori cone using its intersection numbers.

p = Polytope([[1,0,0,0,0],[0,1,0,0,0],[0,0,1,0,0],[0,0,0,1,0],[0,0,0,0,1],[-1,-1,-6,-9,-18]])
t = p.triangulate()
v = t.get_toric_variety()
v.mori_cone(from_intersection_numbers=True)
# A 5-dimensional rational polyhedral cone in RR^11 generated by 14 rays

_compute_mori_rays_from_intersections_4d

Description: Computes the Mori cone rays of the variety using intersection numbers.

notes
  • This function should generally not be called by the user. Instead, this is called by the mori_cone function when when the user wants to save some time if the intersection numbers were already computed.
  • This function is a more optimized version for 4D toric varieties.

Arguments: None.

Returns: (numpy.ndarray) The list of generating rays of the Mori cone of the toric variety.

Example

This function is not intended to be directly used, but it is used in the following example. We construct a toric variety and compute the Mori cone using its intersection numbers.

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(from_intersection_numbers=True)
# A 2-dimensional rational polyhedral cone in RR^7 generated by 3 rays

_construct_intnum_equations

Description: Auxiliary function used to compute the intersection numbers of the toric variety.

Arguments: None.

Returns: (tuple) A tuple where the first component is a sparse matrix M, the second is a vector C, which are used to solve the system M*X=C, the third is the list of intersection numbers not including self-intersections, and the fourth is the list of intersection numbers that are used as variables in the equation.

Example

This function is not intended to be directly used, but it is used in the following example. We construct a toric variety and compute its intersection numbers.

p = Polytope([[1,0,0,0,0],[0,1,0,0,0],[0,0,1,0,0],[0,0,0,1,0],[0,0,0,0,1],[-1,-1,-6,-9,-18]])
t = p.triangulate()
v = t.get_toric_variety()
intnums = v.intersection_numbers()

_construct_intnum_equations_4d

Description: Auxiliary function used to compute the intersection numbers of the toric variety. This function is optimized for 4D varieties.

Arguments: None.

Returns: (tuple) A tuple where the first component is a sparse matrix M, the second is a vector C, which are used to solve the system M*X=C, the third is the list of intersection numbers not including self-intersections, and the fourth is the list of intersection numbers that are used as variables in the equation.

Example

This function is not intended to be directly used, but it is used in the following example. We construct a toric variety and compute its intersection numbers.

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()