]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/cone/decomposition.py: add new is_reducible() function
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 12 Nov 2025 00:51:51 +0000 (19:51 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 12 Nov 2025 00:51:51 +0000 (19:51 -0500)
mjo/cone/decomposition.py

index 31a4e3fbb4678fbfaae2f95faae558e8d55093ea..a21b0ec6d2056ddfc7bf7a6182b485f1a2f7b5f9 100644 (file)
@@ -199,3 +199,30 @@ def irreducible_factors(K):
         # equivalent but unequal copy of the input cone.
         return {K}
     return { Cone(K.rays(c)) for c in G.connected_components() }
+
+
+def is_reducible(K):
+    r"""
+    Return whether or not this cone is reducible.
+
+    A pointed convex cone ``K`` is reducible if some other cone
+    appears in its :func:`irreducible_factors`.
+
+    SETUP::
+
+        sage: from mjo.cone.decomposition import is_reducible
+
+    EXAMPLES:
+
+    The nonnegative orthant is always reducible in dimension two or
+    more::
+
+        sage: is_reducible(cones.nonnegative_orthant(1))
+        False
+        sage: is_reducible(cones.nonnegative_orthant(2))
+        True
+        sage: is_reducible(cones.nonnegative_orthant(3))
+        True
+
+    """
+    return len(irreducible_factors(K)) > 1