application: atint
a-tint is an application for polymake (see http://polymake.mathematik.tu-darmstadt.de). It aims to implement algorithmic aspects of tropical intersection theory. Tropical varieties are realized as weighted polyhedral complexes. This project is part of and financed by the DFG Priority Project SPP 1489 (see also http://www.computeralgebra.de/index.php) For more information see https://bitbucket.org/hampe/atint/
imports from: common, graph
uses: fan, group, matroid, polytope, topaz
Objects
- derived from: RationalFunction
A special case of a rational function, a tropical polynomial (using either min or max)
Properties of MinMaxFunction
- CONSTANT_COEFFICIENTS: common::Vector<Rational>
A vector of the constant coefficients of the function. The i-th entry is the constant term of the function represented by the i-th row of LINEAR_COEFFICIENTS.
- DOMAIN_DIMENSION: common::Int
The dimension n of the domain Rn of the function. Is equal to the columns of LINEAR_COEFFICIENTS
- FUNCTION_MATRIX: common::Matrix<Rational, NonSymmetric>
This is simply the concatenation of LINEAR_COEFFICIENTS and CONSTANT_COEFFICIENTS
- INPUT_STRING: common::String
The syntax for STRING in pseudo-regex is the following (after deleting any whitespace): "(min|max)(\(|\{)(SUM)+(,SUM)*(\)|\})" where SUM = "(TERM)+([\+\-](TERM))*" where TERM = (RAT)|(RAT[:alpha:][^\+,\)]*) where RAT is any string that can be parsed to a polymake Rational and does not contain any letters. To make this more comprehensible: STRING takes anything of the form min(...) or max(...) (or min{...}, max{...}), where ... is a comma-separated list of strings of the form a + bx + cy + ... , where a,b,c are rational numbers and x,y are variables. Any string that starts with a letter and does not contain "+" or "," can be a variable. Such a sum can contain several such terms for the same variable and they need not be in any order. A term can be of the form "3x", "3*x", but "x3" will be interpreted as 1 * "x3". Coefficients should not contain letters, i.e. 3E10*x would be interpreted as 3 * "E10*x". Empty terms are allowed. If no INPUT_VARS are given, MinMaxFunction will recognize the dimension of the domain from the number of variables and will assign the variables to the standard basis vectors by sorting them alphabetically. E.g. INPUT_STRING=>"min(x+2z,3+z)",INPUT_VARS=>["x","y","z"] is a different function than INPUT_STRING=>"min(x+2z,3+z)", since the second is the function f:R² -> R, (a,b) -> min(a+2b,3+b) and the first is f: R³->R, (a,b,c)->min(a+2c,3+c) If however, INPUT_VARS is given, the parser will *ignore* any terms containing variables that are not defined in INPUT_VARS. The variables will be assigned to the standard basis vectors in order of their appearance in INPUT_VARS. E.g. INPUT_STRING=>"min(x+2c,3+x)",INPUT_VARS=>["x","y"] will give the function f:R²->R, (a,b) -> min(a,3+a) Note that ANY whitespace in INPUT_STRING is ignored, as well as any brackets '(',')' besides the ones enclosing the function list.
- INPUT_VARS: common::Array<String>
A list of strings that are variables. Any string that starts with a letter (i.e. [a-zA-Z]) and does not contain '+' or ',' can be a variable. Illegal variable names will not cause an error, but the parser will not detect them in INPUT_STRING, so their coefficients will be 0. If you assign a value to this, only terms with variables in this array will be parsed. Note that ANY whitespace in a variable name will be ignored. The i-th element of this array will be assigned to the i-th standard basis vector. You might want to use input_vars for defining this property.
- LINEAR_COEFFICIENTS: common::Matrix<Rational, NonSymmetric>
A matrix of the linear coefficients of the functions. Each row corresponds to a linear function within the min or max and the entry in column j is the coefficient of variable x_j
- NORMAL_FAN: WeightedComplex
This computes the normal fan of the polytope conv( (c_i,a_i) ) in Q^{n+1}, where the function is max/min(a_i*x + c_i,i=1,..,k) with a_i in Q^n and c_i in Q. (For min it actually computes the negative of the normal fan)
- STANDARD_FORM: common::String
This will give a nice string representation of the function, where all variables are of the form 'x_i', i = 1,..,DOMAIN_DIMENSION. There are no redundancies and terms are sorted in ascending alphabetic order of their variable, with the constant term at the end
- USES_MIN: common::Bool
Indicates whether this function uses min (TRUE) or max (FALSE). The default (if you directly give a coefficient matrix, but not this value) is FALSE
User Methods of MinMaxFunction
- linearityDomains () → WeightedComplex
This computes the (homogenized version of the) domains of linearity of the function. More precisely, it computes the normal fan of the polytope defined by this function in the following way: If the standard form reads max(a_i*x + c_i,i=1,..,k) with a_i in Q^n and c_i in Q, then the polytope is conv( (c_i,a_i) ) in Q^{n+1} (in homog. coordinates its actually in n+2 coordinates). In fact, this simply returns the property DOMAIN. It is kept for backwards compatibility.
Returns
WeightedComplex - pow (k) → MinMaxFunction
Does the same as pow for RationalFunction, i.e. returns the same function but with a given internal power
Parameters
Int k The new power of this function, i.e. using it in a divisorial expression will be interpretes as applying it k timesReturns
MinMaxFunction - valueAt (point) → Rational
Computes the value of this function at a given point. If the point has dimension DOMAIN_DIMENSION, it simply computes the value. If it has dimension DOMAIN_DIMENSION +1, it assumes the point is given in homogeneous coordinates (i.e. the first coordinate should be one or zero, this is not checked, however) and computes the function value of the last DOMAIN_DIMENSION coordinates.
- reduce () → MinMaxFunction
Takes a MinMaxFunction and reduces its terms to the necessary ones. That means it computes the newton polytope and returns a function that has only terms corresponding to the vertices.
Returns
MinMaxFunction The reduced version of the function
This represents a morphism as a "rational function to Rn", i.e. it is given via its DOMAIN and RAY_VALUES and LIN_VALUES now lying in some Rn instead of R. The user has to take care that the function is locally linear, this is not checked in any way.
Properties of Morphism
- DOMAIN: WeightedComplex
This property describes the domain of the morphism. I.e. the morphism is defined on this complex and is locally affine integral linear. It is of type WeightedComplex, but actually only the basic geometric properties RAYS/CMPLX_RAYS,MAXIMAL_CONES/CMPLX_MAXIMAL_CONES,LINEALITY_SPACE and USES_HOMOGENEOUS_C are of any interest. Further properties are ignored and can be omitted during generation.
- IS_GLOBAL: common::Bool
- LIN_VALUES: common::Matrix<Rational, NonSymmetric>
The vector in row i describes the function value (slope) of DOMAIN->LINEALITY_SPACE->row(i)
- RAY_VALUES: common::Matrix<Rational, NonSymmetric>
The vector at row i describes the function value of ray DOMAIN->CMPLX_RAYS->row(i). More precisely, if the corresponding ray is a vertex, it describes its function value. If it is a directional ray, it describes the slope on that ray.
- TRANSLATE: common::Vector<Rational>
If the morphism is a global affine linear map x |-> Ax+v, i.e. IS_GLOBAL is or should be true, then this contains the translation vector v (in non-homog. coordinates). If MATRIX is set, but this property is not set, then it is the zero vector by default.
User Methods of Morphism
- homogenize ()
If the domain of the function is in homogeneous coordinates, it returns the function. Otherwise it homogenizes the domain and assigns the value (0,..,0) to the additional vertex at the origin
- restrict (f, domain) → Morphism
Restricts a morphism / rational function to a given domain (which should be contained in the DOMAIN of the function)
Parameters
Morphism f (or RationalFunction) The function to be restrictedWeightedComplex domain The domain to which the function should be restrictedReturns
Morphism or RationalFunction The restricted function
- BB_VISUAL ()
Visualizes the domain of the morphism. Works exactly as BB_VISUAL of WeightedComplex, but has additional option @options
Options
String FunctionLabels If set to "show", textual function representations are diplayed on cones. False by defaultoption list: Visual::WeightedComplex::FunctionDecorations
An n-marked rational curve, identified by its SETS, i.e. its partitions of {1,...,n} and its COEFFS, i.e. the length of the corresponding edge
Properties of RationalCurve
- COEFFS: common::Vector<Rational>
A list of positive rational coefficients. The list should have the same length as SETS and contain only entries > 0. The i-th entry then gives the length of the bounded edge defined by the i-th partition. If you're not sure if all your coefficients are > 0, use INPUT_SETS and INPUT_COEFFS instead. Note that the zero curve (i.e. no bounded edges, only leaves) is represented by one empty set with corresponding lenghth 0.
- SETS: common::IncidenceMatrix<NonSymmetric>
A list of partitions of [n] that define the tree of the curve: For each bounded edge we have the corresponding partition of the n leaves. These should be irredundant. If you want to input a possibly redundant list, use INPUT_SETS and INPUT_COEFFS instead. The number of marked leaves should always be given by N_LEAVES. The sets are subsets of {1,...,n} (NOT {0,..,n-1}!) Note that the zero curve (i.e. no bounded edges, only leaves) is represented by one empty set with corresponding lenghth 0.
- GRAPH_EDGE_LENGTHS: common::Vector<Rational>
- NODES_BY_LEAVES: common::IncidenceMatrix<NonSymmetric>
This incidence matrix gives a list of the vertices of the curve Each row corresponds to a vertex and contains as a set the [[LEAVES] that are attached to that vertex (again, counting from 1!)
- NODES_BY_SETS: common::IncidenceMatrix<NonSymmetric>
This incidence matrix gives a list of the vertices of the curve Each row corresponds to a vertex and contains as a set the row indices of the SETS that correspond to edges attached to that vertex
- NODE_DEGREES: common::Vector<Int>
This gives a list of the vertices of the curve in terms of their valences They appear in the same order as in NODES_BY_LEAVES or NODES_BY_SETS
- INPUT_COEFFS: common::Vector<Rational>
Same as COEFFS, except that entries may be <=0. This should have the same length as INPUT_SETS.
- INPUT_SETS: common::IncidenceMatrix<NonSymmetric>
Same as SETS, except that sets may appear several times.
- INPUT_STRING: common::String
This property can also be used to define a rational curve: A linear combination of partitions is given as a string, using the following syntax: A partition is given as a subset of {1,..,n} and written as a comma-separated list of leaf indices in round brackets, e.g. "(1,2,5)" A linear combination can be created using rational numbers, "+","+" and "-" in the obvious way, e.g. "2*(1,2,5) + 1*(3,4,7) - 2(1,2) (The "*" is optional) Of course, each set should contain at least two elements. If you don't specify N_LEAVES, it is set to be the largest leaf index occuring in the sets. Partitions needn't be irredundant and coefficients can be any rational number. If the resulting element is not in the moduli space, an error is thrown.
User Methods of RationalCurve
- matroid_vector () → Vector<Rational>
Computes the coordinates of the curve in the moduli space given in matroid coordinates. In the isomorphism of the metric curve space and the moduli coordinates the last leaf is considered as the special leaf
Returns
Vector<Rational> - metric_vector ()
Returns the (n over 2) metric vector of the rational n-marked curve
- VISUAL ()
Visualizes a RationalCurve object. This visualization uses the VISUAL method of its GRAPH, so it accepts all the options of Visual::Graph::decorations. In addition it has another option @options
Options
String LengthLabels If "hidden", the edges are not labelled with their lengths. Any other text is ignored. Not set to "hidden" by default.option list: Visual::RationalCurve::decorations
A rational function on a polyhedral complex. It is given by its DOMAIN, a WeightedComplex and values on this domain, i.e. RAY_VALUES and LIN_VALUES
Properties of RationalFunction
- DOMAIN: WeightedComplex
This property describes the linearity domains of the function. I.e. the function is affine integral linear on each maximal cone of DOMAIN. It is of type WeightedComplex, but actually only the basic geometric properties RAYS/CMPLX_RAYS,MAXIMAL_CONES/CMPLX_MAXIMAL_CONES,LINEALITY_SPACE and USES_HOMOGENEOUS_C are of any interest. Further properties are ignored and can be omitted upon generation.
- LIN_VALUES: common::Vector<Rational>
The value at index i describes the function value of DOMAIN->LINEALITY_SPACE->row(i)
- POWER: common::Int
This property describes how many times a function should be applied, if it occurs in a divisor term E.g. if you create a MinMaxFunction f and you set its POWER property to 2, a call to divisor(X,f) actually computes f*f*X
- RAY_VALUES: common::Vector<Rational>
The value at index i describes the function value of ray DOMAIN->CMPLX_RAYS->row(i). More precisely, if the corresponding ray is a vertex, it describes its function value. If it is a directional ray, it describes the slope on that ray.
User Methods of RationalFunction
- homogenize ()
If the domain of the function is in homogeneous coordinates, it returns the function. Otherwise it homogenizes the domain and assigns the value 0 to the additional vertex at the origin
- BB_VISUAL ()
Visualizes the domain of the function. Works exactly as BB_VISUAL of WeightedComplex, but has additional option @options
Options
String FunctionLabels If set to "show", textual function representations are diplayed on cones. False by defaultoption list: Visual::WeightedComplex::FunctionDecorations
- derived from: fan::PolyhedralFan<Rational>
A weighted complex, derived from fan::PolyhedralFan. Complexes are realized by using homogeneous coordinates (i.e. adding a 1 to the front of all vertices and a 0 to all rays) and setting USES_HOMOGENEOUS_C to true
Properties of WeightedComplex
- INPUT_HOM_LINEALITY: common::Matrix<Rational, NonSymmetric>
USE IS NOT RECOMMENDED, since TROPICAL_WEIGHTS are always given with respect to MAXIMAL_CONES anyway. A matrix of generators of the lineality space, but in homogeneous coordinates (i.e. x0 should be 0, otherwise this throws an error). This should be used *instead of* INPUT_LINEALITY / LINEALITY_SPACE
- INPUT_HOM_RAYS: common::Matrix<Rational, NonSymmetric>
USE IS NOT RECOMMENDED, since TROPICAL_WEIGHTS are always given with respect to MAXIMAL_CONES anyway. A matrix of the rays of the fan. This should be used *instead of* INPUT_RAYS, if the coordinates of the fan should be interpreted as homogeneous coordinates and the fan as the complex at x0 = 1. The input rays are normalized to x0 = 1 and the fan is then initialized with the normalized rays as INPUT_RAYS. INPUT_CONES can be combined with this as usual. If your rays are already homogenized and you are sure they are also your rays, you can directly put this into RAYS and manually set USES_HOMOGENEOUS_C=>TRUE
- IS_UNIMODULAR: common::Bool
This property is not computed anywhere but should be set to TRUE by the user upon initialization, if all cones of the fan are unimodular in the sense that ANY linearly independent subset of their rays generates the lattice of the cone. Note that this property is only considered if USES_HOMOGENEOUS_C is false. If USES_HOMOGENEOUS_C is true, this property is implicitly assumed to be false. If this property is TRUE, LATTICE_GENERATORS and LATTICE_BASES can be computed much faster.
- LATTICE_BASES: common::IncidenceMatrix<NonSymmetric>
This incidence matrix gives a lattice basis for each maximal cone. More precisely it gives a lattice basis whose span contains the lattice of the maximal cone. Row i corresponds to cone i and gives lattice generator indices referring to LATTICE_GENERATORS If this property is computed via rules, it does indeed give a lattice basis for the cone lattice, but when it is computed during an operation like refinement or divisor it will in general be larger. If this property exists, lattice normals might be computed faster. If you create a variety with the property IS_UNIMODULAR set to TRUE, then this will simply be a copy of MAXIMAL_CONES
- LATTICE_GENERATORS: common::Matrix<Integer, NonSymmetric>
This is an irredundant list of all lattice generators of all maximal cones If this property exists, lattice normals might be computed faster If you create a variety with the property IS_UNIMODULAR set to TRUE, then this will simply be a copy of RAYS (made primitive integer)
- LATTICE_NORMALS: common::Map<Int, Map<Int, Vector<Integer>>>
A list of lattice normal vectors. They are associated to the faces and maximal cones in the following way: For codimension one face i and adjacent maximal cone j, the element LATTICE_NORMALS->{i}->{j} is the corresp. lattice normal vector. There is a convenience method lattice_normal(i,j) If USES_HOMOGENEOUS_C is TRUE, this actually computes a lattice normal of the cone (face i)\cap {x0 =1} wrt the cone (maximal cone j) \cap {x0=1} to ensure that the normal is of the form (0,...) If there is a LOCAL_RESTRICTION, only lattice normals for compatible codim one faces are computed (naturally, since CODIM_1_FACES only contains those)
- LATTICE_NORMAL_FCT_VECTOR: common::Map<Int, Map<Int, Vector<Rational>>>
For each lattice normal vector, this gives a vector of length (number of rays) + (lineality dim.), such that if a rational function is given by values on the rays and lin space generators, the value of the corresponding normal LATTICE_NORMALS->{i}->{j} can be computed by multiplying the function value vector with the vector LATTICE_NORMAL_FCT_VECTOR->{i}->{j}. This is done in the following way: If this fan does not use homogeneous coordinates, it computes a representation of the lattice normal in the generating system consisting of the rays of MAXIMAL_CONES->row(j) and the generators of the lineality space. It then inserts the coefficients of the representation at the right position. If the fan uses homog. coordinates, however, we use a different generating system (and indices refer to CMPLX_RAYS) <(r_i-r_0)_i>0, s_j, l_k>, where r_0 is the ray of the maximal cone with the lowest index in CMPLX_RAYS, such that it fulfills x0 = 1, r_i are the remaining rays with x0 = 1, ordered according to their index in CMPLX_RAYS, s_j are the rays of the cone with x0 = 0 and l_k are the lineality space generators. We will then store the coefficients a_i of (r_i - r_0) at the index of r_i, then - sum(a_i) at the index of r_0 and the remaining coefficients at the appropriate places. In particular, the value of a lattice normal under a rational function can be computed simply by taking the scalar product of RAY_VALUES | LIN_VALUES with ist FCT_VECTOR
- LATTICE_NORMAL_SUM: common::Matrix<Rational, NonSymmetric>
Rows of this matrix correspond to CODIM_1_FACES, and each row contains the weighted sum: sum_{cone > codim-1-face}( weight(cone) * LATTICE_NORMALS->{codim-1-face}->{cone})
- LATTICE_NORMAL_SUM_FCT_VECTOR: common::Matrix<Rational, NonSymmetric>
Rows of this matrix correspond to CODIM_1_FACES (or CMPLX_CODIM_1_FACES in the homog. case), and each row contains a function vector for the corresponding row of LATTICE_NORMAL_SUM. This function vector is computed in the same way as described under LATTICE_NORMAL_FCT_VECTOR. Note that for any codim-1-faces at which the complex is not balanced, the corresponding row is a zero row If a face is balanced can be checked under BALANCED_FACES.
- CMPLX_AMBIENT_DIM: common::Int
Returns the ambient dimension of the polyhedral complex. In the case of non-homogeneous coordinates, this is just FAN_AMBIENT_DIM, otherwise FAN_AMBIENT_DIM-1
- CMPLX_CODIMENSION: common::Int
Returns the codimension of the polyhedral complex in its ambient vector space. More precisely, this value is equal to CMPLX_AMBIENT_DIM - CMPLX_DIM
- CMPLX_CODIM_1_FACES: common::IncidenceMatrix<NonSymmetric>
An incidence matrix describing which codim 1 cone in the complex at x0 = 1 is generated by which rays. Each row corresponds to a codimension one cone (More precisely, the i-th element represents the same codim 1 cone as the i-th element of CODIM_1_FACES). The indices in a row refer to rows of CMPLX_RAYS, i.e. the cone cone described by the i-th element is generated by the rays corresponding to these row indices. If the fan does not use homogeneous coordinates, it is just a copy of CODIM_1_FACES.
- CMPLX_CONES: common::IncidenceMatrix<NonSymmetric>
This incidence matrix describes the complete polyhedral complex, i.e. it contains all faces of the polyhedral complex
- CMPLX_CONVERSION_VECTOR: common::Vector<Int>
A vector with an entry for each row in CMPLX_RAYS. More precisely, the i-th entry gives the row index of the ray in RAYS that is equal to the i-th row of CMPLX_RAYS.
- CMPLX_DIM: common::Int
Returns the dimension of the polyhedral complex. In the case of non-homogeneous coordinates, this is just DIM, otherwise DIM-1. When computing this property, it is assumed that the complex is pure.
- CMPLX_MAXIMAL_CONES: common::IncidenceMatrix<NonSymmetric>
An incidence matrix describing which maximal cone in the complex at x0 = 1 is generated by which rays. Each row corresponds to a maximal cone (More precisely, the i-th element represents the same maximal cone as the i-th element of MAXIMAL_CONES). The indices in a row refer to rows of CMPLX_RAYS, i.e. the maximal cone described by the i-th element is generated by the rays corresponding to these row indices. If the fan does not use homogeneous coordinates, it is just a copy of MAXIMAL_CONES
- CMPLX_RAYS: common::Matrix<Rational, NonSymmetric>
If the fan does not use homogeneous coordinates, this is just a copy of RAYS and actually needn't be requested. Otherwise this computes a matrix of rays of the complex obtained by intersecting the fan with {x0 = 1}. More precisely, each ray r from RAYS occurs as a row in this matrix... - once, if r_0 = 1 - k times, if r_0 = 0 and k is the number of equivalence classes of maximal cones containing r with respect to the following relation: Two maximal cones m, m' containing r are equivalent, if they are equal or there exists a sequence of maximal cones m = m_1,...m_r = m', such that r is contained in each m_i and each intersection m_i cap m_i+1 contains at least one ray s with s_0 = 1. The reason for this is that, when specifying a piecewise affine linear function on a polyhedral complex, the same directional ray with x0 = 0 might be assigned two different values, if it is contained in two "non-connected" maximal cones (where connectedness is to be understood as described above). If there is a LOCAL_RESTRICTION the above equivalence relation is changed in such a way that the affine ray s with s_0 = 1 that must be contained in the intersection of two subsequent cones must be a compatible ray
- CODIM_1_FACES: common::IncidenceMatrix<NonSymmetric>
An incidence matrix of all codimension one faces. Each row is a face and column indices refer to RAYS. If the fan uses homogeneous coordinates, only those faces that intersect {x0 = 1} are listed here. If there is a LOCAL_RESTRICTION, only compatible codimension one faces are kept.
- CODIM_1_IN_MAXIMAL_CONES: common::IncidenceMatrix<NonSymmetric>
An incidence matrix indicating which codim 1 faces are contained in which maximal cone. Rows refer to (rows of) CODIM_1_FACES, columns to (rows of) MAXIMAL_CONES
- DIRECTIONAL_RAYS: common::Set<Int>
Computes the subset of row indices of RAYS, such that the corresponding rows describe a directional ray of the complex. This set contains all row indices if USES_HOMOGENEOUS_C is false and is the complement of VERTICES
- LOCAL_RESTRICTION: common::IncidenceMatrix<NonSymmetric>
This contains a list of sets of ray indices (referring to RAYS). All of these sets should describe cones of the polyhedral complex (though not necessarily maximal ones). A cone is now called compatible with this property, if contains one of these cones If this list is not empty, all computations will be done only on (or around) compatible cones. The documentation of each property will explain in what way this restriction is enforced. If this list is empty or not defined, there is no restriction. Careful: The implementation assumes that ALL maximal cones are compatible. If in doubt, you can create a complex with a local restriction from a given complex by using one of the "local_..." creation methods This list is assumed to be irredundant, i.e. there are no doubles (though this should not break anything, it is simply less efficient). It is, however, possible that one element is a subset of another.
- USES_HOMOGENEOUS_C: common::Bool
Indicates whethere this fan's coordinates should be interpreted as affine coordinates or as homogeneous coordinates. In the latter case the fan would actually represent the polyhedral complex that comes from intersecting the fan (in affine coordinates) with the affine hyperplane x0 = 1. This property should not be set manually. It will be set as true, if INPUT_HOM_RAYS or INPUT_HOM_LINEALITY are used and to false, if INPUT_RAYS or INPUT_LINEALITY are used.
- VERTICES: common::Set<Int>
Computes the subset of row indices of RAYS, such that the corresponding rows describe a vertex of the complex. This set is empty if USES_HOMOGENEOUS_C is false and is the complement of DIRECTIONAL_RAYS
- BALANCED_FACES: common::Vector<Bool>
A vector whose entries correspond to the rows of CODIM_1_FACES. The i-th entry is true, if and only if the complex is balanced at that face
- DEGREE: common::Integer
The degree of the tropical variety, i.e. the weight of the intersection product with an appropriate tropical linear space.
- IS_BALANCED: common::Bool
Indicates whether the fan is balanced with the given TROPICAL_WEIGHTS. If there is a LOCAL_RESTRICTION, this will only be checked at the compatible codim one faces.
- TROPICAL_WEIGHTS: common::Vector<Integer>
Vector of (integer) weights for maximal cones. Indices refer to (the rows of) MAXIMAL_CONES Note that, if the fan only consists of a lineality space, it specifies the weight of the single empty maximal cone
- WEIGHT_SPACE: common::Matrix<Integer, NonSymmetric>
A Z-basis (as rows) for the space of weight distributions on this tropical cycle making it balanced (i.e. this cycle is irreducible, if and only if WEIGHT_SPACE has only one row and the gcd of TROPICAL_WEIGHTS is 1.
User Methods of WeightedComplex
- lattice_normal (i, j) → The
- dehomogenize ()
Assuming that this weighted complex is actually a fan, given in homogeneous coordinates, it will convert it to non-homogeneous coordinates. This will return an error, if the complex has more than one vertex. Local restriction is also adapted.
- homogenize () → If
Transforms the fan into homogeneous coordinates
Returns
If this fan uses homog. coordinates, returns the fan itself, Otherwise it will replace the ray matrix by the following matrix: [0,ray] for any ray of the original fan and one affine ray [1,0,...0] appended. In MAXIMAL_CONES all get the additional affine ray and TROPICAL WEIGHTS is simply copied. Local restriction is adapted as well.
- invert () → WeightedComplex
Takes a WeightedComplex and multiplies all rays / vertices with -1.
Returns
WeightedComplex w The inverted complex
- delocalize (w) → WeightedComplex
Takes a WeightedComplex and returns the same complex, but without any LOCAL_RESTRICTION
- BB_VISUAL ()
Displays a (possibly weighted) polyhedral complex by intersecting it with a bounding box. This bounding box is either defined by the vertices of the complex and the option "BoundingDistance" or explicitly given by "BoundingBox" and by setting "BoundingMode" to "absolute" @options
Options
String WeightLabels If "hidden", no weight labels are displayed. Not hidden by default.String CoordLabels If "show", coordinate labels are displayed at vertices. Hidden by default.String BoundingMode Can be "relative" (intersects with the bounding box returned by the method boundingBox(BoundingDistance)) or "absolute" (intersects with the given BoundingBox). "relative" by default.Rational BoundingDistance The distance parameter for relative bounding modeMatrix<Rational> BoundingBox The bounding parameter for absolute bounding modeoption list: Visual::WeightedComplex::BoundingDecorations - boundingBox (distance) → Matrix<Rational>
Takes a tropical variety and a (positive) Rational as input and computes the relative bounding box of the visualization with the Rational as BoundingDistance. I.e. will compute for each coordinate the minimum and maximum over all vertices and then add/substract the parameter distance. This is returned as a matrix. (see also the description of BB_VISUAL),
Parameters
Rational distance The distance of the bounding box from the affine part of the variety (Can also be a standard perl number type)Returns
Matrix<Rational> A 2xCMPLX_AMBIENT_DIM-matrix specifying the bounding box (it can be used as input for BoundingBox in BB_VISUAL) - CMPLX_VISUAL ()
DEPRECATED. Use BB_VISUAL instead. Displays a weighted polyhedral complex in ambient dimension up to 3 (4 in homog. coordinates) by visualizing all its cells in the following way: For each cell, every directional ray is added to every affine ray (which is only the origin in the non-homog. case) and the resulting polytope is displayed. The visualization has the following options: @options
Options
Rational DirScale A rational number with which the directional rays are multiplied before added to the affine raysString WeightLabels if set to "hidden", the labels indicating the weights are hiddenString CoordLabels If set to "show", the labels indicating the vertex coordinates are displayed, otherwise they are not. Note that this is expensive and significantly increases computation time.option list: Visual::WeightedComplex::decorations
User Functions
- curve_graph_from_metric (v) → An
Takes a vector from Q^(n over 2) that describes an n-marked rational abstract curve as a distance vector between its leaves. It then computes the graph of the curve corresponding to this vector.
Parameters
Vector<Rational> v A vector of length (n over 2). Its entries are interpreted as the distances d(i,j) ordered lexicographically according to i,j. However, they need not be positive, as long as v is equivalent to a proper metric modulo leaf lengths.Returns
An array containing first the graph::Graph and then a Vector<Rational>, containing the lengths of the bounded edges (in the order they appear in EDGES) - insert_leaves (curve, nodes)
Takes a RationalCurve and a list of node indices. Then inserts additional leaves (starting from N_LEAVES+1) at these nodes and returns the resulting RationalCurve object
Parameters
RationalCurve curve A RationalCurve objectVector<Int> nodes A list of node indices of the curve - rational_curve_embedding (delta, type) → WeightedComplex
This function creates an embedding of a rational tropical curve using a given abstract curve and degree
Parameters
Matrix<Rational> delta The degree of the curve in non-homogeneous coordinates. The number of rows should correspond to the number of leaves of type and the number of columns is the dimension of the space in which the curve should be realizedRationalCurve type An abstract rational curveReturns
WeightedComplex The corresponding embedded complex, weighted with 1. The position of the curve is determined by the first node, which is always placed at the origin - rational_curve_from_cone (X, n_leaves, coneIndex) → RationalCurve
This takes a weighted complex X that is supposed to be of the form M_0,n x Y for some Y (It assumes that M_0,n occupies the first coordinates) and an index of a maximal cone of that complex. It then computes a rational curve corresponding to an interior point of that cone (ignoring the second component Y)
Parameters
WeightedComplex X A weighted complex of the form M_0,n x YInt n_leaves The n in M_0,n. Needed to determine the dimension of the M_0,n componentInt coneIndex The index of the maximal coneReturns
RationalCurve c The curve corresponding to an interior point - rational_curve_from_metric (v) → RationalCurve
Takes a vector from Q^(n over 2) that describes an n-marked rational abstract curve as a distance vector between its leaves. It then computes the curve corresponding to this vector.
Parameters
Vector<Rational> v A vector of length (n over 2). Its entries are interpreted as the distances d(i,j) ordered lexicographically according to i,j. However, they need not be positive, as long as v is equivalent to a proper metric modulo leaf lengths.Returns
RationalCurve - rational_curve_from_moduli (v) → RationalCurve
Takes a vector from Q^((n over 2) - n) that lies in M_0,n (in its matroid coordinates and computes the corresponding rational curve. In the isomorphism of the metric curve space and the moduli coordinates the last leaf is considered as the special leaf
- rational_curve_from_rays (rays, uses_homog) → RationalCurve
This takes a matrix of rays of a given cone that is supposed to lie in a moduli space M_0,n and computes the rational curve corresponding to an interior point. More precisely, if there are k vertices in homogeneous coordinates, it computes 1/k * (sum of these vertices), then it adds each directional ray. It then returns the curve corresponding to this point
Parameters
Matrix<Rational> rays The rays of the cone, in homog. or non-homog. coordinates.Bool uses_homog Whether the rays are given in homog. coordinates False by defaultReturns
RationalCurve c The curve corresponding to an interior point - rational_curve_list_from_metric (m) → RationalCurve
Takes a matrix whose rows are metrics of rational n-marked curves. Returns a list, where the i-th element is the curve corr. to the i-th row in the matrix
- rational_curve_list_from_moduli (m) → RationalCurve
Takes a matrix whose rows are elements in the moduli space M_0,n in matroid coordinates. Returns a list, where the i-th element is the curve corr. to the i-th row in the matrix
- sum_curves (An, v) → RationalCurve
This function takes a vector of coefficients a_i and a list of RationalCurves c_i and computes sum(a_i * c_i). In particular, it also checks, whether the result lies in M_0,n. If not, it returns undef
Parameters
RationalCurve An arbitrary list of RationalCurve objectsVector<Rational> v A list of coefficients. Superfluous coefficients are ignored, missing ones replaced by +1(!)Returns
RationalCurve The linear combination of the curves defined by the coefficients or undef, if the result is not in M_0,n. The history of the operation is kept in INPUT_SETS and INPUT_COEFFS - testFourPointCondition (v) → Int
Takes a metric vector in Q^{(n over 2)} and checks whether it fulfills the four-point condition, i.e. whether it lies in M_0,n. More precisely it only needs to be equivalent to such a vector
Parameters
Vector<Rational> v The vector to be checkedReturns
Int A quadruple (array) of indices, where the four-point condition is violated or an empty list, if the vector is indeed in M_0,n
- affineTransformation (complex, translate, matrix) → WeightedComplex
Takes a polyhedral complex and applies an affine linear transformation, given by a translate vector and a matrix. The method assumes the function is bijective (on the complex) and preserves cones, i.e. it just applies the transformation to the rays and lineality space and leaves the cones and weights unchanged.
Parameters
WeightedComplex complex The complex to be transformedVector<Rational> translate A vector whose dimension should be equal to the column dimension of the transformation matrixMatrix<Integer> matrix An integer matrixReturns
WeightedComplex The transformed complex, in homogeneous coordinates - coarsen (complex) → WeightedComplex
Takes a tropical variety on which a coarsest polyhedral structure exists and computes this structure.
Parameters
WeightedComplex complex A tropical variety which has a unique coarsest polyhedral structreReturns
WeightedComplex The corresponding coarse complex - fan_decomposition (complex) → perl::ListReturn
Take a polyhedral complex and returns a list of all the local vertex fans, i.e. for each affine ray r, the list contains the fan Star_complex(r) (in non-homogeneous coordinates) If the complex has a non-trivial LOCAL_RESTRICTION, only the local fans at compatible vertices are computed
Parameters
WeightedComplex complex A tropical varietyReturns
perl::ListReturn A list of WeightedComplex objects in non-homogeneous coordinates. The i-th complex corresponds to the i-th affine ray ( vertex). If the complex is not in homogeneous coordinates, the list contains just the complex itself - insert_rays (F, R) → WeightedComplex
Takes a polyhedral fan wihtout lineality and a list of rays and triangulates the fan such that it contains these rays
Parameters
WeightedComplex F A polyhedral fan (i.e. USES_HOMOGENEOUS_C = FALSE), possibly with weights but with no lineality spaceMatrix<Rational> R A list of normalized rays (as row vectors), which will be added to the fanReturns
WeightedComplex A triangulation of F that contains all the original rays of F plus the ones in R - intersect_complete_fan ()
DEPRECATED. Use intersect_container instead.
- intersect_container (fan, container, forceLatticeComputation) → WeightedComplex
Takes two fans and computes the intersection of both. The function relies on the fact that the latter fan contains the first fan to compute the refinement correctly The function copies TROPICAL_WEIGHTS and LATTICE_BASES if they exist
Parameters
WeightedComplex fan An arbitrary weighted polyhedral fanfan::PolyhedralFan container A polyhedral fan containing the first one (as a set)Bool forceLatticeComputation Whether the properties LATTICE_BASES and LATTICE_GENERATORS of fan should be computed before refining. False by default.Returns
WeightedComplex The intersection of both fans (whose support is equal to the support of fan). The resulting fan uses homogeneous coordinates if and only fan does. If fan has a property TROPICAL_WEIGHTS, the tropical weights of the refinement are also computed. If fan is zero-dimensional (i.e. a point), fan is returned. - product_complex (A) → the
Computes the cartesian product of a set of polyhedral fans. If any of them uses homogeneous coordinates, so will the result
Parameters
complexes A list of WeightedComplex objectsReturns
the cartesian product of the complexes. If any of the complexes use homogeneous coordinates, so does the result. If any of the complexex carries weights, the result carries the sum of the weights of its factors (Complexes without weights are treated as complexes with weight 1). If you want to compute the properties LATTICE_BASES and LATTICE_GENERATORS as cartesian products of the corr. properties of the complexes, use product_complex_lattice instead. - product_complex_lattice (A) → the
Computes the cartesian product of a set of polyhedral fans. If any of them uses homogeneous coordinates, so will the result
Parameters
complexes A list of WeightedComplex objectsReturns
the cartesian product of the complexes. If any of the complexes use homogeneous coordinates, so does the result. If any of the complexex carries weights, the result carries the sum of the weights of its factors (Complexes without weights are treated as complexes with weight 1). This function will precompute the properties LATTICE_BASES and LATTICE_GENERATORS for all complexes and the result will have the corr. properties set to the cartesian product of these - recession_fan (complex) → WeightedComplex
Computes the recession fan of a tropical variety. WARNING: This is a highly experimental function. If it works at all, it is likely to take a very long time.
Parameters
WeightedComplex complex A tropical variety. If it is a fan, the complex itself is returnedReturns
WeightedComplex A tropical fan, the recession fan of the complex - skeleton_complex (fan, k, preserveRays) → The
Takes a polyhedral complex and computes the k-skeleton. Will return an empty fan, if k is larger then the dimension of the given complex or smaller than 0.
Parameters
WeightedComplex fan A fan (or polyhedral complex)Int k The dimension of the skeleton that should be computedBool preserveRays When true, the function assumes that all rays of the fan remain in the k-skeleton, so it just copies the RAYS, instead of computing an irredundant list. This property can always be set to true, if fan is not in homogeneous coordinates or if the corresponding complex at x0 = 1 only has vertices. By default, this property is false.Returns
The k-skeleton of the fan (or complex, if USES_HOMOGENEOUS_C is true) - triangulateFan (F) → WeightedComplex
Takes a polyhedral fan and computes a triangulation
Parameters
WeightedComplex F A polyhedral fan (i.e. USES_HOMOGENEOUS_C = FALSE), possibly with weightsReturns
WeightedComplex A simplicial refinement of F - wfan (fan, homog) → WeightedComplex
This function takes a fan::PolyhedralFan and converts it into a WeightedComplex object.
Parameters
fan::PolyhedralFan fan The fan to be convertedBool homog Whether the fan is to be interpreted in homogeneous coordinatesReturns
WeightedComplex A complex with no weights but with the same geometry as fan.
- check_cycle_equality (X, Y, check_weights) → Bool
This takes two pure-dimensional polyhedral complexes and checks if they are equal i.e. if they have the same lineality space, the same rays (modulo lineality space) and the same cones. Optionally, it can also check if the weights are equal
Parameters
WeightedComplex X A weighted complexWeightedComplex Y A weighted complexBool check_weights Whether the algorithm should check for equality of weights. This parameter is optional and true by defaultReturns
Bool Whether the cycles are equal - contains_point (complex, point) → bool
Takes a weighted complex and a point and computed whether that point lies in the complex
Parameters
perl::Object complex A weighted complexVector<Rational> point An arbitrary vector in the same ambient dimension as complexReturns
bool Whether the point lies in the support of complex - is_zerocycle (c) → Bool
- halfspace_complex (constant, equation) → WeightedComplex
Creates the halfspace complex defined by an rational vector g and a rational b, i.e. the complex consisting of the two maximal cones g >= a and g <= a
Parameters
Rational constant The constant translation aVector<Rational> equation The defining equation gReturns
WeightedComplex The resultin halfspace complex - linear_nspace (n, weight) → WeightedComplex
Creates the tropical variety R^n as a single lineality space with a given weight
Parameters
int n The dimension of the linear spaceint weight The weight of the linear space (1, if none is given)Returns
WeightedComplex The resulting fan object in non-homog. coordinates - linear_space_by_basis (rowspace, weight) → WeightedComplex
Creates a tropical variety consisting of a single linear space defined by a matrix and assigns it a given weight.
Parameters
Matrix<Rational> rowspace A matrix whose rows span the lineality space of the fan (hence the whole fan) and which are assumed to be linearly independent. If you are not sure of this, call linear_space_by_matrix instead.int weight The weight of the linear space (1, if none is given)Returns
WeightedComplex The resulting fan object in non-homog. coordinates - linear_space_by_matrix (rowspace, weight) → WeightedComplex
Creates a tropical variety consisting of a single linear space defined by a matrix and assigns it a given weight.
Parameters
Matrix<Rational> rowspace A matrix whose rows span the lineality space of the fan (hence the whole fan). If you already know that your rows are a basis, call linear_space_by_basis instead.int weight The weight of the linear space (1, if none is given)Returns
WeightedComplex The resulting fan object in non-homog. coordinates - point_variety (point, weight) → WeightedComplex
Takes an n-dimensional vector and creates a subdivision of R^n into 2^n orthants with apex at the given vertex. This can for example be used to subdivide a given variety such that a certain vertex is contained in its polyhedral structure by intersecting with this variety
Parameters
Vector<Rational> point The apex of the variety in homogeneous coordinatesInt weight Optional. All cones will have this weight. 1 by defaultReturns
WeightedComplex The variety described above - tropical_cube (n, k) → WeightedComplex
Creates the tropical cube T^n_k, i.e. the tropical variety obtained by glueing together the 2^n L^n_k obtained by applying all possible sign changes, such that the vertices form the k-skeleton of the n-dimensional cube Alternatively, T^n_k can be seen as max(1,x_1,...,x_n,-x_1,...,-x_n)^(n-k) * R^n
- tropical_lnk (n, k) → WeightedComplex
Creates the linear tropical space L^n_k. This tropical fan is defined in the following way: As rays we take -e_i,i=1,...,n, where e_i is the i-th standard basis vector of R^n and e_0 = e_1 + ... + e_n. As maximal cones we take the cones generated by rays {e_i, i in S}, where S runs over all k-element subsets of {0,..,n}.
Parameters
Int n The ambient dimension of the fan.Int k The dimension of the fan (should be smaller equal n, otherwise an error is thrown).Returns
WeightedComplex A PolyhedralFan object representing L^n_k - zero_cycle ()
Returns the zero cycle, i.e. a weighted complex with no rays and cones
- divisor (X, f, k) → WeightedComplex
Takes as input a tropical variety X , a rational function f and optionally a positive integer k. It then computes f^k * X Note that this still produces a meaningful result, if the WeightedComplex is not balanced: The "divisor" of a given function is computed by taking all codim-1-faces, at which the complex is balanced and computing weights there.
Parameters
WeightedComplex X A tropical varietyRationalFunction f A rational function, defined on a DOMAIN that contains X. It can be in non-homog. coordinates, even if X is in homog. coordinates, but then its AMBIENT_DIM has to be equal to X->AMBIENT_DIM. Otherwise you will have to homogenize the function first.Int k Optional. A positive integer. Note that if k is given, this will actually ignore f->POWER. Is 1 by default.Returns
WeightedComplex The divisor f^k * X. It is given in homogeneous coordinates, if and only if: Either X is already in homogeneous coordinates or f is defined on a homogeneous DOMAIN (which is implicitly the case for ALL MinMaxFunctions) - divisorByPLF (fan, A) → The
NOTE: Deprecated. Use divisor(..) instead Computes the divisor of a MinMaxFunction on a given tropical variety. The result will be in homogeneous coordinates, whether the tropical variety uses them or not. The function should be given on the affine coordinates of the variety, NOT the homogeneous ones.
Parameters
WeightedComplex fan A tropical variety, on which the divisor is computedMinMaxFunction A function whose DOMAIN should be equal to the affine coordinate space of the variety, i.e. AMBIENT_DIM-1, if the variety uses homogeneous coordinates, AMBIENT_DIM otherwise.Returns
The corresponding divisor as a tropical variety in homogeneous coordinates. - divisorByValue (A, An) → The
NOTE: Deprecated. Use divisor(...) or divisor_nr(...) in conjunction with function_value instead Takes as input a tropical fan / tropical variety and an array of rational values. The array length should coincide with the number of CMPLX_RAYS of the fan plus the dimension of the lineality space and will be interpreted as a rational function, where each value has been assigned to the rays given by $fan->CMPLX_RAYS and to the generators given by $fan->LINEALITY_SPACE (in that order). Missing values will be filled up by 0's, superfluous ones will be ignored. The function will then compute the corresponding Weil divisor and return it as a tropical variety given as a fan. The fan uses homogeneous coordinates, if and only the input fan does. Note that this still produces a meaningful result, if the WeightedComplex is not balanced: The "divisor" of a given function is computed by taking all codim-1-faces, at which the complex is balanced and computing weights there.
Parameters
WeightedComplex A tropical variety on which the divisor is computed.values An array of rational values that define an integer affine map on the fan.Returns
The divisor of the function defined by values on the given fan, as a tropical variety. - divisor_list (X, A) → WeightedComplex
Takes as input a tropical variety and an arbitrarily long list of RationalFunction objects f_1,...,f_k. It will # then compute f_k^a_k * ... * f_1^a_1 * X, where a_i = f_i->POWER
Parameters
WeightedComplex X RationalFunction A list f_1,...,f_kReturns
WeightedComplex The divisor f_k * ... * f_1 * X. It is in homogeneous coordinates, if and only if: Either X is in homog. coordinates or one of the functions is defined on a homogeneous domain. - divisor_list_nr ()
Works exactly as divisor_list(WeightedComplex;RationalFunction,...). Should be called ONLY,when every occuring function f is defined on a DOMAIN equal to X (in the sense that all properties like RAYS, MAXIMAL_CONES, etc. agree. Being equal as varieties is not sufficient). In this case this function will in general be faster.
- divisor_nr ()
Works exactly as divisor(WeightedComplex, RationalFunction;Int). Should be called ONLY, when the function f is defined on a DOMAIN equal to X (in the sense that all properties like RAYS, MAXIMAL_CONES, etc. agree. Being equal as varieties is not sufficient). In this case this function will in general be faster.
- piecewise_divisor (F, cones, coefficients) → WeightedComplex
Computes a divisor of a linear sum of certain piecewise polynomials on a simplicial fan.
Parameters
WeightedComplex F A simplicial fan without lineality space in non-homog. coordinatesIncidenceMatrix cones A list of cones of F (not maximal, but all of the same dimension). Each cone t corresponds to a piecewise polynomial psi_t, defined by subsequently applying the rational functions that are 1 one exactly one ray of t and 0 elsewhere.Vector<Integer> coefficients A list of coefficients a_t corresponding to the cones.Returns
WeightedComplex The divisor sum_t a_t psi_t * F - random_minmaxdivisor (ambient_dim, equations, upperCoeffBound, onlyFunction) → MinMaxFunction
Creates a divisor of a random MinMaxFunction (in n-space) with integer coefficients. By default this uses maximum for the function. It returns an array containing the function created and its divisor in n-space.
Parameters
int ambient_dim The ambient dimension of the divisorint equations The number of equations to useint upperCoeffBound The upper bound of the coefficients (All coefficients are positive)Bool onlyFunction If true, only the random function is returned and the divisor is not computed. FALSE by default.Returns
MinMaxFunction if onlyFunction is TRUE, otherwise an array containing first the function, then the divisor
- variety_from_gfan (path) → WeightedComplex
This takes as input the name of a file containing a fan with or without multiplicities in standard gfan output (not xml!) and parses it into a tropical variety
- hurwitz_cycle (k, degree, points) → WeightedComplex
This function computes the Hurwitz cycle H_k(x), x = (x_1,...,x_n)
Parameters
Int k The dimension of the Hurwitz cycle, i.e. the number of moving verticesVector<Int> degree The degree x. Should add up to 0Vector<Rational> points Optional. Should have length n-3-k. Gives the images of the fixed vertices (besides 0). If not given all fixed vertices are mapped to 0 and the function computes the recession fan of H_k(x)Returns
WeightedComplex H_k(x), in homogeneous coordinates - hurwitz_graph (cycle) → graph::Graph
Takes as input a hurwitz curve and computes the corresponding graph object Directional rays are modeled as terminal vertices. Each vertex (including directional rays) is labeled with its combinatorial type
Parameters
WeightedComplex cycle A Hurwitz curve object (or any one-dimensional cycle in M_0,n)Returns
graph::Graph - hurwitz_pair (k, degree, points, list) → An
This function computes hurwitz_subdivision and hurwitz_cycle at the same time, returning the result in an array
Parameters
Int k The dimension of the Hurwitz cycle, i.e. the number of moving verticesVector<Int> degree The degree x. Should add up to 0Vector<Rational> points Optional. Should have length n-3-k. Gives the images of the fixed vertices (besides 0). If not given all fixed vertices are mapped to 0 and the function computes the subdivision of M_0,n containing the recession fan of H_k(x)RationalCurve list Optional. A list of rational curves. If given, the computation will be performed locally around the given combinatorial types.Returns
An array, containing first the subdivision of M_0,n, then the Hurwitz cycle - hurwitz_subdivision (k, degree, points) → WeightedComplex
This function computes a subdivision of M_0,n containing the Hurwitz cycle H_k(x), x = (x_1,...,x_n) as a subfan. If k = n-4, this subdivision is the unique coarsest subdivision fulfilling this property
Parameters
Int k The dimension of the Hurwitz cycle, i.e. the number of moving verticesVector<Int> degree The degree x. Should add up to 0Vector<Rational> points Optional. Should have length n-3-k. Gives the images of the fixed vertices (besides 0). If not given all fixed vertices are mapped to 0 and the function computes the subdivision of M_0,n containing the recession fan of H_k(x)Returns
WeightedComplex A subdivision of M_0,n, in homogeneous coordinates
- gcdext (a, b, s, t) → Integer
Computes the gcd of a and b and returns it. s and t are set such that gcd(a,b) = s * a + t * b This is just a wrapper for the GMP's gcdext method
- latticeBasis (cone) → Matrix<Integer>
Takes a cone and computes a Z-basis of the vector space spanned by the cone, returned as row vectors of a matrix
- latticeNormal (taumatrix, sigmamatrix, additionalRay) → Vector
Takes two matrices whose rows define the dual of the linear span of cone tau and sigma. Assuming that tau is a codimension one face of sigma, computes a representative of the primitive lattice normal vector of sigma with respect to tau
Parameters
Matrix taumatrix a codimension one face of sigma, given as a matrix defining its linear spanMatrix sigmamatrix an arbitrary cone, given as a matrix defining its linear spanVector additionalRay A ray that is contained in sigma, but not in tau. Used to calculate proper orientation of the normal vector.Returns
Vector - latticeNormalByCone (tau, sigma) → Vector
Assuming that tau is a codimension one face of sigma, computes a representative of the primitive lattice normal vector of sigma with respect to tau
Parameters
polytope::Cone tau a codimension one face of tau, given as a conepolytope::Cone sigma an arbitrary coneReturns
Vector - lattice_index (m) → Integer
This computes the index of a lattice of rank n in Z^n
Parameters
Matrix<Integer> m A list of (row) generators of the lattice. The matrix must have full column rank, otherwise an error is thrownReturns
Integer The index of the lattice - randomInteger (max_arg, n) → Array<Integer>
Returns n random integers in the range 0.. (max_arg-1),inclusive Note that this algorithm is not optimal for real randomness: If you change the range parameter and then change it back, you will usually get the exact same sequence as the first time
Parameters
int max_arg The upper bound for the random integersint n The number of integers to be createdReturns
Array<Integer>
- cycle_intersection (X, Y) → WeightedComplex
DEPRECATED: Use intersect(...) Computes the intersection product of two tropical cycles in a common ambient vector space V.
Parameters
WeightedComplex X The first tropical varietyWeightedComplex Y The second tropical variety. Should have the same actual ambient dimension (homogeneous coordinates don't count) as X.Returns
WeightedComplex Z The intersection product X*Y in V = R^n, where n is the ambient dimension of X and Y. The result has homogeneous coordinates in any case - diagonal_functions (n) → MinMaxFunction
Produces the rational functions that cut out the diagonal of the vector space R^n.
Parameters
Int n Them dimension of the vector space (and the number of functions)Returns
MinMaxFunction A list of the functions (max(x_n,y_n),...,max(x_1,y_1)), where x_i is the coordinate function in the first part of the cartesian product R^n x R^n and y_i is the coordinate function of the second half. - diagonal_unk (n, k) → RationalFunction
Computes a list of functions that cut out the diagonal on B(Unk) x B(Unk)
Parameters
Int n The ambient dimension of B(Unk)Int k The dimension of B(Unk)Returns
RationalFunction An array of functions, cutting out the diagonal - intersect (X, Y) → WeightedComplex
Computes the intersection product of two tropical cycles in R^n
Parameters
WeightedComplex X A tropical cycleWeightedComplex Y A tropical cycle, living in the same space as XReturns
WeightedComplex The intersection product, always in homogeneous coordinates - intersect_by_diagonal (X, Y, liftLineality, Verbose, A) → WeightedComplex
Computes an intersection product of two tropical cycles by using a prescribed list of rational functions cutting out the diagonal
Parameters
WeightedComplex X A tropical cycleWeightedComplex Y A tropical cycle living in the same ambient spaceBool liftLineality Whether both cycles have to be lifted into an ambient space of one dimension higher. If true, this will be done by adding a zero at the end of RAYS and LINEALITY_SPACE and adding the LINEALITY generator (1,..,1). After computation, this additional coordinate will be strippedBool Verbose Whether some progress information should be printedRationalFunction A list of rational functions cutting out the diagonal. These will be applied to the cartesian product X x YReturns
WeightedComplex The intersection product defined via the diagonal functions - intersect_in_lnk (X, Y, k, verbose) → WeightedComplex
# Computes the intersection product of two cycles living in L^n_k
Parameters
WeightedComplex X A cycle in L^n_kWeightedComplex Y A cycle in L^n_kInt k The dimension k of the ambient L^n_kBool verbose Optional. Whether some progress information should be printedReturns
WeightedComplex The intersection product of X and Y in B(U_n,k) - intersect_in_unk (X, Y, k, verbose) → WeightedComplex
Computes the intersection product of two cycles living in the bergman fan B(U_n,k) (given in max-coordinates)
Parameters
WeightedComplex X A cycle in B(U_n,k)WeightedComplex Y A cycle in B(U_n,k)Int k The dimension k of the ambient U_n,kBool verbose Optional. Whether some progress information should be printedReturns
WeightedComplex The intersection product of X and Y in B(U_n,k) - matroid_intersection_by_flats (X, Y, M) → WeightedComplex
Computes an intersection product of two cycles in a bergman fan
Parameters
WeightedComplex X A tropical cycle living either in B(M) or B(M)/L, where L = <(1,...,1)>WeightedComplex Y A tropical cycle, also living in B(M) or B(M)/L (both cycles should of course live in the same fan)matroid::Matroid M A matroid. X and Y live in B(M) or B(M)/L. The function will detect automatically which of these cases appliesReturns
WeightedComplex The intersection product of X and Y in B(M) (possibly mod L) - minkowski_multiplicity (X, Y) → Integer
Computes the minkowski multiplicity of two fans, i.e. it computes the unique weight of the Minkowski sum X + (-Y). More precisely: If the sum is not full-dimensional, it returns 0. Otherwise it runs over all pairs of cones whose Minkowski sum contains a generic vector and adds the product of their weight times the lattice index of the sum of the lattices.
Parameters
WeightedComplex X A tropical fanWeightedComplex Y A tropical fan, living in the same space as XReturns
Integer The Minkowski multiplicity
- cutting_functions (F, weight_aim) → Matrix<Rational>
Takes a weighted complex and a list of desired weights on its codimension one faces and computes all possible rational functions on (this subdivision of ) the complex
Parameters
WeightedComplex F A tropical varietyVector<Integer> weight_aim A list of weights, whose length should be equal to the number of CODIM_1_FACES. Gives the desired weight on each codimension one faceReturns
Matrix<Rational> The space of rational functions defined on this particular subdivision. Each row is a generator. The columns correspond to values on CMPLX_RAYS and LINEALITY_SPACE, except the last one, which is either 0 (then this function cuts out zero and can be added to any solution) or non-zero (then normalizing this entry to -1 gives a function cutting out the desired weights on the codimension one skeleton - simplicial_diagonal_system ()
This function computes the inhomogeneous version of simplicial_piecewise_system in the sense that it computes the result of the above mentioned function (i.e. which coefficients for the piecewise polynomials yield the zero divisor) and adds another column at the end where only the entries corresponding to the diagonal cones are 1, the rest is zero. This can be seen as asking for a solution to the system that cuts out the diagonal (all solutions whose last entry is 1)
- simplicial_piecewise_system (F) → Matrix<Rational>
This function takes a d-dimensional simplicial fan F and computes the linear system defined in the following way: For each d-dimensional cone t in the diagonal subdivision of FxF, let psi_t be the piecewise polynomial defined by subsequently applying the rational functions that are 1 one exactly one ray of t and 0 elsewhere. Now for which coefficients a_t is sum_t a_t psi_t * (FxF) = 0?
Parameters
WeightedComplex F A simplicial fan without lineality space in non-homog. coordinatesReturns
Matrix<Rational> The above mentioned linear system. The rows are equations, the columns correspond to d-dimensional cones of FxF in the order given by skeleton_complex(simplicial_with_diagonal(F), d,TRUE) - simplicial_with_diagonal (F) → WeightedComplex
This function takes a simplicial fan F (in non-homog. coordinates and without lineality space) and computes the coarsest subdivision of F x F containing all diagonal rays (r,r)
Parameters
WeightedComplex F A simplicial fan without lineality space in non-homog. coordinatesReturns
WeightedComplex The product complex FxF subdivided such that it contains all diagonal rays
- computeMatrixBases (m) → IncidenceMatrix
Computes a list of sets of column indices of a matrix such that the corresponding column sets form a basis of the column space
- computeMatrixColoops (m) → Set<int>
Computes a list of column indices of a matrix such that the corresponding columns are contained in every column basis of the column space. Is equal to the intersection of all sets returned by computeMatrixBases
- linearRepresentation (v, generators) → Vector
Takes a vector v and a matrix with column dimension equal to the dimension of v. Assuming that v is in the row span of the matrix, it computes one(!) possible representation of v in these generators
Parameters
Vector v The vector supposed to be contained in the row span of the generatorsMatrix generators A set of row vectors whose linear span should contain vReturns
Vector A vector (a1,..,an) such that v = (a1,...,an) * generators. It returns a vector of dimension 0, if v is not in the span of the generators. An error is thrown if the dimensions of v and the generators mismatch - lllHNF (matrix, tfmatrix, kdim) → Matrix
Computes a row HNF of an integer matrix A It returns the normal form and stores the unimodular transformation matrix and the kernel dimension of the transposed matrix in the last two parameters. The algorithm is the LLL-based HNF alg. by Havas, Majevski, Matthews
Parameters
Matrix<Integer> matrix the matrix for which the transformation is computedMatrix<Integer> tfmatrix The matrix that will contain the transformation matrix, i.e. tfmatrix * matrix = lllHNF(matrix)Integer kdim This will be set to dim Ker(A^T) (This is needed for lattice normal computation)Returns
Matrix - lllHNF (matrix) → Matrix<Integer>
Does exactly the same as lllHNF(Matrix,Matrix,Integer), except that it only returns the normal form and not the transformation matrix and the transposed kernel dimension
Parameters
Matrix<Integer> matrix the matrix for which the transformation is computedReturns
Matrix<Integer> The HNF of matrix
- local_codim_1 (complex, face) → WeightedComplex
This takes a weighted complex and an index of one of its codimension one faces (The index is in CODIM_1_FACES) and computes the complex locally restricted to that face
Parameters
WeightedComplex complex An arbitrary weighted complexInt face An index of a face in CODIM_1_FACESReturns
WeightedComplex The complex locally restricted to the given face - local_point (complex, v) → WeightedComplex
This takes a weighted complex and an arbitrary vertex in homogeneous coordinates that is supposed to lie in the support of the complex It then refines the complex such that the vertex is a cell in the polyhedral structure and returns the complex localized at this vertex
Parameters
WeightedComplex complex An arbitrary weighted complexVector<Rational> v A vertex in homogeneous coordinates. It should lie in the support of the complex (otherwise an error is thrown)Returns
WeightedComplex The complex localized at the vertex - local_ray (complex, ray) → WeightedComplex
This takes a weighted complex and an index of one of its vertices or rays (the index is to be understood in RAYS) It then localizes the variety at this vertex / ray. The index should never correspond to a directional ray in a complex, since this would not be a cone
Parameters
WeightedComplex complex An arbitrary weighted complexInt ray The index of a ray/vertex in RAYSReturns
WeightedComplex The complex locally restricted to the given ray/vertex - local_restrict (complex, cones) → WeightedComplex
This takes a tropical variety and an IncidenceMatrix describing a set of cones (not necessarily maximal ones) of this variety. It will then create a variety that contains all compatible maximal cones and is locally restricted to the given cone set.
Parameters
WeightedComplex complex An arbitrary weighted complexIncidenceMatrix cones A set of cones, indices refer to RAYSReturns
WeightedComplex The same complex, locally restricted to the given cones
- bergman_fan (m, modOutLineality, projectionCoordinate) → The
Creates the bergman fan of a given matroid fan. This is much slower than using bergman_fan_matroid. The difference in output is that is always gives the coarsest polyhedral structure (but this can also be achieved by calling coarsen(...) after creation).
Parameters
matroid::Matroid m A matroidBool modOutLineality Optional argument. If set to TRUE, the lineality space is divided out before returning the fan. The next parameter specifies the exact modalities of the division. By default, this parameter is set to FALSEint projectionCoordinate Optional argument. An integer in {0,..,n-1}, where n is the number of elements of the matroid. If modOutLineality is set to TRUE, the standard basis vector with index projectionCoordinate is mapped to minus the sum of the remaining standard basis vectors to mod out the lineality space. By default, this is the last coordinate n-1.Returns
The bergman fan of the given matroid in non-homog. coordinates - bergman_fan_flats (m, mod_out_lineality) → WeightedComplex
This function computes the bergman fan of a matroid in the subdivision associated to its lattice of flats. In particular it computes all flats and all maximal chains of flats. Hence this function is terribly inefficient and should only be used with comparatively small matroids
Parameters
matroid::Matroid m Any matroidBool mod_out_lineality Optional. Whether the lineality space should be modded out by setting the last coordinate to be the sum of the remaining ones. True by default.Returns
WeightedComplex The bergman fan B(m) in its flat subdivision - bergman_fan_linear (m, modOutLineality, projectionCoordinate) → The
Uses an algorithm by Felipe Rincón to compute the bergman fan of a linear matroid
Parameters
Matrix<Rational> m Any rational matrixBool modOutLineality Optional argument. If set to TRUE, the lineality space is divided out before returning the fan. The next parameter specifies the exact modalities of the division. By default, this parameter is set to FALSEint projectionCoordinate Optional argument. An integer in {0,..,n-1}, where n is the number of elements of the matroid. If modOutLineality is set to TRUE, the standard basis vector with index projectionCoordinate is mapped to minus the sum of the remaining standard basis vectors to mod out the lineality space. By default, this is the last coordinate n-1.Returns
The bergman fan of the given matroid in non-homog. coordinates. This algorithm uses min-convention, so the rays are given as (0,1) - vectors - bergman_fan_matroid (m, modOutLineality, projectionCoordinate) → The
Uses an algorithm by Felipe Rincón to compute the bergman fan of a general matroid
Parameters
matroid::Matroid m Any matroidBool modOutLineality Optional argument. If set to TRUE, the lineality space is divided out before returning the fan. The next parameter specifies the exact modalities of the division. By default, this parameter is set to FALSEint projectionCoordinate Optional argument. An integer in {0,..,n-1}, where n is the number of elements of the matroid. If modOutLineality is set to TRUE, the standard basis vector with index projectionCoordinate is mapped to minus the sum of the remaining standard basis vectors to mod out the lineality space. By default, this is the last coordinate n-1.Returns
The bergman fan of the given matroid in non-homog. coordinates. This algorithm uses min-convention, so the rays are given as (0,1) - vectors
- add_minmax_functions (f, g, reduce) → MinMaxFunction
Computes the sum of two MinMaxFunctions that are supposed to have the same USES_MIN property. You can also simply use '+' instead.
Parameters
MinMaxFunction f An arbitrary MinMaxFunctionMinMaxFunction g Bool reduce Optional. False by default. If true, the function reduces the amount of terms by computing vertices of the newton polytope of the sumReturns
MinMaxFunction The sum of both functions. - function_mult (f, r) → RationalFunction
This function takes a RationalFunction f and a Rational value r and returns the RationalFunction r*f. You can also use the operator '*' instead.
- function_point (v) → RationalFunction
This takes a vector v = (v_1,...,v_n) in R^n and returns the list of rational functions max(v_i,x_i), i.e. a list of functions cutting out that point in R^n.
Parameters
Vector<Rational> v A vector in R^n (in non-homog. coordinates!)Returns
RationalFunction An array of RationalFunction objects, which cut out v in R^n - function_value (X, An) → RationalFunction
This creates a RationalFunction by directly defining it on the rays of a given domain. It is simply shorter then using the constructor.
Parameters
WeightedComplex X The DOMAIN of the functionRational An arbitrarily long list of function values. It should be as long as X->CMPXL_RAYS->rows + X->LINEALITY_DIM. Function values will be assigned in this order (first rays, then linspace). Superfluous values are ignored, missing ones replaced by zeroReturns
RationalFunction - input_vars (A) → Array<String>
Creates an array of strings from a single string by separating along commas. This can be used as a convenience function to pass a list of variables to INPUT_VARS of MinMaxFunction, e.g. ...INPUT_VARS=>input_vars("x,y,z")
Parameters
String A single string containing a comma-separated list of variable namesReturns
Array<String> The list of the variable names - projection_map (n, s) → Morphism
- projection_map (n, m) → Morphism
- pull_back (f, phi) → RationalFunction
Computes the pull back of a rational function (or a list of rational functions) along a morphism
Parameters
Morphism f A morphismRationalFunction phi A rational function whose DOMAIN contains the image of f (or a list of RationalFunction objects)Returns
RationalFunction The pull-back of phi along f. If a list of functions was given, it returns an array with the pull-backs of these functions - scale_minmax_function (f, a) → MinMaxFunction
Scales a MinMaxFunction by a given Rational a. You can also use the '*' operator.
Parameters
MinMaxFunction f An arbitrary MinMaxFunctionRational a A scalar valuesReturns
MinMaxFunction The scaled function
- count_mn_cones (n, k) → Integer
- count_mn_rays (n) → Integer
Computes the number of rays of the tropical moduli space M_0,n
- evaluation_map (n, r, Delta, i) → Morphism
This creates the i-th evaluation function on M_0,n^(lab)(R^r,Delta) (which is actually realized as M_0,(n+|Delta|) x R^r)
Parameters
Int n The number of marked pointsInt r The dimension of the embedding spaceMatrix<Rational> Delta The directions of the unbounded edges (given as row vectors)Int i The index of the marked point that should be evaluated. i should lie in between 1 and n Note that the i-th marked point is realized as the |Delta|+i-th leaf in M_0,(n+|Delta|) and that the R^r - coordinate is interpreted as the position of the n-th leaf. In particular, ev_n is just the projection to the R^r-coordinatesReturns
Morphism ev_i. Its domain is the ambient space of the moduli space in matroid coordinates cross R^r - evaluation_map (n, r, d, i) → Morphism
This creates the i-th evaluation function on M_0,n^(lab)(R^r,d) (which is actually realized as M_0,(n+d(r+1)) x R^r) This is the same as calling the function evaluation_map(Int,Int,Matrix<Rational>,Int) with the standard d-fold degree as matrix
Parameters
Int n The number of marked pointsInt r The dimension of the embedding spaceInt d The degree of the embedding. The direction matrix will be the standard d-fold directions (first (1,...1), then the inverted unit vectors)Int i The index of the marked point that should be evaluated. i should lie in between 1 and nReturns
Morphism ev_i. Its domain is the ambient space of the moduli space in matroid coordinates cross R^r - forgetful_map (n, S) → Morphism
This computes the forgetful map from the moduli space M_0,n to M_0,(n-|S|)
- local_m0n (A) → WeightedComplex
Computes the moduli space M_0,n locally around a given list of combinatorial types. More precisely: It computes the weighted complex consisting of all maximal cones containing any of the given combinatorial types and localizes at these types This should only be used for curves of small codimension. What the function actually does, is that it combinatorially computes the cartesian products of M_0,v's, where v runs over the possible valences of vertices in the curves For max(v) <= 8 this should terminate in a reasonable time (depending on the number of curves) The coordinates are the same that would be produced by the function tropical_m0n
Parameters
RationalCurve A list of rational curves (preferrably in the same M_0,n)Returns
WeightedComplex The local complex - moduliDimensionFromLength (k) → Int
- psi_class (n, i) → WeightedComplex
Computes the i-th psi class in the moduli space of n-marked rational tropical curves M_0,n
Parameters
Int n The number of leaves in M_0,nInt i The leaf for which we want to compute the psi class ( in 1,..,n )Returns
WeightedComplex The corresponding psi class - psi_product (n, exponents) → WeightedComplex
Computes a product of psi classes psi_1^k_1 * ... * psi_n^k_n on the moduli space of rational n-marked tropical curves M_0,n
Parameters
Int n The number of leaves in M_0,nVector<Int> exponents The exponents of the psi classes k_1,..,k_n. If the vector does not have length n or if some entries are negative, an error is thrownReturns
WeightedComplex The corresponding psi class divisor - tropical_m0n (n) → WeightedComplex
Creates the moduli space of abstract rational n-marked curves. Its coordinates are given as the coordinates of the bergman fan of the matroid of the complete graph on n-1 nodes (but not computed as such) The lineality space (1,..,1) is modded out by setting the last coordinate equal to minus the sum of the others The isomorphism to the space of curve metrics is obtained by choosing the last leaf as special leaf
Parameters
Int n The number of leaves. Should be at least 4Returns
WeightedComplex The tropical moduli space M_0,n
Common Option Lists
- Visual::RationalCurve::decorationsimports from: Visual::Graph::decorations, Visual::Wire::decorations, Visual::PointSet::decorations
Visualization options for RationalCurve->VISUAL
Options
String LengthLabels if set to "hidden", the labels indicating the lengths are hidden - Visual::WeightedComplex::BoundingDecorationsimports from: Visual::WeightedComplex::decorations, Visual::Polygons::decorations, Visual::PointSet::decorations
Some options only used for BB_VISUAL
Options
Flexible<Rational> BoundingDistance The distance of the border of the bounding box from the smallest box containing the affine points of the complex. This is only relevant, if BoundingMode is "relative"Matrix<Rational> BoundingBox A fixed bounding box, determined by two row vectors that specify two of its vertices (on "on top" and one "at the bottom"). Is only relevant, if BoundingMode is "absolute"String BoundingMode If set to "relative", the function determines the smallest possible box containing all affine points of the complex and then enlarges the box by BoundingDistance to all sides. If set to "absolute", BoundingBox must be specified and the complex will be intersected with that box. By default this is set to "relative".Array<String> ConeLabels A list of strings to be displayed as labels for the maximal cones. If this is empty, the weight labels (if present and not suppressed by WeightLabels=>"hidden") are displayed - Visual::WeightedComplex::decorationsimports from: Visual::Polygons::decorations, Visual::PointSet::decorations
A set of basic visualization options for CMPLX_VISUAL and BB_VISUAL
Options
Flexible<Rational> DirScale length of the directional raysString WeightLabels if set to "hidden", the labels indicating the weights are hiddenString CoordLabels If set to "show", the labels indicating the vertex coordinates are displayed, otherwise they are not. Note that this is expensive and significantly increases computation time. String If set to "pinned", the weight labels are computed in such a way that they stick to the cells when the complex is exploded. Note that this is expensive and significantly increases computation time. WeightLabelStyle => "", - Visual::WeightedComplex::FunctionDecorationsimports from: Visual::WeightedComplex::BoundingDecorations, Visual::WeightedComplex::decorations, Visual::Polygons::decorations, Visual::PointSet::decorations
Visualization options for RationalFunction/Morphism->BB_VISUAL
Options
String FunctionLabels , if set to "show", the function labels indicatingt the affine linear representation of each function on each cone are computed