code
stringlengths
17
6.64M
def dcrossvec_cm(n): "\n Return a list with the distribution of k-dcrossings on complete matchings on n vertices.\n\n INPUT:\n\n n -- a nonnegative integer.\n\n OUTPUT:\n\n A list whose k'th entry is the number of complete matchings m\n for which dcrossing(m) = k. For example, let L =\n dcros...
def tablecolumn(n, k): "\n Return column n of Table 1 or 2 from the paper :arxiv:`0812.2725`.\n\n INPUT:\n\n n -- positive integer.\n\n k -- integer for which table you want: Table 1 is complete\n matchings, Table 2 is set partitions.\n\n OUTPUT:\n\n The n'th column of the table as a list. Th...
def avg(X): '\n Return the average of the list X.\n\n EXAMPLES::\n\n sage: from sage.tests.benchmark import avg\n sage: avg([1,2,3])\n 2.0\n ' s = sum(X, 0) return (s / float(len(X)))
class Benchmark(): "\n A class for running specific benchmarks against different systems.\n\n In order to implement an extension of this class, one must write\n functions named after the different systems one wants to test. These\n functions must perform the same task for each function. Calling\n t...
class Divpoly(Benchmark): def __init__(self, n): '\n Class for benchmarking computation of the division polynomial\n of the following elliptic curve.\n\n EXAMPLES::\n\n sage: E = EllipticCurve([1,2,3,4,5])\n sage: E.division_polynomial(3)\n 3*x^4 + 9*...
class PolySquare(Benchmark): def __init__(self, n, R): self.__n = n self.__R = R self.repr_str = ('Square a polynomial of degree %s over %s' % (self.__n, self.__R)) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage.t...
class MPolynomialPower(Benchmark): def __init__(self, nvars=2, exp=10, base=QQ, allow_singular=True): self.nvars = nvars self.exp = exp self.base = base self.allow_singular = allow_singular s = ('Compute (x_0 + ... + x_%s)^%s over %s' % ((self.nvars - 1), self.exp, self.ba...
class MPolynomialMult(Benchmark): def __init__(self, nvars=2, base=QQ, allow_singular=True): if (nvars % 2): nvars += 1 self.nvars = nvars self.base = base self.allow_singular = allow_singular s = ('Compute (x_0 + ... + x_%s) * (x_%s + ... + x_%s) over %s' % ((...
class MPolynomialMult2(Benchmark): def __init__(self, nvars=2, base=QQ, allow_singular=True): if (nvars % 2): nvars += 1 self.nvars = nvars self.base = base self.allow_singular = allow_singular s = ('Compute (x_1 + 2*x_2 + 3*x_3 + ... + %s*x_%s) * (%s * x_%s + ...
class CharPolyTp(Benchmark): def __init__(self, N=37, k=2, p=2, sign=1): self.N = N self.k = k self.p = p self.sign = sign self.repr_str = ('Compute the charpoly (given the matrix) of T_%s on S_%s(Gamma_0(%s)) with sign %s.' % (self.p, self.k, self.N, self.sign)) def ...
class PolyFactor(Benchmark): def __init__(self, n, R): self.__n = n self.__R = R self.repr_str = ('Factor a product of 2 polynomials of degree %s over %s.' % (self.__n, self.__R)) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sa...
class SquareInts(Benchmark): def __init__(self, base=10, ndigits=(10 ** 5)): self.__ndigits = ndigits self.base = base self.repr_str = ('Square the integer %s^%s' % (self.base, self.__ndigits)) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n...
class MatrixSquare(Benchmark): def __init__(self, n, R): self.__n = n self.__R = R self.repr_str = ('Square a matrix of degree %s over %s' % (self.__n, self.__R)) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage.tes...
class Factorial(Benchmark): def __init__(self, n): self.__n = n self.repr_str = ('Compute the factorial of %s' % self.__n) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage.tests.benchmark import Factorial\n sage:...
class Fibonacci(Benchmark): def __init__(self, n): self.__n = n self.repr_str = ('Compute the %s-th Fibonacci number' % self.__n) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage.tests.benchmark import Fibonacci\n ...
class SEA(Benchmark): def __init__(self, p): self.__p = p self.repr_str = ('Do SEA on an elliptic curve over GF(%s)' % self.__p) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage.tests.benchmark import SEA\n sage:...
class MatrixKernel(Benchmark): def __init__(self, n, R): self.__n = n self.__R = R self.repr_str = ('Kernel of a matrix of degree %s over %s' % (self.__n, self.__R)) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage....
class ComplexMultiply(Benchmark): def __init__(self, bits_prec, times): self.__bits_prec = bits_prec self.__times = times self.repr_str = ('List of multiplies of two complex numbers with %s bits of precision %s times' % (self.__bits_prec, self.__times)) def sage(self): '\n ...
class ModularSymbols1(Benchmark): def __init__(self, N, k=2): self.__N = N self.__k = k self.repr_str = ('Presentation for modular symbols on Gamma_0(%s) of weight %s' % (self.__N, self.__k)) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n ...
class ModularSymbolsDecomp1(Benchmark): def __init__(self, N, k=2, sign=1, bnd=10): self.N = N self.k = k self.sign = sign self.bnd = bnd self.repr_str = ('Decomposition of modular symbols on Gamma_0(%s) of weight %s and sign %s' % (self.N, self.k, self.sign)) def sag...
class EllipticCurveTraces(Benchmark): def __init__(self, B): self.B = B self.repr_str = ('Compute all a_p for the elliptic curve [1,2,3,4,5], for p < %s' % self.B) def sage(self): "\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage.tests.benc...
class EllipticCurvePointMul(Benchmark): def __init__(self, n): self.n = n self.repr_str = ('Compute %s*(0,0) on the elliptic curve [0, 0, 1, -1, 0] over QQ' % self.n) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n sage: from sage.tests.b...
class EllipticCurveMW(Benchmark): def __init__(self, ainvs): self.ainvs = ainvs self.repr_str = ('Compute generators for the Mordell-Weil group of the elliptic curve %s over QQ' % self.ainvs) def sage(self): '\n Time the computation in Sage.\n\n EXAMPLES::\n\n ...
class FiniteExtFieldMult(Benchmark): def __init__(self, field, times): self.__times = times self.field = field self.e = (field.gen() ** (field.cardinality() / 3)) self.f = (field.gen() ** ((2 * field.cardinality()) / 3)) self.repr_str = 'Multiply a^(#K/3) with a^(2*#K/3) w...
class FiniteExtFieldAdd(Benchmark): def __init__(self, field, times): self.__times = times self.field = field self.e = (field.gen() ** (field.cardinality() / 3)) self.f = (field.gen() ** ((2 * field.cardinality()) / 3)) self.repr_str = 'Add a^(#K/3) to a^(2*#K/3) where a =...
def suite1(): PolySquare(10000, QQ).run() PolySquare(20000, ZZ).run() PolySquare(50000, GF(5)).run() PolySquare(20000, Integers(8)).run() SquareInts(10, 2000000).run() MatrixSquare(200, QQ).run() MatrixSquare(50, ZZ).run() SquareInts(10, 150000).run() Factorial((2 * (10 ** 6))).run...
def mpoly(): MPolynomialPower(nvars=6, exp=10).run() main = ['sage', 'magma'] MPolynomialPower(nvars=2, exp=200, allow_singular=False).run(main) MPolynomialPower(nvars=5, exp=10, allow_singular=False).run(main) MPolynomialPower(nvars=5, exp=30, allow_singular=True).run(main) MPolynomialPower(n...
def mpoly_all(include_maple=False): '\n Runs benchmarks for multipoly arithmetic on all systems (except\n Maxima, since it is very very slow). You must have mathematica,\n maple, and magma.\n\n .. NOTE::\n\n * maple is depressingly slow on these benchmarks.\n * Singular (i.e., Sage) does ...
def modsym_present(): ModularSymbols1(2006, 2) ModularSymbols1(1, 50) ModularSymbols1(1, 100) ModularSymbols1(1, 150) ModularSymbols1(30, 8) ModularSymbols1(225, 4) ModularSymbols1(2, 50) ModularSymbols1(2, 100)
def modsym_decomp(): ModularSymbolsDecomp1(1, 24).run() ModularSymbolsDecomp1(125, 2).run() ModularSymbolsDecomp1(389, 2).run() ModularSymbolsDecomp1(1, 100).run() ModularSymbolsDecomp1(54, 4).run()
def elliptic_curve(): EllipticCurveTraces(100000).run() EllipticCurveTraces(500000).run() Divpoly(59).run() EllipticCurvePointMul(1000).run() EllipticCurvePointMul(2000).run() EllipticCurvePointMul(2500).run() EllipticCurveMW([5, 6, 7, 8, 9]).run() EllipticCurveMW([50, 6, 7, 8, 9]).run...
def test_executable(args, input='', timeout=100.0, pydebug_ignore_warnings=False, **kwds): '\n Run the program defined by ``args`` using the string ``input`` on\n the standard input.\n\n INPUT:\n\n - ``args`` -- a list of program arguments, the first being the\n executable.\n\n - ``input`` -- ...
def test_attrcall(name, L): "\n Return a function by name.\n\n This is a helper function for test_finite_lattice(). This\n will unify all Boolean-valued functions to a function without\n parameters.\n\n EXAMPLES::\n\n sage: from sage.tests.finite_poset import test_attrcall\n sage: N5 ...
def test_finite_lattice(L): "\n Test several functions on a given finite lattice.\n\n The function contains tests of different kinds:\n\n - Implications of Boolean properties. Examples: a distributive lattice is modular,\n a dismantlable and distributive lattice is planar, a simple lattice can not b...
def test_finite_poset(P): '\n Test several functions on a given finite poset.\n\n The function contains tests of different kinds, for example\n\n - Numerical properties jump number, dimension etc. can\'t be a bigger\n in a subposet with one element less.\n - "Dual tests", for example the dual of ...
def base(x): '\n Test function to make sure\n :func:`~sage.misc.sageinspect.sage_getsourcelines` can get\n the code of a function created by ``functools.partial``.\n\n EXAMPLES::\n\n sage: from sage.tests.functools_partial_src import base, test_func\n sage: base(3)\n 21\n s...
def test_packages(packages, only_failures=False): "\n Return list of all installed packages.\n\n INPUT:\n\n - ``packages`` -- a list/tuple/iterable of strings. The names of\n GAP packages to try to import.\n\n - ``only_failures`` -- boolean, default ``False``. Whether to only\n include failu...
def all_installed_packages(ignore_dot_gap=False, gap=None): "\n Return list of all installed packages.\n\n INPUT:\n\n - ``ignore_dot_gap`` -- Boolean (default: ``False``). Whether to\n ignore the `.gap/` directory (usually in the user home\n directory) when searching for packages.\n\n - ``ga...
def run_tests() -> None: '\n Run all memcheck tests\n ' from sage.tests.memcheck import symbolic_expression run_tests_in_module(symbolic_expression)
def run_tests_in_module(mod: types.ModuleType) -> None: '\n Run all memcheck tests in the given module\n ' for entry in dir(mod): if (not entry.startswith('test_')): continue test_func = getattr(mod, entry) test_func()
def run_tests_in_valgrind() -> None: '\n Run the sage.tests.memcheck.run_tests module inside valgrind\n ' subprocess.check_call(['valgrind', '--suppressions=src/sage/ext_data/valgrind/valgrind-python.supp', '--show-possibly-lost=no', '--show-reachable=no', './venv/bin/python', '-m', 'sage.tests.memcheck...
def test_sqrt_sqrt_2() -> None: from sage.misc.functional import sqrt T2 = sqrt(2) def sqrt_T2() -> None: sqrt(T2) verify_no_leak(sqrt_T2)
def verify_no_leak(callback: Callable[([], Any)], repeat: int=10000, fuzzy: int=10) -> None: '\n Verify that the callback does not generate new definitely lost blocks\n\n Raises an assertion if the callback leaks memory\n ' callback() initial_blocks = (0, 0, 0, 0) valgrind.memcheck_do_leak_ch...
def function_new(): '\n New function, deprecating ``old_function``.\n\n EXAMPLES::\n\n sage: from sage.tests.test_deprecation import function_old\n sage: function_old()\n doctest:...: DeprecationWarning: function_old is deprecated. Please\n use sage.tests.test_deprecation.functio...
class GenericCellComplex(SageObject): "\n Class of abstract cell complexes.\n\n This is meant to be used by developers to produce new classes, not\n by casual users. Classes which derive from this are\n :class:`~sage.homology.simplicial_complex.SimplicialComplex`,\n :class:`~sage.homology.delta_co...
@total_ordering class Cube(SageObject): '\n Define a cube for use in constructing a cubical complex.\n\n "Elementary cubes" are products of intervals with integer\n endpoints, each of which is either a unit interval or a degenerate\n (length 0) interval; for example,\n\n .. MATH::\n\n [0,1] \...
class CubicalComplex(GenericCellComplex): '\n Define a cubical complex.\n\n :param maximal_faces: set of maximal faces\n :param maximality_check: see below\n :type maximality_check: boolean; optional, default True\n :return: a cubical complex\n\n ``maximal_faces`` should be a list or tuple or se...
class CubicalComplexExamples(): '\n Some examples of cubical complexes.\n\n Here are the available examples; you can also type\n "cubical_complexes." and hit TAB to get a list::\n\n Sphere\n Torus\n RealProjectivePlane\n KleinBottle\n SurfaceOfGenus\n Cube\n\n ...
class DeltaComplex(GenericCellComplex): "\n Define a `\\Delta`-complex.\n\n :param data: see below for a description of the options\n :param check_validity: If True, check that the simplicial identities hold.\n :type check_validity: boolean; optional, default True\n :return: a `\\Delta`-complex\n\n...
class DeltaComplexExamples(): '\n Some examples of `\\Delta`-complexes.\n\n Here are the available examples; you can also type\n ``delta_complexes.`` and hit TAB to get a list::\n\n Sphere\n Torus\n RealProjectivePlane\n KleinBottle\n Simplex\n SurfaceOfGenus\n\...
class FilteredSimplicialComplex(SageObject): '\n Define a filtered complex.\n\n INPUT:\n\n - ``simplices`` -- list of simplices and filtration values\n - ``verbose`` -- (default: ``False``) if ``True``, any change to\n the filtration value of a simplex will be printed\n\n ``simplices`` should ...
def _cubical_complex_union(c1, c2): '\n Return the union of cubical complexes.\n\n This method returns a cubical complex whose set of maximal faces\n is the union of sets of maximal faces of ``c1`` and ``c2``.\n\n INPUT:\n\n - ``c1``, ``c2`` -- a cubical complex\n\n OUTPUT: the union of cubical ...
class MomentAngleComplex(UniqueRepresentation, SageObject): "\n A moment-angle complex.\n\n Given a simplicial complex `K`, with a set of vertices\n `V = \\{v_1, v_2, \\ldots, v_n\\}`, a moment-angle complex over `K` is a\n topological space `Z`, which is a union of `X_{\\sigma}`, where\n `\\sigma ...
def lattice_paths(t1, t2, length=None): "\n Given lists (or tuples or ...) ``t1`` and ``t2``, think of them as\n labelings for vertices: ``t1`` labeling points on the x-axis,\n ``t2`` labeling points on the y-axis, both increasing. Return the\n list of rectilinear paths along the grid defined by thes...
def rename_vertex(n, keep, left=True): "\n Rename a vertex: the vertices from the list ``keep`` get\n relabeled 0, 1, 2, ..., in order. Any other vertex (e.g. 4) gets\n renamed to by prepending an 'L' or an 'R' (thus to either 'L4' or\n 'R4'), depending on whether the argument left is ``True`` or ``F...
@total_ordering class Simplex(SageObject): "\n Define a simplex.\n\n Topologically, a simplex is the convex hull of a collection of\n vertices in general position. Combinatorially, it is defined just\n by specifying a set of vertices. It is represented in Sage by the\n tuple of the vertices.\n\n ...
class SimplicialComplex(Parent, GenericCellComplex): "\n Define a simplicial complex.\n\n :param maximal_faces: set of maximal faces\n :param from_characteristic_function: see below\n :param maximality_check: see below\n :type maximality_check: boolean; optional, default ``True``\n :param sort_f...
def facets_for_RP4(): '\n Return the list of facets for a minimal triangulation of 4-dimensional\n real projective space.\n\n We use vertices numbered 1 through 16, define two facets, and define\n a certain subgroup `G` of the symmetric group `S_{16}`. Then the set\n of all facets is the `G`-orbit ...
def facets_for_K3(): '\n Return the facets for a minimal triangulation of the K3 surface.\n\n This is a pure simplicial complex of dimension 4 with 16\n vertices and 288 facets. The facets are obtained by constructing a\n few facets and a permutation group `G`, and then computing the\n `G`-orbit of...
def facets_for_RP4(): '\n Return the list of facets for a minimal triangulation of 4-dimensional\n real projective space.\n\n We use vertices numbered 1 through 16, define two facets, and define\n a certain subgroup `G` of the symmetric group `S_{16}`. Then the set\n of all facets is the `G`-orbit ...
def facets_for_K3(): '\n Return the facets for a minimal triangulation of the K3 surface.\n\n This is a pure simplicial complex of dimension 4 with 16\n vertices and 288 facets. The facets are obtained by constructing a\n few facets and a permutation group `G`, and then computing the\n `G`-orbit of...
def matching(A, B): '\n List of maximal matchings between the sets ``A`` and ``B``.\n\n A matching is a set of pairs `(a, b) \\in A \\times B` where each `a` and\n `b` appears in at most one pair. A maximal matching is one which is\n maximal with respect to inclusion of subsets of `A \\times B`.\n\n ...
class UniqueSimplicialComplex(SimplicialComplex, UniqueRepresentation): "\n This combines :class:`SimplicialComplex` and\n :class:`UniqueRepresentation`. It is intended to be used to make\n standard examples of simplicial complexes unique. See :trac:`13566`.\n\n INPUT:\n\n - the inputs are the same...
def Sphere(n): '\n A minimal triangulation of the `n`-dimensional sphere.\n\n INPUT:\n\n - ``n`` -- positive integer\n\n EXAMPLES::\n\n sage: simplicial_complexes.Sphere(2)\n Minimal triangulation of the 2-sphere\n sage: simplicial_complexes.Sphere(5).homology() ...
def Simplex(n): '\n An `n`-dimensional simplex, as a simplicial complex.\n\n INPUT:\n\n - ``n`` -- a non-negative integer\n\n OUTPUT: the simplicial complex consisting of the `n`-simplex\n on vertices `(0, 1, ..., n)` and all of its faces.\n\n EXAMPLES::\n\n sage: simplicial_complexes.Si...
def Torus(): '\n A minimal triangulation of the torus.\n\n This is a simplicial complex with 7 vertices, 21 edges and 14\n faces. It is the unique triangulation of the torus with 7\n vertices, and has been found by Möbius in 1861.\n\n This is also the combinatorial structure of the Császár\n pol...
def RealProjectivePlane(): '\n A minimal triangulation of the real projective plane.\n\n EXAMPLES::\n\n sage: P = simplicial_complexes.RealProjectivePlane()\n sage: Q = simplicial_complexes.ProjectivePlane()\n sage: P == Q\n True\n\n sage: # needs sage.modules\n sag...
def KleinBottle(): "\n A minimal triangulation of the Klein bottle, as presented for example\n in Davide Cervone's thesis [Cer1994]_.\n\n EXAMPLES::\n\n sage: simplicial_complexes.KleinBottle()\n Minimal triangulation of the Klein bottle\n " return UniqueSimplicialComplex([[2, 3, 7],...
def SurfaceOfGenus(g, orientable=True): '\n A surface of genus `g`.\n\n INPUT:\n\n - ``g`` -- a non-negative integer. The desired genus\n\n - ``orientable`` -- boolean (optional, default ``True``). If\n ``True``, return an orientable surface, and if ``False``,\n return a non-orientable ...
def MooreSpace(q): '\n Triangulation of the mod `q` Moore space.\n\n INPUT:\n\n - ``q`` -- integer, at least 2\n\n This is a simplicial complex with simplices of dimension 0, 1,\n and 2, such that its reduced homology is isomorphic to\n `\\ZZ/q\\ZZ` in dimension 1, zero otherwise.\n\n If `q=...
def ComplexProjectivePlane(): '\n A minimal triangulation of the complex projective plane.\n\n This was constructed by Kühnel and Banchoff [KB1983]_.\n\n EXAMPLES::\n\n sage: C = simplicial_complexes.ComplexProjectivePlane()\n sage: C.f_vector()\n [1, 9, 36, 84, 90, 36]\n sage...
def QuaternionicProjectivePlane(): '\n Return a pure simplicial complex of dimension 8 with 490 facets.\n\n .. WARNING::\n\n This was proven to be a triangulation of the projective plane\n `HP^2` over the ring of quaternions by Gorodkov in 2016 [Gor2016]_.\n\n This simplicial complex has th...
def PoincareHomologyThreeSphere(): '\n A triangulation of the Poincaré homology 3-sphere.\n\n This is a manifold whose integral homology is identical to the\n ordinary 3-sphere, but it is not simply connected. In particular,\n its fundamental group is the binary icosahedral group, which has\n order...
def RealProjectiveSpace(n): '\n A triangulation of `\\Bold{R}P^n` for any `n \\geq 0`.\n\n INPUT:\n\n - ``n`` -- integer, the dimension of the real projective space\n to construct\n\n The first few cases are pretty trivial:\n\n - `\\Bold{R}P^0` is a point.\n\n - `\\Bold{R}P^1` is a circle, ...
def K3Surface(): '\n Return a minimal triangulation of the K3 surface.\n\n This is a pure simplicial complex of dimension 4 with 16 vertices\n and 288 facets. It was constructed by Casella and Kühnel\n in [CK2001]_. The construction here uses the labeling from\n Spreer and Kühnel [SK2011]_.\n\n ...
def BarnetteSphere(): "\n Return Barnette's triangulation of the 3-sphere.\n\n This is a pure simplicial complex of dimension 3 with 8\n vertices and 19 facets, which is a non-polytopal triangulation\n of the 3-sphere. It was constructed by Barnette in\n [Bar1970]_. The construction here uses the l...
def BrucknerGrunbaumSphere(): "\n Return Bruckner and Grunbaum's triangulation of the 3-sphere.\n\n This is a pure simplicial complex of dimension 3 with 8\n vertices and 20 facets, which is a non-polytopal triangulation\n of the 3-sphere. It appeared first in [Br1910]_ and was studied in\n [GrS196...
def NotIConnectedGraphs(n, i): '\n The simplicial complex of all graphs on `n` vertices which are\n not `i`-connected.\n\n Fix an integer `n>0` and consider the set of graphs on `n`\n vertices. View each graph as its set of edges, so it is a\n subset of a set of size `n` choose 2. A graph is\n ...
def MatchingComplex(n): "\n The matching complex of graphs on `n` vertices.\n\n Fix an integer `n>0` and consider a set `V` of `n` vertices.\n A 'partial matching' on `V` is a graph formed by edges so that\n each vertex is in at most one edge. If `G` is a partial\n matching, then so is any graph o...
def ChessboardComplex(n, i): "\n The chessboard complex for an `n \\times i` chessboard.\n\n Fix integers `n, i > 0` and consider sets `V` of `n` vertices\n and `W` of `i` vertices. A 'partial matching' between `V` and\n `W` is a graph formed by edges `(v, w)` with `v \\in V` and `w\n \\in W` so t...
def RandomComplex(n, d, p=0.5): '\n A random ``d``-dimensional simplicial complex on ``n`` vertices.\n\n INPUT:\n\n - ``n`` -- number of vertices\n\n - ``d`` -- dimension of the complex\n\n - ``p`` -- floating point number between 0 and 1\n (optional, default 0.5)\n\n A random `d`-dimensi...
def SumComplex(n, A): '\n The sum complexes of Linial, Meshulam, and Rosenthal [LMR2010]_.\n\n If `k+1` is the cardinality of `A`, then this returns a\n `k`-dimensional simplicial complex `X_A` with vertices\n `\\ZZ/(n)`, and facets given by all `k+1`-tuples `(x_0, x_1,\n ..., x_k)` such that the s...
def RandomTwoSphere(n): '\n Return a random triangulation of the 2-dimensional sphere with `n`\n vertices.\n\n INPUT:\n\n `n` -- an integer\n\n OUTPUT:\n\n A random triangulation of the sphere chosen uniformly among\n the *rooted* triangulations on `n` vertices. Because some\n triangulatio...
def ShiftedComplex(generators): "\n Return the smallest shifted simplicial complex containing ``generators``\n as faces.\n\n Let `V` be a set of vertices equipped with a total order. The\n 'componentwise partial ordering' on k-subsets of `V` is defined as\n follows: if `A = \\{a_1 < \\cdots < a_k\...
def RudinBall(): '\n Return the non-shellable ball constructed by Rudin.\n\n This complex is a non-shellable triangulation of the 3-ball\n with 14 vertices and 41 facets, constructed by Rudin in\n [Rud1958]_.\n\n EXAMPLES::\n\n sage: R = simplicial_complexes.RudinBall(); R\n Rudin bal...
def ZieglerBall(): '\n Return the non-shellable ball constructed by Ziegler.\n\n This complex is a non-shellable triangulation of the 3-ball\n with 10 vertices and 21 facets, constructed by Ziegler in\n [Zie1998]_ and the smallest such complex known.\n\n EXAMPLES::\n\n sage: Z = simplicial_c...
def DunceHat(): '\n Return the minimal triangulation of the dunce hat given by Hachimori\n [Hac2016]_.\n\n This is a standard example of a space that is contractible\n but not collapsible.\n\n EXAMPLES::\n\n sage: D = simplicial_complexes.DunceHat(); D\n Minimal triangulation of the d...
def FareyMap(p): '\n Return a discrete surface associated with `PSL(2, \\GF(p))`.\n\n INPUT:\n\n - `p` -- a prime number\n\n The vertices are the non-zero pairs `(x,y)` in `\\GF(p)^2` modulo\n the identification of `(-x, -y)` with `(x,y)`.\n\n The triangles are the images of the base triangle ((...
def GenusSix(): '\n Return a triangulated surface of genus 6.\n\n This is triangulated with 12 vertices, 66 edges and 44 faces. Each\n vertex is neighbour to all other vertices.\n\n It appears as number `58` in the classification of Altshuler,\n Bokowski and Schuchert in [ABS96]_, where it is the u...
def is_SimplicialComplexHomset(x) -> bool: '\n Return ``True`` if and only if ``x`` is a simplicial complex homspace.\n\n EXAMPLES::\n\n sage: S = SimplicialComplex(is_mutable=False)\n sage: T = SimplicialComplex(is_mutable=False)\n sage: H = Hom(S, T)\n sage: H\n Set of M...
class SimplicialComplexHomset(sage.categories.homset.Homset): def __call__(self, f): '\n INPUT:\n\n - ``f`` -- a dictionary with keys exactly the vertices of the domain\n and values vertices of the codomain\n\n EXAMPLES::\n\n sage: S = simplicial_complexes.Sphere(...
def is_SimplicialComplexMorphism(x): '\n Return ``True`` if and only if ``x`` is a morphism of simplicial complexes.\n\n EXAMPLES::\n\n sage: from sage.topology.simplicial_complex_morphism import is_SimplicialComplexMorphism\n sage: S = SimplicialComplex([[0,1],[3,4]], is_mutable=False)\n ...
class SimplicialComplexMorphism(Morphism): '\n An element of this class is a morphism of simplicial complexes.\n ' def __init__(self, f, X, Y): '\n Input is a dictionary ``f``, the domain ``X``, and the codomain ``Y``.\n\n One can define the dictionary on the vertices of `X`.\n\n ...
class AbstractSimplex_class(SageObject): '\n A simplex of dimension ``dim``.\n\n INPUT:\n\n - ``dim`` -- integer, the dimension\n - ``degeneracies`` (optional) -- iterable, the indices of the\n degeneracy maps\n - ``underlying`` (optional) -- a non-degenerate simplex\n - ``name`` (optional)...
class NonDegenerateSimplex(AbstractSimplex_class, WithEqualityById): def __init__(self, dim, name=None, latex_name=None): "\n A nondegenerate simplex.\n\n INPUT:\n\n - ``dim`` -- non-negative integer, the dimension\n\n - ``name`` (optional) -- string, a name for this simplex.\...
def AbstractSimplex(dim, degeneracies=(), underlying=None, name=None, latex_name=None): "\n An abstract simplex, a building block of a simplicial set.\n\n In a simplicial set, a simplex either is non-degenerate or is\n obtained by applying degeneracy maps to a non-degenerate simplex.\n\n INPUT:\n\n ...
class SimplicialSet_arbitrary(Parent): '\n A simplicial set.\n\n A simplicial set `X` is a collection of sets `X_n`, the\n *n-simplices*, indexed by the non-negative integers, together with\n maps\n\n .. MATH::\n\n d_i: X_n \\to X_{n-1}, \\ \\ 0 \\leq i \\leq n \\ \\ \\text{(face maps)} \\\...
class SimplicialSet_finite(SimplicialSet_arbitrary, GenericCellComplex): "\n A finite simplicial set.\n\n A simplicial set `X` is a collection of sets `X_n`, the\n *n-simplices*, indexed by the non-negative integers, together with\n face maps `d_i` and degeneracy maps `s_j`. A simplex is\n *degene...
def standardize_degeneracies(*L): '\n Return list of indices of degeneracy maps in standard (decreasing)\n order.\n\n INPUT:\n\n - ``L`` -- list of integers, representing a composition of\n degeneracies in a simplicial set.\n\n OUTPUT:\n\n an equivalent list of degeneracies, standardized to...
def all_degeneracies(n, l=1): '\n Return list of all composites of degeneracies (written in\n "admissible" form, i.e., as a strictly decreasing sequence) of\n length `l` on an `n`-simplex.\n\n INPUT:\n\n - ``n``, ``l`` -- integers\n\n On an `n`-simplex, one may apply the degeneracies `s_i` for `...