doc/python/static-persistence.rst
author Aravindakshan Babu <akshan@stanford.edu>
Thu, 08 Jul 2010 23:50:39 -0700
branchdev
changeset 217 64a272a34cb2
parent 181 1ee6edc17cb6
child 229 ed3905be234f
permissions -rw-r--r--
Added extra functionality to Point class( an iterator ) and PersistenceDiagram( dimension property and __len__ func ). persistence-diagram.h: Added a new read-only dimension member and member function to access it. With a new constructor that that takes in an int type to initialize dimension. persistence-diagram.cpp: Added new bp::init constructor. Takes in an integer type to initialize the dimension. Exposed the dimension property. Exposed the size property via a __len__ method. __init__.py: Added an iterator for Point objects. This iterates over the coords and then the data( if present ).

: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.