--- /dev/null
+from sage.all import *
+
+def trivial_cone(n, lattice=None):
+ r"""
+ The trivial cone with no generators in ``n`` dimensions.
+
+ INPUT:
+
+ - ``n`` -- the dimension of the ambient space.
+
+ - ``lattice`` -- (default: ``None``) an ambient lattice of rank ``n``
+ to be passed to the :func:`Cone` constructor.
+
+ OUTPUT:
+
+ The trivial cone with no generators.
+
+ If a ``lattice`` was specified, then the resulting cone will live in
+ that lattice unless its rank is incompatible with the dimension
+ ``n`` (in which case a ``ValueError`` is raised).
+
+ SETUP::
+
+ sage: from mjo.cone.trivial_cone import trivial_cone
+
+ EXAMPLES::
+
+ We can construct the trivial cone as the nonnegative orthant in a
+ trivial ambient space::
+
+ sage: trivial_cone(0)
+ 0-d cone in 0-d lattice N
+
+ Or in a nontrivial ambient space::
+
+ sage: trivial_cone(3)
+ 0-d cone in 3-d lattice N
+
+ If a ``lattice`` is given, the trivial cone will live in that lattice::
+
+ sage: L = ToricLattice(3, 'M')
+ sage: trivial_cone(3, lattice=L)
+ 0-d cone in 3-d lattice M
+
+ TESTS:
+
+ An error is raised if the rank of the lattice disagrees with ``n``::
+
+ sage: L = ToricLattice(1, 'M')
+ sage: trivial_cone(3, lattice=L)
+ Traceback (most recent call last):
+ ...
+ ValueError: lattice rank=1 and dimension n=3 are incompatible
+
+ """
+ if lattice is None:
+ lattice = ToricLattice(n)
+
+ if lattice.rank() != n:
+ raise ValueError('lattice rank=%d and dimension n=%d are incompatible'
+ %
+ (lattice.rank(), n))
+
+ return Cone([], lattice)