doc/python/static-persistence.rst
author Dmitriy Morozov <dmitriy@mrzv.org>
Tue, 09 Mar 2010 15:22:57 -0800
branchdev
changeset 207 6f1ed27850c8
parent 181 1ee6edc17cb6
child 229 ed3905be234f
permissions -rw-r--r--
Added Persistence::initialize(f) + fixed minor bug LinearKernel::sign_at_negative_infinity()

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