X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fcone%2Fcone.py;h=b7456e21abc170d6479f9010a2b7ccdd5ab9438d;hb=95bac72b9d6731b0cdaafc89a839972d8544512f;hp=7e9c549eec66ede6dc0c94bd67e0e16d4d999538;hpb=455255081db7cf2fbb9a221029a19d7d17310577;p=sage.d.git diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index 7e9c549..b7456e2 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -1,93 +1,23 @@ from sage.all import * -def is_lyapunov_like(L,K): - r""" - Determine whether or not ``L`` is Lyapunov-like on ``K``. - - We say that ``L`` is Lyapunov-like on ``K`` if `\left\langle - L\left\lparenx\right\rparen,s\right\rangle = 0` for all pairs - `\left\langle x,s \right\rangle` in the complementarity set of - ``K``. It is known [Orlitzky]_ that this property need only be - checked for generators of ``K`` and its dual. - - There are faster ways of checking this property. For example, we - could compute a `lyapunov_like_basis` of the cone, and then test - whether or not the given matrix is contained in the span of that - basis. The value of this function is that it works on symbolic - matrices. - - INPUT: - - - ``L`` -- A linear transformation or matrix. - - - ``K`` -- A polyhedral closed convex cone. - - OUTPUT: - - ``True`` if it can be proven that ``L`` is Lyapunov-like on ``K``, - and ``False`` otherwise. - - .. WARNING:: - - If this function returns ``True``, then ``L`` is Lyapunov-like - on ``K``. However, if ``False`` is returned, that could mean one - of two things. The first is that ``L`` is definitely not - Lyapunov-like on ``K``. The second is more of an "I don't know" - answer, returned (for example) if we cannot prove that an inner - product is zero. - - REFERENCES: - - M. Orlitzky. The Lyapunov rank of an improper cone. - http://www.optimization-online.org/DB_HTML/2015/10/5135.html - - EXAMPLES: - - The identity is always Lyapunov-like in a nontrivial space:: - - sage: set_random_seed() - sage: K = random_cone(min_ambient_dim=1, max_ambient_dim=8) - sage: L = identity_matrix(K.lattice_dim()) - sage: is_lyapunov_like(L,K) - True - - As is the "zero" transformation:: - - sage: K = random_cone(min_ambient_dim=1, max_ambient_dim=8) - sage: R = K.lattice().vector_space().base_ring() - sage: L = zero_matrix(R, K.lattice_dim()) - sage: is_lyapunov_like(L,K) - True - - Everything in ``K.lyapunov_like_basis()`` should be Lyapunov-like - on ``K``:: - - sage: K = random_cone(min_ambient_dim=1, max_ambient_dim=6) - sage: all([ is_lyapunov_like(L,K) for L in K.lyapunov_like_basis() ]) - True - - """ - return all([(L*x).inner_product(s) == 0 - for (x,s) in K.discrete_complementarity_set()]) - def LL_cone(K): gens = K.lyapunov_like_basis() L = ToricLattice(K.lattice_dim()**2) - return Cone([ g.list() for g in gens ], lattice=L, check=False) + return Cone(( g.list() for g in gens ), lattice=L, check=False) def Sigma_cone(K): - gens = K.cross_positive_operator_gens() + gens = K.cross_positive_operators_gens() L = ToricLattice(K.lattice_dim()**2) - return Cone([ g.list() for g in gens ], lattice=L, check=False) + return Cone(( g.list() for g in gens ), lattice=L, check=False) def Z_cone(K): - gens = K.Z_operator_gens() + gens = K.Z_operators_gens() L = ToricLattice(K.lattice_dim()**2) - return Cone([ g.list() for g in gens ], lattice=L, check=False) + return Cone(( g.list() for g in gens ), lattice=L, check=False) def pi_cone(K1, K2=None): if K2 is None: K2 = K1 - gens = K1.positive_operator_gens(K2) + gens = K1.positive_operators_gens(K2) L = ToricLattice(K1.lattice_dim()*K2.lattice_dim()) - return Cone([ g.list() for g in gens ], lattice=L, check=False) + return Cone(( g.list() for g in gens ), lattice=L, check=False)