Пример #1
0
    def is_acyclic(self):
        r"""
        Return whether ``self`` is acyclic.

        A vector configuration is acyclic if the origin is not in the relative
        interior of the cone spanned by the vectors.

        OUTPUT:

        Boolean. Whether ``self`` is acyclic.

        .. SEEALSO::

            :meth:`is_totally_cyclic`.

        EXAMPLES::

            sage: from cn_hyperarr.vector_classes import *
            sage: vc = VectorConfiguration([[1,0,0],[0,1,0],[0,0,1],[1,1,0],[0,1,1],[1,1,1]])
            sage: vc.is_acyclic()
            True
            sage: v = [[1, -1, -1],
            ....:      [1, 1, -1],
            ....:      [1, 1, 1],
            ....:      [1, -1, 1],
            ....:      [-1, -1, 1],
            ....:      [-1, -1, -1],
            ....:      [-1, 1, -1],
            ....:      [-1, 1, 1]]
            sage: vc = VectorConfiguration(v)
            sage: vc.is_acyclic()
            False

        TESTS::

            sage: vc = VectorConfiguration([])
            sage: vc.is_acyclic()
            True

            sage: vc2 = VectorConfiguration([[1,0,0],[-1,0,0]])
            sage: vc2.is_acyclic()
            False

            sage: vc3 = VectorConfiguration([[0,0,0]])
            sage: vc3.is_acyclic()
            Traceback (most recent call last):
            ...
            ValueError: PPL::ray(e):
            e == 0, but the origin cannot be a ray.

            sage: vc = VectorConfiguration([[1,0,0],[0,1,0],[0,0,1],[1,1,0],[0,1,1],[1,1,1],[-1,0,0]])
            sage: vc.is_acyclic()
            False
        """
        acyc_vc = Polyhedron(rays=self, backend=self.backend())
        if acyc_vc.relative_interior_contains(
                vector([0] * acyc_vc.ambient_dim())):
            return False
        elif not acyc_vc.lines() == ():
            return False
        else:
            return True