sage: K = random_cone(max_ambient_dim=4)
sage: pi_of_K = positive_operator_gens(K)
sage: L = ToricLattice(K.lattice_dim()**2)
- sage: pi_cone = Cone([ g.list() for g in pi_of_K ], lattice=L)
+ sage: pi_cone = Cone([ g.list() for g in pi_of_K ],
+ ....: lattice=L,
+ ....: check=False)
sage: P = matrix(K.lattice_dim(), pi_cone.random_element(QQ).list())
sage: all([ K.contains(P*x) for x in K ])
True
sage: K = random_cone(max_ambient_dim=4)
sage: pi_of_K = positive_operator_gens(K)
sage: L = ToricLattice(K.lattice_dim()**2)
- sage: pi_cone = Cone([ g.list() for g in pi_of_K ], lattice=L)
+ sage: pi_cone = Cone([ g.list() for g in pi_of_K ],
+ ....: lattice=L,
+ ....: check=False)
sage: P = matrix(K.lattice_dim(), pi_cone.random_element(QQ).list())
sage: K.contains(P*K.random_element(ring=QQ))
True
sage: K = random_cone(max_ambient_dim=4)
sage: pi_of_K = positive_operator_gens(K)
sage: L = ToricLattice(K.lattice_dim()**2)
- sage: pi_cone = Cone([ g.list() for g in pi_of_K ], lattice=L)
+ sage: pi_cone = Cone([ g.list() for g in pi_of_K ],
+ ....: lattice=L,
+ ....: check=False)
sage: actual = pi_cone.dual().linear_subspace()
sage: U1 = [ vector((s.tensor_product(x)).list())
....: for x in K.lines()
sage: l = K.lineality()
sage: pi_of_K = positive_operator_gens(K)
sage: L = ToricLattice(n**2)
- sage: pi_cone = Cone([p.list() for p in pi_of_K], lattice=L)
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
sage: actual = pi_cone.dual().lineality()
sage: expected = l*(m - l) + m*(n - m)
sage: actual == expected
sage: l = K.lineality()
sage: pi_of_K = positive_operator_gens(K)
sage: L = ToricLattice(n**2)
- sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).dim()
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
+ sage: actual = pi_cone.dim()
sage: expected = n**2 - l*(m - l) - (n - m)*m
sage: actual == expected
True
True
sage: L = ToricLattice(n^2)
sage: pi_of_K = positive_operator_gens(K)
- sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).dim()
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
+ sage: actual = pi_cone.dim()
sage: actual == n^2
True
sage: K = K.dual()
sage: K.is_full_space()
True
sage: pi_of_K = positive_operator_gens(K)
- sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).dim()
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
+ sage: actual = pi_cone.dim()
sage: actual == n^2
True
sage: K = Cone([(1,0),(0,1),(0,-1)])
sage: pi_of_K = positive_operator_gens(K)
- sage: actual = Cone([p.list() for p in pi_of_K]).dim()
+ sage: actual = Cone([p.list() for p in pi_of_K], check=False).dim()
sage: actual == 3
True
sage: n = K.lattice_dim()
sage: pi_of_K = positive_operator_gens(K)
sage: L = ToricLattice(n**2)
- sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).lineality()
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
+ sage: actual = pi_cone.lineality()
sage: expected = n**2 - K.dim()*K.dual().dim()
sage: actual == expected
True
True
sage: L = ToricLattice(n^2)
sage: pi_of_K = positive_operator_gens(K)
- sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).lineality()
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
+ sage: actual = pi_cone.lineality()
sage: actual == n^2
True
sage: K = K.dual()
True
sage: K = Cone([(1,0),(0,1),(0,-1)])
sage: pi_of_K = positive_operator_gens(K)
- sage: actual = Cone([p.list() for p in pi_of_K]).lineality()
+ sage: pi_cone = Cone([p.list() for p in pi_of_K], check=False)
+ sage: actual = pi_cone.lineality()
sage: actual == 2
True
sage: K = random_cone(max_ambient_dim=4)
sage: pi_of_K = positive_operator_gens(K)
sage: L = ToricLattice(K.lattice_dim()**2)
- sage: pi_cone = Cone([p.list() for p in pi_of_K], lattice=L)
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
sage: K.is_proper() == pi_cone.is_proper()
True
"""
The lineality space of Z is LL::
sage: set_random_seed()
- sage: K = random_cone(min_ambient_dim=1, max_ambient_dim=4)
- sage: lls = span([ vector(l.list()) for l in K.lyapunov_like_basis() ])
- sage: z_cone = Cone([ z.list() for z in Z_transformation_gens(K) ])
+ sage: K = random_cone(max_ambient_dim=4)
+ sage: L = ToricLattice(K.lattice_dim()**2)
+ sage: z_cone = Cone([ z.list() for z in Z_transformation_gens(K) ],
+ ....: lattice=L,
+ ....: check=False)
+ sage: ll_basis = [ vector(l.list()) for l in K.lyapunov_like_basis() ]
+ sage: lls = L.vector_space().span(ll_basis)
sage: z_cone.linear_subspace() == lls
True
sage: K = random_cone(max_ambient_dim=4)
sage: Z_of_K = Z_transformation_gens(K)
sage: L = ToricLattice(K.lattice_dim()**2)
- sage: z_cone = Cone([ z.list() for z in Z_of_K ], lattice=L)
+ sage: z_cone = Cone([ z.list() for z in Z_of_K ],
+ ....: lattice=L,
+ ....: check=False)
sage: z_cone.lineality() == K.lyapunov_rank()
True
sage: pi_of_K = positive_operator_gens(K)
sage: Z_of_K = Z_transformation_gens(K)
sage: L = ToricLattice(K.lattice_dim()**2)
- sage: pi_star = Cone([p.list() for p in pi_of_K], lattice=L).dual()
- sage: z_star = Cone([ z.list() for z in Z_of_K], lattice=L).dual()
+ sage: pi_cone = Cone([p.list() for p in pi_of_K],
+ ....: lattice=L,
+ ....: check=False)
+ sage: pi_star = pi_cone.dual()
+ sage: z_cone = Cone([ z.list() for z in Z_of_K],
+ ....: lattice=L,
+ ....: check=False)
+ sage: z_star = z_cone.dual()
sage: pi_star.linear_subspace() == z_star.linear_subspace()
True
"""
def Z_cone(K):
gens = Z_transformation_gens(K)
- L = None
- if len(gens) == 0:
- L = ToricLattice(0)
- return Cone([ g.list() for g in gens ], lattice=L)
+ L = ToricLattice(K.lattice_dim()**2)
+ return Cone([ g.list() for g in gens ], lattice=L, check=False)
def pi_cone(K):
gens = positive_operator_gens(K)
- L = None
- if len(gens) == 0:
- L = ToricLattice(0)
- return Cone([ g.list() for g in gens ], lattice=L)
+ L = ToricLattice(K.lattice_dim()**2)
+ return Cone([ g.list() for g in gens ], lattice=L, check=False)