application: common

This artificial application gathers functionality shared by many "real" applications. While most users can probably do without looking into this you may find some useful functions here.


Objects

  •  

    This is the common base class of all `big' objects in polymake. It is included in the online help because it provides several useful methods for scripting and interactive use.

    User Methods of Core::Object

    •  
      apply_rule (pattern)

      Executes the specified production rule. If the object does not possess enough initial properties to provide all required rule sources, or any of its preconditions are not satisfied, an exception is raised.

      Parameters
      Stringpattern
      : either a label (see prefer) or a rule header. The rule header must exactly match the definition in the rulefile, up to white spaces around property names. If the given pattern matches headers of several rules, or the given label is associated with several rules, the rule chain with smallest total weight (including the rules supplying the source properties) is chosen.
    •  
      disable_rules (pattern)

      Temporarily disable production rules matching given pattern for an object. Rules are re-enabled after the complete execution of the current script or input expression in interactive mode.

      Works much like the user function disable_rules but only affecting the given object.

      Parameters
      Stringpattern
      : either a label (see prefer) or a rule header. The rule header must exactly match the definition in the rulefile, up to white spaces around property names. If the given pattern matches headers of several rules, or the given label is associated with several rules, they all will be disabled regardless their precoditions, weights, or other attributes.
    •  
      dont_save ()

      Clears the `changed' flag in the object, so that it won't be saved in the XML file it stems from. This method is primarily designed for unit tests, but could be also useful in interactive mode if you want to revert all recent changes and reload the object from the data file.

    •  
      get_schedule (request) → Core::RuleChain

      Compose an optimal chain of production rules providing all requested properties. The returned RuleChain object can be applied to the original object as well as to any other object with the same initial set of properties. If no feasible rule chain exists, `undef' is returned.

      To watch the rule scheduler at work, e.g. to see announcements about tried preconditions, you may temporarily increase the verbosity levels $Verbose::rules and $Verbose::scheduler.

      Parameters
      Stringrequest
      : name of a property with optional alternatives or a property path in dotted notation. Several requests may be listed.
      Returns
      Core::RuleChain
    •  
      list_properties ()

      List all known properties.

    •  
      remove($) (prop)

      Remove the property prop from the object (if this operation is feasible, i.e., if prop is can be recomputed from the remaining properties).

      Parameters
      Stringprop
  •  

    A rule chain to compute properties of an object.

    User Methods of Core::RuleChain

    •  
      apply($) (o)

      Apply the rule chain to an object.

      Parameters
      Core::Objecto
    •  
      list ()

      List the properties computed by the rule chain.

  •  

    A database cursor. Initialize it with a DATABASE name, a COLLECTION name and a QUERY. You can then iterate over the objects matching the QUERY with next. It lazily fetches more objects from the database server. (Note that you have to create a new cursor if you want to start from the beginning.)

    Contained in extension polyDB.

    Properties of DatabaseCursor

    •  

      These are properties of the DatabaseCursor that are needed if you want to access some other database server. (Note that some things may not be implemented yet.)

      •  
        AUTH_DB: String

        The name of the authentication database, default 'admin'. (Functionality not implemented yet.)

      •  
        HOST: String

        The hostname of the database, default 'polymake.org'. (Functionality not implemented yet.)

      •  
        LOCAL: Bool

        Set this to 1 if you want to access a local database server. (Functionality not implemented yet.)

      •  
        PORT: Int

        The port of the database, default 27017. (Functionality not implemented yet.)

      •  
        TYPE_DB: String

        The name of the type database, default 'pm'. (Functionality not implemented yet.)

    •  

      These are basic properties of the DatabaseCursor. In this category you find everything you need to access the polymake database.

      •  
        COLLECTION: String

        The name of the collection the cursor accesses. Needed for initialization.

        See here or get_db_info for available databases.

      •  
        DATABASE: String

        The name of the database the cursor accesses. Needed for initialization.

        See here or get_db_info for available databases.

      •  
        PASSWORD: String

        Your password, default 'database'.

      •  
        QUERY: HASH

        The query.

        See here for an introduction.

      •  
        SKIP: Int

        Skip the first elements, default 0.

      •  
        SORT_BY: HASH

        Specify how you want to sort the objects. Use 1 for ascending and -1 for descending order.

        E.g. if you want to sort ascending by _id do SORT_BY => {"_id"=> 1}, if you want to sort descending by number of vertices do SORT_BY => {"N_VERTICES" => -1}.

      •  
        USER_NAME: String

        Your user name, default 'polymake'.

    •  

      These properties are computed automatically and only for internal use. You can safely ignore them.

      •  
        APP: String

        The application of the objects in the COLLECTION. Will be created automatically.

      •  
        CURSOR: SCALAR

        The actual MongoCursor. The "heart" of this object. Will be created automatically.

      •  
        TYPE: String

        The type of the objects in the COLLECTION. Will be created automatically.

    User Methods of DatabaseCursor

    •  
      COUNT () → Int

      The number of objects matching QUERY.

      Returns
      Int
    •  
      has_next () → Bool

      Returns true if there is another object to fetch.

      Returns
      Bool
    •  
      next () → Core::Object

      Returns the next object.

User Functions

  •  

    These are function that perform arithmetic computations.

    •  
      ceil (a) → Rational

      The ceiling function. Returns the smallest integral number not smaller than a.

      Parameters
      Rationala
      Returns
      Rational
    •  
      denominator (a) → Int

      Returns the denominator of a in a reduced representation.

      Parameters
      Rationala
      Returns
      Int
    •  
      denominator (f, f) → Polynomial

      Returns the denominator of a RationalFunction f.

    •  
      div (a, b) → Div

      Compute the quotient and remainder of a and b in one operation.

      Parameters
      Inta
      Intb
      Returns
      Div
    •  
      div_exact (a, b) → Int

      Computes the ratio of two given integral numbers under the assumption that the dividend is a multiple of the divisor.

      Parameters
      Inta
      Intb
      a divisor of a
      Returns
      Int
    •  
      ext_gcd (a, b) → ExtGCD

      Compute the greatest common divisor of two numbers (a,b) and accompanying co-factors.

      Parameters
      Inta
      Intb
      Returns
      ExtGCD
    •  
      fac (n) → Integer

      Computes the factorial n! = n·(n-1)·(n-2)·...·2·1.

      Parameters
      Intn
      >=0
      Returns
      Integer
      n!
    •  
      floor (a) → Rational

      The floor function. Returns the smallest integral number not larger than a.

      Parameters
      Rationala
      Returns
      Rational
    •  
      gcd (a, b) → Int

      Computes the greatest common divisor of two integers.

      Parameters
      Inta
      Intb
      Returns
      Int
    •  
      gcd (v) → Element

      Compute the greatest common divisor of the elements of the given vector.

      Parameters
      Vector<Element>v
      Returns
      Element
    •  
      gcd (p, q) → UniPolynomial

      Returns the greatest common divisor of two univariate polynomials.

    •  
      isfinite (a) → Bool

      Check whether the given number has a finite value.

      Parameters
      Integera
      Returns
      Bool
    •  
      isinf (a) → Bool

      Check whether the given number has an infinite value. Return -1/+1 for infinity and 0 for all finite values.

      Parameters
      Integera
      Returns
      Bool
    •  
      is_one (s) → Bool

      Compare with the one (1) value of the corresponding data type.

      Parameters
      Scalars
      Returns
      Bool
    •  
      is_zero (s) → Bool

      Compare with the zero (0) value of the corresponding data type.

      Parameters
      Scalars
      Returns
      Bool
    •  
      lcm (a, b) → Int

      Computes the least common multiple of two integers.

      Parameters
      Inta
      Intb
      Returns
      Int
    •  
      lcm (v) → Element

      Compute the least common multiple of the elements of the given vector.

      Parameters
      Vector<Element>v
      Returns
      Element
    •  
      numerator (a) → Int

      Returns the numerator of a in a reduced representation.

      Parameters
      Rationala
      Returns
      Int
    •  
      numerator (f) → Polynomial

      Returns the numerator of a RationalFunction f.

      Parameters
      RationalFunctionf
      Returns
      Polynomial
    •  
      sum_of_square_roots_naive (a) → Map<Rational, Rational>

      Make a naive attempy to sum the square roots of the entries of the input array.

      Parameters
      Array<Rational>a
      list of rational numbers (other coefficents are not implemented).
      Returns
      Map<Rational, Rational>
      coefficient_of_sqrt a map collecting the coefficients of various roots encountered in the sum. For example, {(3 1/2),(5 7)} represents sqrt{3}/2 + 7 sqrt{5}. If the output is not satisfactory, please use a symbolic algebra package.
  •  

    This category contains combinatorial functions.

  •  
    UNDOCUMENTED
    •  
      cast <Target> (object) → Object

      Change the type of the polymake object: only downcast (to a derived type) and upcast (to an ancestor type) are allowed.

      Type Parameters
      Target
      the desired new type
      Parameters
      Objectobject
      to be modified
      Returns
      Object
      the same object, but with modified type
    •  
      cols ()

      UNDOCUMENTED

    •  
      cols (A) → ARRAY<Vector>

      Returns an array containing the columns of A.

      Parameters
      MatrixA
      Returns
      ARRAY<Vector>
    •  
      concat_rows (A) → Vector

      Concatenates the rows of A.

      Parameters
      MatrixA
      Returns
      Vector
    •  
      convert_to <Target> (s) → Target

      Explicit conversion to different scalar type.

      Type Parameters
      Target
      Parameters
      Scalars
      Returns
      Target
    •  
      convert_to <Target> (v) → Vector<Target>

      Explicit conversion to a different element type.

      Type Parameters
      Target
      Parameters
      Vectorv
      Returns
      Vector<Target>
    •  
      convert_to <Target> (m) → Matrix<Target>

      Explicit conversion to a different element type.

      Type Parameters
      Target
      Parameters
      Matrixm
      Returns
      Matrix<Target>
    •  
      dense (v) → Vector

      Return the input vector (which is already in dense form).

      Parameters
      Vectorv
      Returns
      Vector
    •  
      dense (m) → Matrix

      Return the input matrix (which is already in dense form).

      Parameters
      Matrixm
      Returns
      Matrix
    •  
      dense <Element> (v) → Vector<Element>

      Convert to an equivalent dense vector of the same element type.

      Type Parameters
      Element
      Parameters
      SparseVector<Element>v
      Returns
      Vector<Element>
    •  
      dense <Element> (m) → Matrix<Element>

      Convert to an equivalent dense matrix of the same element type.

      Type Parameters
      Element
      Parameters
      SparseMatrix<Element>m
      Returns
      Matrix<Element>
    •  
      dense (m) → Matrix<Int>

      Convert to a dense 0/1 matrix.

      Parameters
      IncidenceMatrixm
      Returns
      Matrix<Int>
    •  
      dense (s, dim) → Vector<Int>

      Convert to a dense 0/1 vector of a given dimension.

      Parameters
      Sets
      Intdim
      Returns
      Vector<Int>
    •  
      index_matrix (m) → IncidenceMatrix

      Get the positions of non-zero entries of a sparse matrix.

      Parameters
      SparseMatrixm
      Returns
      IncidenceMatrix
    •  
      indices (v) → Set<Int>

      Get the positions of non-zero entries of a sparse vector.

      Parameters
      SparseVectorv
      Returns
      Set<Int>
    •  
      repeat_row (v, i)

      UNDOCUMENTED
      Parameters
      Vectorv
      Inti
    •  
      rows ()

      UNDOCUMENTED

    •  
      rows (A) → ARRAY<Vector>

      Returns an array containing the rows of A.

      Parameters
      MatrixA
      Returns
      ARRAY<Vector>
    •  
      toMatrix <Scalar> (A)

      UNDOCUMENTED
      Type Parameters
      Scalar
      Parameters
      IncidenceMatrixA
    •  
      toPolynomial (s, vars)

      Read a Polynomial from a String.

      Parameters
      Strings
      ARRAYvars
    •  
      toVector <Scalar> (S)

      UNDOCUMENTED
      Type Parameters
      Scalar
      Parameters
      SetS
    •  
      vector2col (v) → Matrix

      Convert a Vector to a Matrix with a single column.

      Parameters
      Vectorv
      Returns
      Matrix
    •  
      vector2row (v) → Matrix

      Convert a Vector to a Matrix with a single row.

      Parameters
      Vectorv
      Returns
      Matrix
  •  

    Here you can find the functions to access the polymake database.

    Contained in extension polyDB.

    •  
      db_info ()

      Print information about available databases and collections.

      Options
      Stringdb
      name of the database, default: all available databases
      Stringcollection
      name of the collection, default: all available collections
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Some databases might have access control.
    •  
      get_col_list (db) → Array

      Returns a list of all collections in the database db.

      Parameters
      Stringdb
      name of the database
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Returns
      Array
    •  
      get_db_list () → Array

      Returns a list of available databases.

      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Returns
      Array
    •  
      poly_db (query) → Array<Core::Object>

      Returns all objects in the database db in collection that match the query. This is only recommended for a reasonably small number of matching objects. If you expect many such objects you should instead construct a DatabaseCursor.

      Contained in extension polyDB.

      Parameters
      HASHquery
      Options
      Stringdb
      name of the database, see here or db_info for available databases
      Stringcollection
      name of the collection, see here or db_info for available collections
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Intlimit
      limit the number of objects that will be returned (default: no limit)
      HASHsort_by
      specify a sorting order
      Intskip
      skip the first elements, default: 0
      Stringusername
      Some databases might have access control.
      Stringpassword
      Some databases might have access control.
      Returns
      Array<Core::Object>
    •  
      poly_db_count (query) → Int

      Returns the number of objects in the database db in collection that match the query.

      Contained in extension polyDB.

      Parameters
      HASHquery
      Options
      Stringdb
      name of the database, see here or db_info for available databases
      Stringcollection
      name of the collection, see here or db_info for available collections
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Some databases might have access control.
      Stringpassword
      Some databases might have access control.
      Returns
      Int
    •  
      poly_db_ids (query) → Array<String>

      Returns the IDs of all objects in the database db in collection that match the query. This is only recommended for a reasonably small number of matching objects. If you expect many such objects you should instead construct a DatabaseCursor.

      Contained in extension polyDB.

      Parameters
      HASHquery
      Options
      Stringdb
      name of the database, see here or db_info for available databases
      Stringcollection
      name of the collection, see here or db_info for available collections
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Intlimit
      limit the number of objects that will be returned (default: no limit)
      HASHsort_by
      specify a sorting order
      Intskip
      skip the first elements, default: 0
      Stringusername
      Some databases might have access control.
      Stringpassword
      Some databases might have access control.
      Returns
      Array<String>
    •  
      poly_db_one (query) → Core::Object

      Returns one object in the database db in collection that matches the query.

      Contained in extension polyDB.

      Parameters
      HASHquery
      Options
      Stringdb
      name of the database, see here or db_info for available databases
      Stringcollection
      name of the collection, see here or db_info for available collections
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Some databases might have access control.
      Stringpassword
      Some databases might have access control.
      Returns
      Core::Object
  •  

    These are administrative functions. You need admin access to the database for these.

    This category also contains functions that I want to hide from the public because they are not yet completely presentable.

    Contained in extension polyDB.

    •  
      create_packages (db, col)

      Subdivides all objects into packages that are to be updated. (E.g. by computing missing properties.)

      Contained in extension poly_database.

      Parameters
      Stringdb
      Stringcol
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Intpackage_size
      default 100
    •  
      db_do_package ()

      Updates a pack of objects in the collection SmoothReflexive in the database LatticePolytopesR. Moreover, it matches their properties with the template object for this collection.

      Note that you need write access to the database for this. You will be asked for credentials if you don't specify them.

      Contained in extension poly_database.

      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Intpackage_size
      default 100
      Stringcontrib
      use this to update the contributor
    •  
      db_work_on_packages ()

      Perpetually works on the database until it is killed.

      Note that you need write access to the database for this. You will be asked for credentials if you don't specify them.

      Contained in extension poly_database.

      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Intpackage_size
      default 100
      Stringcontrib
      use this to update the contributor
    •  
      reset_active_packages (db, col)

      Resets all active packages in the collection col in database db. Only use this if you are sure that they are no longer being processed.

      Contained in extension poly_database.

      Parameters
      Stringdb
      Stringcol
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
    •  
      set_col_info (db, collection, description)

      Set the information for collection col in database db. You need write access for this.

      Parameters
      Stringdb
      name of the database
      Stringcollection
      name of the collection
      Stringdescription
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
    •  
      set_db_info (db, description)

      Set or update the information for database db. You need write access for this.

      Parameters
      Stringdb
      name of the database
      Stringdescription
      Options
      Arrayusers
      usernames that have read access; if you do not specify this, the list will remain unchanged; for a new database the default is ["pm"] (read access for everyone)
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
    •  
      set_type_info (db, col)

      Set or update type (and template) information for collection col in the database db.

      Note that you need write access to the type database for this.

      Contained in extension polyDB.

      Parameters
      Stringdb
      database name
      Stringcol
      collection name
      Options
      Stringapp
      application name for the objects
      Stringtype
      type name for the objects
      Stringversion
      polymake version, will be set to the current version by default
      Stringcontributor
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Core::Objecttemplate
      Core::Objecttinytemplate
      template object with minimal set of properties
    •  
      show_active_packages (db, col)

      Prints all active packages in the collection col in database db with start time and host computer.

      Contained in extension poly_database.

      Parameters
      Stringdb
      Stringcol
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Boolv
      set to 1 if you want to have many details
      Intolder_than
      only show packages with start time older_than hours ago, set to 0 to show everything TODO
      Boolprint_reset_code
      set this to 1 if you want to get the reset code for every active package (you need write access to reset), default 0
  •  

    These are the functions to insert and update objects. You need write access to the database for these.

    Contained in extension polyDB.

    •  
      db_batch_insert (files, db, col)

      Adds a list of objects from files to the collection col in the database db. It assumes that the objects names can be used to generate unique ids. Objects with ids that are already contained in the database will be skipped (and moved to move_dir if indicated).

      TODO: It still processes (and inserts) the files one by one (which is fine if the objects are relatively large). If one wants to insert a large number of very small objects there is a more efficient way of doing this.

      Note that you need write access to the database for this. You will be asked for credentials if you don't specify them.

      Contained in extension polyDB.

      Parameters
      Array<String>files
      list of file names
      Stringdb
      database name
      Stringcol
      collection name
      Options
      Stringcontrib
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Booluse_template
      set to 1 to match properties with a template object.
      Boolnonew
      set to 1 if you don't want to compute missing properties but only delete surplus ones
      Stringmove_dir
      directory in which processed files are moved
      Boolverbose
      print database output
      MongoClientclient
    •  
      db_batch_update (obj_list, db, col)

      Updates a list of objects in the collection col in the database db. Moreover, it matches their properties with the template object for this collection.

      Note that you need write access to the database for this. You will be asked for credentials if you don't specify them.

      Contained in extension polyDB.

      Parameters
      Arrayobj_list
      either an Array<Core::Object> of polymake objects or an Array<String> of IDs
      Stringdb
      database name
      Stringcol
      collection name
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Stringcontrib
      use this to update the contributor
    •  
      db_insert (obj, db, col) → String

      Adds an object obj to the collection col in the database db.

      Note that you need write access to the database for this.

      Contained in extension polyDB.

      Parameters
      Core::Objectobj
      Stringdb
      database name
      Stringcol
      collection name
      Options
      Stringid
      unique identifier
      Stringcontrib
      set the contributor
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Booluse_template
      set to 1 to match properties with a template object
      Boolnonew
      set to 1 if you don't want to compute missing properties but only delete surplus ones (only takes effect if use_template is also set to 1)
      Core::Objecttemplate
      can be precomputed for better performance when applying to multiple objects (implies use_template => 1)
      MongoClientclient
      Returns
      String
    •  
      db_insert_from_file (file, db, col) → String

      Adds an object from a file file to the collection col in the database db. First it matches its properties with the template object for this collection (unless your options say otherwise).

      Note that you need write access to the database for this.

      Contained in extension polyDB.

      Parameters
      Stringfile
      polymake object stored in a file
      Stringdb
      database name
      Stringcol
      collection name
      Options
      Stringid
      unique identifier, if you don't specify one, polyDB will try to create one from the object name or file name, if this does not work out one will be created automatically
      Stringcontrib
      set the contributor
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Booluse_template
      set to 1 to match properties with a template object.
      Boolnonew
      set to 1 if you don't want to compute missing properties but only delete surplus ones (only takes effect if use_template is also set to 1)
      Core::Objecttemplate
      can be precomputed for better performance when applying to multiple objects (implies use_template => 1)
      MongoClientclient
      Returns
      String
    •  
      db_remove (id, db, col) → String

      Removes the object with a given id from the collection col in the database db.

      Note that you need write access to the database for this.

      Contained in extension polyDB.

      Parameters
      Stringid
      Stringdb
      database name
      Stringcol
      collection name
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      MongoClientclient
      Returns
      String
    •  
      db_update_id (db, col, id) → String

      Updates the object with a given _id in the collection col in the database db by matching its properties with the template object for this collection.

      Note that you need write access to the database for this. You will be asked for credentials if you don't specify them.

      Contained in extension polyDB.

      Parameters
      Stringdb
      database name
      Stringcol
      collection name
      Stringid
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Stringusername
      Stringpassword
      Stringcontrib
      use this to update the contributor
      Core::ChainRuleschedule
      Returns
      String
    •  
      get_template_object (db, collection) → Core::Object

      Returns the template object for the collection col of the database db (if this is set).

      Contained in extension polyDB.

      Parameters
      Stringdb
      name of the database, see here or db_info for available databases
      Stringcollection
      name of the collection, see here or db_info for available collections
      Options
      Boollocal
      set to 1 if you want to use a local database (on localhost), default 0
      Booltiny
      , default 0
      Returns
      Core::Object
  •  
    UNDOCUMENTED
    •  
      labeled (data, elem_labels) → String

      Prepares a vector for printing, prepends each element with a label and a colon.

      Parameters
      Vectordata
      to be printed
      Array<String>elem_labels
      optional labels for elements; if data is a Set, or similar, each element will be replaced by its label.
      Returns
      String
    •  
      latex (data, elem_labels) → String

      LaTeX output of a matrix.

      Parameters
      Matrixdata
      to be printed
      Array<String>elem_labels
      optional labels for elements; if data is an IncidenceMatrix, Array<Set>, or similar, each element will be replaced by its label.
      Returns
      String
      to be used with \usepackage{amsmath}
    •  
      numbered (data) → String

      Equivalent to labeled with omitted elem_labels argument.

      Parameters
      Vectordata
      to be printed
      Returns
      String
    •  
      print_constraints (M, are_eqs)

      Write the rows of a matrix M as inequalities (are_eqs=0) or equations (are_eqs=1) in a readable way. It is possible to specify labels for the coordinates via an optional array coord_labels.

      Parameters
      Matrix<Scalar>M
      the matrix whose rows are to be written
      Intare_eqs
      optional; needs to be set to 1 if the rows represent equations instead of inequalities
      Options
      Array<String>coord_labels
      changes the labels of the coordinates from 'x1,...,xn' to the specified names
    •  
      rows_labeled (data, row_labels, elem_labels) → Array<String>

      Prepares a matrix for printing, prepends each row with a label and a colon.

      Parameters
      Matrixdata
      to be printed
      Array<String>row_labels
      labels for the rows
      Array<String>elem_labels
      optional labels for elements; if data is an IncidenceMatrix, Array<Set>, or similar, each element will be replaced by its label.
      Returns
      Array<String>
      each string ending with end-of-line
    •  
      rows_labeled (graph, elem_labels) → Array<String>

      Like above, but specialized for Graphs (defined for convenience: a PTL Graph is not a container)

      Parameters
      Graphgraph
      to be printed
      Array<String>elem_labels
      labels for the elements
      Returns
      Array<String>
      each string ending with end-of-line
    •  
      rows_numbered (data) → Array<String>

      Equivalent to rows_labeled with omitted row_labels argument. Formerly called "numbered".

      Parameters
      Matrixdata
      to be printed
      Returns
      Array<String>
      each string ending with end-of-line
  •  
    UNDOCUMENTED
    •  
      adjacency_matrix (graph) → IncidenceMatrix

      Returns the adjacency matrix of graph nodes. For a normal graph, it will be a kind of IncidenceMatrix, for multigraph, it will be a SparseMatrix<Int>, with entries encoding the number of parallel edges between two nodes.

      Parameters
      Graphgraph
      Returns
      IncidenceMatrix
      both rows and columns correspond to the nodes
    •  
      edges (graph) → EdgeList

      Returns the sequence of all edges of a graph. The edges will appear in ascending order of their tail and head nodes. In the Undirected case, the edges will appear once, ordered by the larger index of their incident nodes.

      Parameters
      Graphgraph
      Returns
      EdgeList
    •  
      induced_subgraph (graph, set) → Graph

      Creates an induced subgraph for the given subset of nodes.

      Parameters
      Graphgraph
      Setset
      indices of selected nodes
      Returns
      Graph
    •  
      nodes (graph) → NodeSet

      Returns the sequence of all valid nodes of a graph.

      Parameters
      Graphgraph
      Returns
      NodeSet
    •  
      node_edge_incidences <Coord> (graph) → SparseMatrix<Coord>

      Returns the node-edge incidence matrix of a graph.

      Type Parameters
      Coord
      coordinate type for the resulting matrix, default: Int
      Parameters
      Graphgraph
      Returns
      SparseMatrix<Coord>
  •  
    UNDOCUMENTED
    •  
      eliminate_denominators (v) → Vector<Integer>

      Scale a vector with the least common multiple of the denominators of its coordinates.

      Parameters
      Vectorv
      Returns
      Vector<Integer>
    •  
      eliminate_denominators_entire (v) → Matrix<Integer>

      Scales entire matrix with the least common multiple of the denominators of its coordinates.

      Parameters
      Matrixv
      Returns
      Matrix<Integer>
    •  
      eliminate_denominators_entire_affine (v) → Matrix<Integer>

      Scales entire matrix with the least common multiple of the denominators of its coordinates (ignore first column).

      Parameters
      Matrixv
      Returns
      Matrix<Integer>
    •  
      eliminate_denominators_in_rows (v) → Matrix<Integer>

      Scale a matrix rowwise with the least common multiple of the denominators of its coordinates.

      Parameters
      Matrixv
      Returns
      Matrix<Integer>
    •  
      is_integral (v) → Bool

      Checks whether all coordinates of a rational vector are integral.

      Parameters
      Vectorv
      Returns
      Bool
    •  
      is_integral (m) → Bool

      Checks whether all coordinates of a rational matrix are integral.

      Parameters
      Matrixm
      Returns
      Bool
    •  
      primitive (v) → Vector<Integer>

      Scales the vector to a primitive integral vector.

      Parameters
      Vectorv
      Returns
      Vector<Integer>
    •  
      primitive (M) → Matrix<Integer>

      Scales each row of the matrix to a primitive integral vector.

      Parameters
      MatrixM
      Returns
      Matrix<Integer>
    •  
      primitive_affine (v) → Vector<Integer>

      Scales the affine part of a vector to a primitive integral vector.

      Parameters
      Vectorv
      Returns
      Vector<Integer>
    •  
      primitive_affine (M) → Matrix<Integer>

      Scales the affine part of each row of the matrix to a primitive integral vector.

      Parameters
      MatrixM
      Returns
      Matrix<Integer>
  •  
    UNDOCUMENTED
    •  
      anti_diag (d) → SparseMatrix

      Produces a SparseMatrix from its anti-diagonal.

      Parameters
      Vectord
      the anti-diagonal entries
      Returns
      SparseMatrix
    •  
      anti_diag (m1, m2) → SparseMatrix

      Returns a block anti-diagonal matrix with blocks m1 and m2.

      Parameters
      Matrixm1
      Matrixm2
      Returns
      SparseMatrix
    •  
      basis (A) → Pair<Set<Int>, Set<Int>>

      Computes subsets of the rows and columns of A that form a basis for the linear space spanned by A.

      Parameters
      MatrixA
      Returns
      Pair<Set<Int>, Set<Int>>
      The first set corresponds to the rows, the second to the columns.
    •  
      basis_affine (A) → Pair<Set<Int>, Set<Int>>

      Does the same as basis ignoring the first column of the matrix.

      Parameters
      MatrixA
      Returns
      Pair<Set<Int>, Set<Int>>
      The first set corresponds to the rows, the second to the columns.
    •  
      basis_cols (A) → Set<Int>

      Computes a subset of the columns of A that form a basis for the linear space spanned by A.

      Parameters
      MatrixA
      Returns
      Set<Int>
    •  
      basis_rows (A) → Set<Int>

      Computes a subset of the rows of A that form a basis for the linear space spanned by A.

      Parameters
      MatrixA
      Returns
      Set<Int>
    •  
      det (A) → Int

      Computes the determinant of a matrix using Gauss elimination.

      Parameters
      MatrixA
      Returns
      Int
      det(A)
    •  
      diag (d) → SparseMatrix

      Produces a SparseMatrix from its diagonal.

      Parameters
      Vectord
      the diagonal entries
      Returns
      SparseMatrix
    •  
      diag (m1, m2) → SparseMatrix

      Returns a block diagonal matrix with blocks m1 and m2.

      Parameters
      Matrixm1
      Matrixm2
      Returns
      SparseMatrix
    •  
      equal_bases (A1, A2) → Bool

      Check whether both matrices are bases of the same linear subspace.

      Parameters
      MatrixA1
      MatrixA2
      Returns
      Bool
    •  
      inv (A) → Matrix

      Computes the inverse A-1 of an invertible matrix A using Gauss elimination.

      Parameters
      MatrixA
      Returns
      Matrix
    •  
      lineality_space (A) → Matrix

      Compute the lineality space of a matrix A.

      Parameters
      MatrixA
      Returns
      Matrix
    •  
      lin_solve (A, b) → Vector

      Computes the solution of the system Ax = b

      Parameters
      MatrixA
      must be invertible
      Vectorb
      Returns
      Vector
    •  
      normalized (A) → Matrix

      Normalize a matrix by dividing each row by its length (l2-norm).

      Parameters
      MatrixA
      Returns
      Matrix
    •  
      null_space (A) → Matrix

      Compute the null space of a matrix A.

      Parameters
      MatrixA
      Returns
      Matrix
    •  
      null_space (b) → Matrix

      Compute the null space of a vector b.

      Parameters
      Vectorb
      Returns
      Matrix
    •  
      ones_vector <Element> (d) → Vector<Element>

      Creates a vector with all elements equal to 1.

      Type Parameters
      Element
      default: Rational.
      Parameters
      Intd
      vector dimension. If omitted, a vector of dimension 0 is created, which can adjust itself when involved in a block matrix operation.
      Returns
      Vector<Element>
    •  
      rank (A) → Int

      Computes the rank of a matrix.

      Parameters
      MatrixA
      Returns
      Int
    •  
      reduce (A, b) → Vector

      Reduce a vector with a given matrix using Gauss elimination.

      Parameters
      MatrixA
      Vectorb
      Returns
      Vector
    •  
      smith_normal_form (M, inv)

      Compute the Smith normal form of a given matrix M.

      Parameters
      MatrixM
      must be of integer type
      Boolinv
      optional, if true, compute the inverse of the companion matrices
    •  
      totally_unimodular (A) → Bool

      The matrix A is totally unimodular if the determinant of each square submatrix equals 0, 1, or -1. This is the naive test (exponential in the size of the matrix).

      Parameters
      MatrixA
      Returns
      Bool
    •  
      transpose (A) → IncidenceMatrix

      Computes the transpose AT of an incidence matrix A, i.e., (aT)ij = aji.

    •  
      transpose (A) → Matrix

      Computes the transpose AT of a matrix A, i.e., (aT)ij = aji.

      Parameters
      MatrixA
      Returns
      Matrix
    •  
      unit_matrix <Element> (d) → SparseMatrix<Element>

      Creates a unit matrix of given dimension

      Type Parameters
      Element
      default: Rational
      Parameters
      Intd
      dimension of the matrix
      Returns
      SparseMatrix<Element>
    •  
      unit_vector <Element> (d, pos) → SparseVector<Element>

      Creates a SparseVector of given length d with a one entry at position pos and zeroes elsewhere.

      Type Parameters
      Element
      default: Rational
      Parameters
      Intd
      the dimension of the vector
      Intpos
      the position of the 1
      Returns
      SparseVector<Element>
    •  
      zero_matrix <Element> (i, j) → SparseMatrix<Element>

      Creates a zero matrix of given dimensions

      Type Parameters
      Element
      default: Rational
      Parameters
      Inti
      number of rows
      Intj
      number of columns
      Returns
      SparseMatrix<Element>
    •  
      zero_vector <Element> (d) → Vector<Element>

      Creates a vector with all elements equal to zero.

      Type Parameters
      Element
      default: Rational
      Parameters
      Intd
      vector dimension. If omitted, a vector of dimension 0 is created, which can adjust itself when involved in a block matrix operation.
      Returns
      Vector<Element>
  •  
    UNDOCUMENTED
    •  
      pluecker (V) → Vector

      Compute vector of maximal minors of a matrix. WARNING: interpretation different in tropical::lifted_pluecker

      Parameters
      MatrixV
      Returns
      Vector
  •  

    This category contains functions performing operations on Sets.

    •  
      incl (s1, s2) → Int

      Analyze the inclusion relation of two sets.

      Parameters
      Sets1
      Sets2
      Returns
      Int
      0 if s1 = s2,
      -1 if s1 \(\subset\) s2,
      1 if s1 \(\supset\) s2,
      2 otherwise.
    •  
      range (a, b) → Set<Int>

      Creates the Set {a, a+1, ..., b-1, b} for ab-1. (The result will be empty if a = b-1.)

      Parameters
      Inta
      Intb
      Returns
      Set<Int>
    •  
      scalar2set (s) → Set<Scalar>

      Returns the singleton set {s}.

      Parameters
      Scalars
      Returns
      Set<Scalar>
    •  
      select_subset (s, indices) → Set

      Returns the subset of s given by the indices.

      Parameters
      Sets
      Set<Int>indices
      Returns
      Set
    •  
      sequence (a, c) → Set<Int>

      Creates the Set {a, a+1, ..., a+c-1}.

      Parameters
      Inta
      the smallest element
      Intc
      the cardinality
      Returns
      Set<Int>
  •  
    UNDOCUMENTED
    •  
      average (array)

      Returns the average value of the array elements.

      Parameters
      Arrayarray
    •  
      bounding_box (m) → Matrix

      Compute a column-wise bounding box for the give matrix

      Parameters
      Matrixm
      Returns
      Matrix
      : row(0) contains lower bounds, row(1) contains upper bounds
    •  
      copy_properties (obj, template)

      Takes an Object obj and a template Object of the same type and computes or deletes properties so that they have (more or less) the same list of known properties. (This is just a quick and dirty solution for this until I make a fast and efficient one.)

      There might be some problems since polymake does not allow deletion of non-redundant properties. This in particular poses a problem if obj was retrieved from a database.

      Contained in extension polyDB.

      Parameters
      Core::Objectobj
      Core::Objecttemplate
      Options
      Boolnonew
      set to 1 if you don't want to compute missing properties
    •  
      copy_properties_c (obj, template)

      Make sure that obj has (more or less) the same set of properties that the template temp has.

      Parameters
      perl::Objectobj
      perl::Objecttemplate
      Options
      Boolnonew
      set to 1 if you don't want to compute missing properties, default 0
    •  
      fibonacci (m) → ARRAY

      Returns the first m Fibonacci numbers.

      Parameters
      Intm
      Returns
      ARRAY
    •  
      histogram (data) → Map<Element, Int>

      Produce a histogram of a container: each different element value is mapped on the number of its occurences.

      Parameters
      Container<Element>data
      Returns
      Map<Element, Int>
    •  
      maximum (array)

      Returns the maximal element of an array.

      Parameters
      Arrayarray
    •  
      minimum (array)

      Returns the minimal element of an array.

      Parameters
      Arrayarray
    •  
      perturb_matrix (M, eps, not_hom) → Matrix

      Perturb a given matrix M by adding a random matrix. The random matrix consists of vectors that are uniformly distributed on the unit sphere. Optionally, the random matrix can be scaled by a factor eps.

      Parameters
      MatrixM
      Floateps
      the factor by which the random matrix is multiplied default value: 1
      Boolnot_hom
      if set to 1, the first column will also be perturbed; otherwise the first columns of the input matrix M and the perturbed one coincide (useful for working with homogenized coordinates); default value: 0 (homogen. coords)
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Matrix
  •  
    UNDOCUMENTED
    •  
      compose (vis_obj ...) → Visual::Container

      Create a composite drawing of several objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to be drawn together
      Options
      StringTitle
      name of the whole drawing; per default the name of the first Object is taken.
      anydecorations
      to be applied to all components as default values.
      Returns
      Visual::Container
      if called in void context, immediately starts the preferred rendering program.
    •  
      compose (vis_container, vis_obj ...) → Visual::Container

      Add new objects to a composite drawing.

      Parameters
      Visual::Containervis_container
      drawing produced by some visualization function
      Visual::Objectvis_obj ...
      objects to be added
      Options
      StringTitle
      new name for the drawing
      anydecorations
      to be applied to all components as default values.
      Returns
      Visual::Container
      if called in void context, immediately starts the preferred rendering program.
    •  
      javaview (vis_obj ...)

      Run JavaView with the given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to display
      Options
      StringFile
      "filename" or "AUTO" Store the object description in a JVX file without starting the interactive GUI. The .jvx suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      jreality (vis_obj ...)

      Run jReality to display given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to display
      Options
      StringFile
      "filename" or "AUTO" Store the object description in a bean shell source file without starting the interactive GUI. The .bsh suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      postscript (vis_obj ...)

      Create a Postscript (tm) drawing with the given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to draw
      Options
      StringFile
      "filename" or "AUTO" Store the drawing in a file without starting the viewer. The .ps suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      sketch (vis_obj ...)

      Produce a Sketch input file with given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to display
      Options
      StringFile
      "filename" or "AUTO"
      For the file name you can use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe. Real file names are automatically completed with the .sk suffix if needed.
      An automatically generated file name is displayed in the verbose mode.
    •  
      static (vis_obj) → Visual::Object

      Suppress creation of dynamic (interactive) scenes.

      Parameters
      Visual::Objectvis_obj
      drawing, e.g. created by VISUAL_GRAPH or SCHLEGEL.
      Returns
      Visual::Object
      if called in void context, immediately starts the preferred rendering program.

Property Types

  •  
    boost_dynamic_bitset

    UNDOCUMENTED

    derived from: Set<Int>

    User Methods of boost_dynamic_bitset

    •  
      size ()

      UNDOCUMENTED

  •  

    This category contains all "algebraic" types, such as matrices, vectors, polynomials, rings, ...

    •  
      all_rows_or_cols

      Use the keyword "All" for all rows or columns, e.g. when constructing a minor.

    •  
      Matrix <Element, Sym>
      UNDOCUMENTED
      Type Parameters
      Element
      default: Rational
      Sym
      default: NonSymmetric

      User Methods of Matrix

      •  
        anti_diagonal (i) → Vector<Element>

        Returns the anti-diagonal of the matrix.

        Parameters
        Inti
        i=0: the main anti_diagonal (optional)
        i>0: the i-th anti_diagonal below the main anti_diagonal
        i<0: the i-th anti_diagonal above the main anti_diagonal
        Returns
        Vector<Element>
      •  
        col (i) → Vector<Element>

        Returns the i-th column.

        Parameters
        Inti
        Returns
        Vector<Element>
      •  
        cols () → Int

        Returns the number of columns.

        Returns
        Int
      •  
        diagonal (i) → Vector<Element>

        Returns the diagonal of the matrix.

        Parameters
        Inti
        i=0: the main diagonal (optional)
        i>0: the i-th diagonal below the main diagonal
        i<0: the i-th diagonal above the main diagonal
        Returns
        Vector<Element>
      •  
        div_exact (a) → Matrix

        Divides every entry by a (assuming that every entry is divisible by a).

        Parameters
        Inta
        Returns
        Matrix
      •  
        minor (r, c) → Matrix

        Returns a minor of the matrix containing the rows in r and the columns in c. You can pass All if you want all rows or columns and ~ for the complement of a set. E.g.

        $A->minor(All, ~[0]);

        will give you the minor of a matrix containing all rows and all but the 0-th column.

        Parameters
        Setr
        the rows
        Setc
        the columns
        Returns
        Matrix
      •  
        row (i) → Vector<Element>

        Returns the i-th row.

        Parameters
        Inti
        Returns
        Vector<Element>
      •  
        rows () → Int

        Returns the number of rows.

        Returns
        Int
    •  
      Monomial <Coefficient, Exponent>
      UNDOCUMENTED
      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int
    •  
      Plucker <Scalar>
      UNDOCUMENTED
      Type Parameters
      Scalar
      default: Rational
    •  
      Polynomial <Coefficient, Exponent>
      UNDOCUMENTED
      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int

      User Methods of Polynomial

    •  
      RationalFunction <Coefficient, Exponent>
      UNDOCUMENTED
      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int
    •  
      Ring <Coefficient, Exponent>
      UNDOCUMENTED
      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int

      User Methods of Ring

    •  
      SparseIterator
      UNDOCUMENTED
    •  
      SparseMatrix <Element, Sym>

      A SparseMatrix is a two-dimensional associative array with row and column indices as keys; elements equal to the default value (ElementType(), which is 0 for most numerical types) are not stored, but implicitly encoded by the gaps in the key set. Each row and column is organized as an AVL-tree.

      Use dense to convert this into its dense form.

      You can create a new SparseMatrix by entering its entries row by row, as a list of SparseVectors e.g.:

      $A = new SparseMatrix<Int>(<< '.');
      (5) (1 1)
      (5) (4 2)
      (5)
      (5) (0 3) (1 -1)
      .
      Type Parameters
      Element
      Sym
      one of Symmetric or NonSymmetric, default: NonSymmetric]

      User Methods of SparseMatrix

      •  
        squeeze ()

        Removes empty rows and columns. The remaining rows and columns are renumbered without gaps.

      •  
        squeeze_cols ()

        Removes empty columns. The remaining columns are renumbered without gaps.

      •  
        squeeze_rows ()

        Removes empty rows. The remaining rows are renumbered without gaps.

    •  
      SparseVector <Element>

      A SparseVector is an associative container with element indices (coordinates) as keys; elements equal to the default value (ElementType(), which is 0 for most numerical types) are not stored, but implicitly encoded by the gaps in the key set. It is based on an AVL tree.

      A SparseVector is encoded as a sequence (l) (p1 v1) ... (pk vk), where l is the length of the vector and each pair (pi vi) denotes an entry with value vi at position pi. All other entries are zero.

      Use dense to convert this into its dense form.

      You can create a new SparseVector by entering its encoding as described above, e.g.:

      $v = new SparseVector<Int>(<< '.');
      (6) (1 1) (2 2)
      .
      Type Parameters
      Element

      User Methods of SparseVector

      •  
        size () → Int

        The number of non-zero entries.

        Returns
        Int
    •  
      Term <Coefficient, Exponent>
      UNDOCUMENTED
      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int
    •  
      UniMonomial <Coefficient, Exponent>

      A class for univariate monomials.

      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int
    •  
      UniPolynomial <Coefficient, Exponent>

      A class for univariate polynomials.

      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int

      User Methods of UniPolynomial

    •  
      UniTerm <Coefficient, Exponent>

      A class for univariate terms.

      Type Parameters
      Coefficient
      default: Rational
      Exponent
      default: Int
    •  
      Vector <Element>

      A type for vectors with entries of type Element.

      You can perform algebraic operations such as addition or scalar multiplication.

      You can create a new Vector by entering its elements, e.g.:

      $v = new Vector<Int>(1,2,3);

      or

      $v = new Vector<Int>([1,2,3]);
      Type Parameters
      Element

      User Methods of Vector

      •  
        dim () → Int

        The length of the vector

        Returns
        Int
      •  
        div_exact (a) → Vector

        Divides every entry by a (assuming that every entry is divisible by a).

        Parameters
        Inta
        Returns
        Vector
      •  
        slice (i) → Vector

        Returns a Vector containing only the entries after i.

        Parameters
        Inti
        Returns
        Vector
      •  
        slice (i, j) → Vector

        Returns a Vector containing only the entries from i to j-1.

        Parameters
        Inti
        Intj
        Returns
        Vector
  •  
    UNDOCUMENTED
    •  
      Div

      Complete result of an integral division, quotient and remainder

    •  
      ExtGCD

      Complete result of calculation of the greatest common divisor of two numbers (a,b): g=gcd(a,b) g==a*p+b*q a==g*k1 b==g*k2

  •  

    This category contains all basic types, in particular those that wrap C++, GMP or perl types such as Int, Integer, Rational, Long, Float, Array, String, ...

    •  
      Array <Element>

      An array with elements of type Element.

      Type Parameters
      Element

      User Methods of Array

      •  
        size () → Int

        Returns the size.

        Returns
        Int
    •  
      ARRAY

      Corresponds to the perl array.

      derived from: Array<SCALAR>
    •  
      Bool

      Corresponds to the C++ type bool.

    •  
      Float

      Corresponds to the C++ type double.

      User Methods of Float

      •  
        inf ()

        produce an infinitely large positive value

      •  
        minus_inf ()

        produce an infinitely large negative value

    •  
      HASH

      Corresponds to the perl hash.

      Contained in extension polyDB.

    •  
      Int

      Corresponds to the C++ type int.

    •  
      Integer

      An integer of arbitrary size.

      User Methods of Integer

      •  
        inf ()

        produce an infinitely large positive value

      •  
        minus_inf ()

        produce an infinitely large negative value

    •  
      Iterator <Element>

      An iterator.

      Type Parameters
      Element
    •  
      List <Element>

      Corresponds to the C++ type std::list.

      Type Parameters
      Element
    •  
      LocalFloatEpsilon
      UNDOCUMENTED
    •  
      Long

      Corresponds to the C++ type long. This type is primarily needed for automatic generated function wrappers, because perl integral constants are always kept as a long.

      derived from: Int
    •  
      Pair <First, Second>

      Corresponds to the C++ type std::Pair.

      Type Parameters
      First
      Second
    •  
      QuadraticExtension <Field>

      Realizes quadratic extensions of fields.

      You can construct the value a+b\(\sqrt r\) via QuadraticExtension(a, b, r) (where a, b, r are of type Field).

      Type Parameters
      Field
      default: Rational
    •  
      Rational

      A class for rational numbers. You can easily create a Rational like that: $x = 1/2;

      User Methods of Rational

      •  
        inf ()

        Produce an infinitely large positive value.

      •  
        minus_inf ()

        Produce an infinitely large negative value.

    •  
      SCALAR

      Corresponds to the perl scalar.

    •  
      Serialized <X>
      UNDOCUMENTED
      Type Parameters
      X
    •  
      String

      Corresponds to the C++ type std::string.

    •  
      Text
      UNDOCUMENTED
    •  
      Tuple
      UNDOCUMENTED
  •  

    This contains all property types that are related to graphs.

    •  
      Directed

      Labels a Graph as directed.

    •  
      DirectedMulti

      Type tag for directed multigraphs.

    •  
      EdgeHashMap <Dir, Element>
      UNDOCUMENTED
      Type Parameters
      Dir
      Element
    •  
      EdgeIterator
      UNDOCUMENTED
    •  
      EdgeList
      UNDOCUMENTED
    •  
      EdgeMap <Dir, Element>
      UNDOCUMENTED
      Type Parameters
      Dir
      Element
    •  
      Graph <Dir>
      UNDOCUMENTED
      Type Parameters
      Dir

      User Methods of Graph

      •  
        add_edge (tail_node, head_node) → Int

        In a multigraph, creates a new edge connecting two given nodes. In a normal graph, creates a new edge only if the nodes were not connected yet. Returns the index of the (new) edge.

        Parameters
        Inttail_node
        Inthead_node
        Returns
        Int
      •  
        add_node () → Int

        Adds a new node without incident edes, returns its index.

        Returns
        Int
      •  
        adjacent_nodes (node) → Set

        Returns the set of indices of nodes adjacent to node.

        Parameters
        Intnode
        Returns
        Set
      •  
        all_edges (tail_node, head_node) → Iterator

        Returns an iterator visiting all (parallel) edges connecting two given nodes.

        Parameters
        Inttail_node
        Inthead_node
        Returns
        Iterator
      •  
        contract_edge (node1, node2)

        Contract the edge(s) between node1 and node2. Reconnects all edges from node2 to node1, deleting the edge(s) between them and, finally, deleting node2.

        Parameters
        Intnode1
        Intnode2
      •  
        degree (node) → Int

        Returns the number of edges incident to node.

        Parameters
        Intnode
        Returns
        Int
      •  
        delete_all_edges (tail_node, head_node)

        Deletes all edges in a multigraph connecting two given nodes.

        Parameters
        Inttail_node
        Inthead_node
      •  
        delete_edge (tail_node, head_node)

        Deletes the edge connecting two given nodes, if there was one. In a multigraph, deletes one arbitrary edge from the parallel bundle.

        Parameters
        Inttail_node
        Inthead_node
      •  
        delete_edge (iterator)

        Delete the edge in a multigraph pointed to by the given iterator

        Parameters
        Iteratoriterator
        as returned by all_edges.
      •  
        delete_node (node)

        Deletes all edges incident to the given node and marks it as invalid. The numeration of other nodes stays unchanged.

        Parameters
        Intnode
      •  
        dim () → Int

        Returns the maximal node index + 1. If the graph does not have gaps caused by node deletion, the result is equivalent to nodes().

        Returns
        Int
      •  
        edge (tail_node, head_node) → Int

        Returns the index of the edge connecting two given nodes. The edge is created if was not there. In a multigraph, an arbitrary edge from the parallel bundle will be picked.

        Parameters
        Inttail_node
        Inthead_node
        Returns
        Int
      •  
        edges () → Int

        Returns the total number of edges.

        Returns
        Int
      •  
        edge_exists (tail_node, head_node) → Bool

        Checks whether two given nodes are connected by (at least) one edge.

        Parameters
        Inttail_node
        Inthead_node
        Returns
        Bool
      •  
        has_gaps () → Bool

        Returns true if some nodes have been deleted since the last squeeze operation.

        Returns
        Bool
      •  
        invalid_node (node) → Bool

        Returns true if the given node index is either out of valid range or points to a formerly deleted node.

        Parameters
        Intnode
        Returns
        Bool
      •  
        in_adjacent_nodes (node) → Set

        Returns the set of indices of the nodes that have an edge heading to node.

        Parameters
        Intnode
        Returns
        Set
      •  
        in_degree (node) → Int

        Returns the number of edges heading to node.

        Parameters
        Intnode
        Returns
        Int
      •  
        in_edges (node) → EdgeList

        Returns a sequence of edges heading to (in Directed case) or incident to (in Undirected case) node.

        Parameters
        Intnode
        Returns
        EdgeList
      •  
        nodes () → Int

        Returns the total number of nodes.

        Returns
        Int
      •  
        node_exists (node) → Bool

        Checks whether the node with given index exists.

        Parameters
        Intnode
        Returns
        Bool
      •  
        node_out_of_range (node) → Bool

        Returns true if the given node index is out of valid range.

        Parameters
        Intnode
        Returns
        Bool
      •  
        out_adjacent_nodes (node) → Set

        Returns the set of indices of the nodes with an edge arriving from node.

        Parameters
        Intnode
        Returns
        Set
      •  
        out_degree (node) → Int

        Returns the number of edges leaving node.

        Parameters
        Intnode
        Returns
        Int
      •  
        out_edges (node) → EdgeList

        Returns a sequence of edges leaving (in Directed case) or incident to (in Undirected case) node.

        Parameters
        Intnode
        Returns
        EdgeList
      •  
        squeeze ()

        Renumbers the valid nodes as to eliminate all gaps left after deleting.

      •  
        squeeze_isolated ()

        Deletes all nodes of degree 0, then renumbers the remaining nodes without gaps.

    •  
      NodeHashMap <Dir, Element>
      UNDOCUMENTED
      Type Parameters
      Dir
      Element
    •  
      NodeIterator
      UNDOCUMENTED
    •  
      NodeMap <Dir, Element>
      UNDOCUMENTED
      Type Parameters
      Dir
      Element
    •  
      NodeSet
      UNDOCUMENTED
    •  
      Undirected

      Labels a Graph as undirected.

    •  
      UndirectedMulti

      Type tag for undirected multigraphs.

  •  
    UNDOCUMENTED
    •  
      SmithNormalForm

      Complete result of the Smith normal form computation. Contains the following fields:

      SparseMatrix<Scalar> form: the Smith normal form S of the given matrix M
      List<Pair<Scalar, Int>> torsion: absolute values of the entries greater than 1 of the diagonal together with their multiplicity
      Int rank: rank of M
      SparseMatrix<Scalar> left_companion, right_companion: unimodular matrices L and R such that

      M = LSR in normal case, or S = LMR in inverted case (as specified in the call to smith_normal_form function).

  •  

    In this category you find all property types related to sets, such as Set, Map, HashMap, IncidenceMatrix, ...

    •  
      FacetList

      A FacetList is a collection of sets of integral numbers from a closed contiguous range [0..n-1]. The contained sets usually encode facets and the set elements vertices of a simplicial complex.

      User Methods of FacetList

      •  
        insertMax (facet) → Bool

        Add a new facet if and only if there are no facets including it. If this holds, remove also all facets that are included in the new one. Return true if the new facet was really included.

        Parameters
        Setfacet
        Returns
        Bool
      •  
        insertMin (facet) → Bool

        The opposite of insertMax: add a new facet if and only if there are no facets included in it, remove all facets including the new facet.

        Parameters
        Setfacet
        Returns
        Bool
      •  
        size () → Int

        The number of facets in the list.

        Returns
        Int
    •  
      HashMap <Key, Value>

      Similar to Map. HashMaps are associative containers that contain unique key/value pairs.

      The values are stored in a hash table. Accessing and interserting a value by its key works in constant time O(1).

      You can create a new HashMap mapping Ints to Strings by

      $myhashmap = new HashMap<Int, String>([1, "Monday"], [2, "Tuesday"]);

      On the perl side HashMaps are treated like hashrefs. You can work with a HashMap like you work with a Map (keeping in mind differences in performance and memory demand).

      Type Parameters
      Key
      type of the key values
      Value
      type of the mapped value
    •  
      HashSet <Element>

      Similar to Set. (But keep in mind differences in performance and memory demand.)

      Type Parameters
      Element
    •  
      IncidenceMatrix <Sym>

      A 0/1 incidence matrix.

      Type Parameters
      Sym
      one of Symmetric or NonSymmetric, default: NonSymmetric

      User Methods of IncidenceMatrix

      •  
        col (i) → SparseVector<Int>

        Returns the i-th column.

        Parameters
        Inti
        Returns
        SparseVector<Int>
      •  
        cols () → Int

        Returns the number of columns.

        Returns
        Int
      •  
        minor (r, c) → IncidenceMatrix

        Returns a minor of the matrix containing the rows in r and the columns in c. You can pass All if you want all rows or columns and ~ for the complement of a set. E.g.

        $A->minor(All, ~[0]);

        will give you the minor of a matrix containing all rows and all but the 0-th column.

        Parameters
        Setr
        the rows
        Setc
        the columns
        Returns
        IncidenceMatrix
      •  
        row (i) → SparseVector<Int>

        Returns the i-th row.

        Parameters
        Inti
        Returns
        SparseVector<Int>
      •  
        rows () → Int

        Returns the number of rows.

        Returns
        Int
      •  
        squeeze ()

        Removes empty rows and columns. The remaining rows and columns are renumbered without gaps.

      •  
        squeeze_cols ()

        Removes empty columns. The remaining columns are renumbered without gaps.

      •  
        squeeze_rows ()

        Removes empty rows. The remaining rows are renumbered without gaps.

    •  
      Map <Key, Value>

      Maps are sorted associative containers that contain unique key/value pairs. Maps are sorted by their keys.

      Accessing or inserting a value needs logarithmic time O(log n), where n is the size of the map.

      You can create a new Map mapping Ints to Strings by

      $mymap = new Map<Int, String>([1, "Monday"], [2, "Tuesday"]);

      On the perl side Maps are treated like hashrefs. You can add a new key/value pair by

      $mymap->{3} = "Wednesday";

      (If the key is already contained in the Map, the corresponding value is replaced by the new one.) or ask for the value of a key by

      print $mymap->{1};
      Type Parameters
      Key
      type of the key values
      Value
      type of the mapped value
    •  
      NonSymmetric

      Labels an IncidenceMatrix as non-symmetric.

    •  
      PowerSet <Element>

      A Set whose elements are of type Set<Element>.

      Type Parameters
      Element
      default: Int
    •  
      Set <Element>

      A type for sets containing elements of type Element.

      You can for example create a new Set by:

      $s = new Set(2, 3, 5, 7);

      You can perform set theoretic operations:

      $s1 + $s2 union
      $s1 * $s2 intersection
      $s1 - $s2 difference
      $s1 ^ $s2 symmetric difference
      Type Parameters
      Element
      default: Int

      User Methods of Set

      •  
        size () → Int

        The cardinality of the set.

        Returns
        Int
    •  
      Symmetric

      Labels an IncidenceMatrix as symmetric.

  •  
    UNDOCUMENTED
    •  
      Flexible

      This is a pseudo-type for documentation purposes only. Many options of visualization functions modifying the appearance of some set of graphical elements like points, edges, facets, etc. accept a wide range of possible values, allowing for different grades of flexibility (and complexity):

      SCALAR the same attribute value is applied to all elements ARRAY each element gets its individual attribute value HASH elements found in the hash get their individual attribute values, for the rest the appropriate default applies SUB a piece of code computing the attribute value for the given element

      Unless specified explicitly in the detailed option description, the indices, keys, or subroutine arguments used for retrieval of the attribute values are just the zero-based ordinal numbers of the elements.

    •  
      HSV

      A color described as a Hue-Saturation-Value triple. Is convertible to and from an RGB representation.

    •  
      RGB

      A color described as a Red-Green-Blue triple. Can be constructed from a list of three integral values from the range 0..255, or a list of three floating-point values from the range 0..1, or one of symbolic names listed in the system-wide file rgb.txt.

Common Option Lists

  •  
    UNDOCUMENTED
    •  
      Visual::PointSet::decorations

      Common attributes modifying the appearance of PointSets and all visual objects derived thereof. Please be aware that no one visualization program interfaced to polymake supports all of them. Unsupported options are normally ignored.

      Options
      String Title
      the name of the drawing
      String Name
      the name of this visual object in the drawing
      Bool Hidden
      if set to true, the visual object is not rendered (useful for interactive visualization programs allowing for switching details on and off) String if set to "hidden", no point labels are displayed
      enum PointLabels
      ("hidden"), String alias for PointLabels
      enum VertexLabels
      ("hidden"),
      Flexible<RGB> PointColor
      color of the spheres or rectangles representing the points
      Flexible<RGB> VertexColor
      alias for PointColor
      Flexible<Float> PointThickness
      scaling factor for the size of the spheres or rectangles representing the points
      Flexible<Float> VertexThickness
      alias for PointThickness
      Flexible<RGB> PointBorderColor
      color of the border line of rectangles representing the points
      Flexible<Float> VertexBorderColor
      alias for PointBorderColor
      Flexible<Float> PointBorderThickness
      scaling factor for the thickness of the border line of rectangles representing the points
      Flexible<Float> VertexBorderThickness
      alias for PointBorderThickness
      Flexible<String> PointStyle
      if set to "hidden", neither point nor its label is rendered
      Flexible<String> VertexStyle
      alias for PointStyle
      Vector<Float> ViewPoint
      ViewPoint for Sketch visualization
      Vector<Float> ViewDirection
      ViewDirection for Sketch visualization
      Vector<Float> ViewUp
      ViewUp for Sketch visualization
      Float Scale
      scale for Sketch visualization
    •  
      Visual::Polygon::decorations

      Attributes modifying the appearance of filled polygons.

      imports from: Visual::PointSet::decorations

      Options
      RGBFacetColor
      filling color of the polygon
      FloatFacetTransparency
      transparency factor of the polygon between 0 (opaque) and 1 (completely translucent)
      StringFacetStyle
      if set to "hidden", the inner area of the polygon is not rendered
      RGBEdgeColor
      color of the boundary lines
      FloatEdgeThickness
      scaling factor for the thickness of the boundary lines
      StringEdgeStyle
      if set to "hidden", the boundary lines are not rendered
    •  
      Visual::Polygons::decorations

      Attributes modifying the appearance of a set of polygons (like a polygonal surface).

      imports from: Visual::PointSet::decorations

      Options
      Flexible<RGB>FacetColor
      filling color of the polygons
      Flexible<Float>FacetTransparency
      transparency factor of the polygons between 0 (opaque) and 1 (completely translucent)
      Flexible<String>FacetStyle
      if set to "hidden", the inner area of the polygons are not rendered at all
      StringFacetLabels
      if set to "hidden", the facet labels are not displayed (in the most cases this is the default behavior)
      RGBEdgeColor
      color of the boundary lines
      FloatEdgeThickness
      scaling factor for the thickness of the boundary lines
      StringEdgeStyle
      if set to "hidden", the boundary lines are not rendered
    •  
      Visual::Wire::decorations

      Attributes modifying the appearance of "wire frameworks". Unlike the rest, the flexible edge attributes are retrieved using the edge iterator as an index/key/argument.

      imports from: Visual::PointSet::decorations

      Options
      Flexible<RGB>EdgeColor
      color of the lines representing the edges
      Flexible<Float>EdgeThickness
      scaling factor for the thickness of the lines representing the edges
      EdgeMap<String>EdgeLabels
      textual labels to be placed along the edges
      Flexible<String>EdgeStyle
      if set to "hidden", neither the edge nor its label is rendered