From: Michael Orlitzky Date: Sun, 20 Sep 2015 13:51:57 +0000 (-0400) Subject: Add remaining examples/tests for rearrangement_cone. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=3f378f36cad7abf31e670a005408e637b1f9d760;p=sage.d.git Add remaining examples/tests for rearrangement_cone. --- diff --git a/mjo/cone/rearrangement.py b/mjo/cone/rearrangement.py index 6ea993c..5da9b28 100644 --- a/mjo/cone/rearrangement.py +++ b/mjo/cone/rearrangement.py @@ -6,6 +6,7 @@ from site import addsitedir addsitedir(abspath('../../')) from sage.all import * +from mjo.cone.cone import lyapunov_rank def rearrangement_cone(p,n): r""" @@ -53,12 +54,35 @@ def rearrangement_cone(p,n): sage: rearrangement_cone(5,5).lineality() 4 + All rearrangement cones are proper:: + + sage: all([ rearrangement_cone(p,n).is_proper() + ....: for n in range(10) + ....: for p in range(n) ]) + True + + The Lyapunov rank of the rearrangement cone of order ``p`` in ``n`` + dimensions is ``n`` for ``p == 1`` or ``p == n`` and one otherwise:: + + sage: all([ lyapunov_rank(rearrangement_cone(p,n)) == n + ....: for n in range(2, 10) + ....: for p in [1, n-1] ]) + True + sage: all([ lyapunov_rank(rearrangement_cone(p,n)) == 1 + ....: for n in range(3, 10) + ....: for p in range(2, n-1) ]) + True + TESTS: - todo. - should be permutation invariant. - should have the expected lyapunov rank. - just loop through them all for n <= 10 and p < n? + The rearrangement cone is permutation-invariant:: + + sage: n = ZZ.random_element(2,10).abs() + sage: p = ZZ.random_element(1,n) + sage: K = rearrangement_cone(p,n) + sage: P = SymmetricGroup(n).random_element().matrix() + sage: all([ K.contains(P*r) for r in K.rays() ]) + True """