]>
gitweb.michael.orlitzky.com - sage.d.git/blob - mjo/cone/trivial_cone.py
3 def trivial_cone(n
, lattice
=None):
5 The trivial cone with no generators in ``n`` dimensions.
9 - ``n`` -- the dimension of the ambient space.
11 - ``lattice`` -- (default: ``None``) an ambient lattice of rank ``n``
12 to be passed to the :func:`Cone` constructor.
16 The trivial cone with no generators.
18 If a ``lattice`` was specified, then the resulting cone will live in
19 that lattice unless its rank is incompatible with the dimension
20 ``n`` (in which case a ``ValueError`` is raised).
24 sage: from mjo.cone.trivial_cone import trivial_cone
28 We can construct the trivial cone as the nonnegative orthant in a
29 trivial ambient space::
32 0-d cone in 0-d lattice N
34 Or in a nontrivial ambient space::
37 0-d cone in 3-d lattice N
39 If a ``lattice`` is given, the trivial cone will live in that lattice::
41 sage: L = ToricLattice(3, 'M')
42 sage: trivial_cone(3, lattice=L)
43 0-d cone in 3-d lattice M
47 An error is raised if the rank of the lattice disagrees with ``n``::
49 sage: L = ToricLattice(1, 'M')
50 sage: trivial_cone(3, lattice=L)
51 Traceback (most recent call last):
53 ValueError: lattice rank=1 and dimension n=3 are incompatible
57 lattice
= ToricLattice(n
)
59 if lattice
.rank() != n
:
60 raise ValueError('lattice rank=%d and dimension n=%d are incompatible'
64 return Cone([], lattice
)