# The double-import is needed to get the underscore methods.
from mjo.cone.cone import *
-from mjo.cone.cone import _basically_the_same, _rho
+from mjo.cone.cone import _basically_the_same, _restrict_to_space
#
-# Tests for _rho.
+# Tests for _restrict_to_space.
#
"""
-Apply _rho according to our paper (to obtain our main result). Test all
-four parameter combinations::
+Apply _restrict_to_space according to our paper (to obtain our main
+result). Test all four parameter combinations::
sage: set_random_seed()
sage: K = random_cone(max_ambient_dim = 8,
....: strictly_convex=False,
....: solid=False)
- sage: K_S = _rho(K)
- sage: K_SP = _rho(K_S.dual()).dual()
+ sage: K_S = _restrict_to_space(K, K.span())
+ sage: K_SP = _restrict_to_space(K_S.dual(), K_S.dual().span()).dual()
sage: K_SP.is_proper()
True
- sage: K_SP = _rho(K_S, K_S.dual())
+ sage: K_SP = _restrict_to_space(K_S, K_S.dual().span())
sage: K_SP.is_proper()
True
sage: K = random_cone(max_ambient_dim = 8,
....: strictly_convex=True,
....: solid=False)
- sage: K_S = _rho(K)
- sage: K_SP = _rho(K_S.dual()).dual()
+ sage: K_S = _restrict_to_space(K, K.span())
+ sage: K_SP = _restrict_to_space(K_S.dual(), K_S.dual().span()).dual()
sage: K_SP.is_proper()
True
- sage: K_SP = _rho(K_S, K_S.dual())
+ sage: K_SP = _restrict_to_space(K_S, K_S.dual().span())
sage: K_SP.is_proper()
True
sage: K = random_cone(max_ambient_dim = 8,
....: strictly_convex=False,
....: solid=True)
- sage: K_S = _rho(K)
- sage: K_SP = _rho(K_S.dual()).dual()
+ sage: K_S = _restrict_to_space(K, K.span())
+ sage: K_SP = _restrict_to_space(K_S.dual(), K_S.dual().span()).dual()
sage: K_SP.is_proper()
True
- sage: K_SP = _rho(K_S, K_S.dual())
+ sage: K_SP = _restrict_to_space(K_S, K_S.dual().span())
sage: K_SP.is_proper()
True
sage: K = random_cone(max_ambient_dim = 8,
....: strictly_convex=True,
....: solid=True)
- sage: K_S = _rho(K)
- sage: K_SP = _rho(K_S.dual()).dual()
+ sage: K_S = _restrict_to_space(K, K.span())
+ sage: K_SP = _restrict_to_space(K_S.dual(), K_S.dual().span()).dual()
sage: K_SP.is_proper()
True
- sage: K_SP = _rho(K_S, K_S.dual())
+ sage: K_SP = _restrict_to_space(K_S, K_S.dual().span())
sage: K_SP.is_proper()
True
....: solid=False,
....: strictly_convex=False)
sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
- sage: K_W_star = _rho(K, J).dual()
- sage: K_star_W = _rho(K.dual(), J)
+ sage: K_W_star = _restrict_to_space(K, J.span()).dual()
+ sage: K_star_W = _restrict_to_space(K.dual(), J.span())
sage: _basically_the_same(K_W_star, K_star_W)
True
....: solid=True,
....: strictly_convex=False)
sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
- sage: K_W_star = _rho(K, J).dual()
- sage: K_star_W = _rho(K.dual(), J)
+ sage: K_W_star = _restrict_to_space(K, J.span()).dual()
+ sage: K_star_W = _restrict_to_space(K.dual(), J.span())
sage: _basically_the_same(K_W_star, K_star_W)
True
....: solid=False,
....: strictly_convex=True)
sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
- sage: K_W_star = _rho(K, J).dual()
- sage: K_star_W = _rho(K.dual(), J)
+ sage: K_W_star = _restrict_to_space(K, J.span()).dual()
+ sage: K_star_W = _restrict_to_space(K.dual(), J.span())
sage: _basically_the_same(K_W_star, K_star_W)
True
....: solid=True,
....: strictly_convex=True)
sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
- sage: K_W_star = _rho(K, J).dual()
- sage: K_star_W = _rho(K.dual(), J)
+ sage: K_W_star = _restrict_to_space(K, J.span()).dual()
+ sage: K_star_W = _restrict_to_space(K.dual(), J.span())
sage: _basically_the_same(K_W_star, K_star_W)
True