doc/python/static-persistence.rst
author Aravindakshan Babu <akshan@stanford.edu>
Fri, 02 Jul 2010 04:19:29 -0700
branchdev
changeset 215 e94d521b72bb
parent 181 1ee6edc17cb6
child 229 ed3905be234f
permissions -rw-r--r--
Added code to expose the persistence_diagram class, the bottleneck_distance function and the point class to python. Most of the commonly used methods for each class have been exported. The constructor for point now requires that a data argument be provided along with x and y coord. This needs to be made optional. The constructor for persistence_diagram could possibly be rewritten as well.

:class:`StaticPersistence` class
================================

.. class:: StaticPersistence

    .. method:: __init__(filtration)

        Initializes :class:`StaticPersistence` with the given
        :class:`Filtration`. This operation effectively computes the boundary
        matrix of the complex captured by the filtration with rows and columns
        sorted with respect to the filtration ordering.

    .. method:: pair_simplices()

        Pairs simplices using the [ELZ02]_ algorithm.

    .. method:: __call__(i)

        Given an SPNode in the internal representation, the method returns its
        integer offset from the beginning of the filtration. This is useful to
        lookup the actual name of the simplex in the complex.

    .. method:: make_simplex_map(filtration)

        Creates an auxilliary :class:`PersistenceSimplexMap` used to lookup the actual
        simplices from the persistence indices. For example, the following
        snippet prints out all the unpaired simplices::

            smap = persistence.make_simplex_map(filtration)
            for i in persistence:
                if i.unpaired(): print smap[i]

    .. method:: __iter__()

        Iterator over the nodes (representing individual simplices). See
        :class:`SPNode`.

    .. method:: __len__()

        Returns the number of nodes (i.e. the number of simplices).


.. class:: SPNode

    The class represents nodes stored in :class:`StaticPersistence`. These nodes
    are aware of their :meth:`sign` and :attr:`pair` (and :meth:`cycle` if
    negative after :meth:`StaticPersistence.pair_simplices` has run).

    .. method:: sign()

        Returns the sign of the simplex: `True` for positive, `False` for
        negative.

    .. method:: pair()

        Simplex's pair. The pair is set to self if the siplex is unpaired.

    .. method:: cycle()

        If the simplex is negative, its cycle (that it kills) is non-empty, and
        can be accessed using this method. The cycle itself is an iterable
        container of :class:`SPNode`. For example, one can print the basis for
        the (bounding) cycles::

            smap = persistence.make_simplex_map(filtration)
            for i in persistence:
                for ii in i.cycle(): print smap[ii]

    .. method:: unpaired()

        Indicates whether the simplex is unpaired.

.. class:: PersistenceSimplexMap

    .. method:: __getitem__(i)

        Given a persistence index, i.e. an :class:`SPNode`, returns the
        :class:`Simplex` it represents.