From: Michael Orlitzky Date: Thu, 6 Oct 2016 17:56:27 +0000 (-0400) Subject: Add a few SymmetricCone examples. X-Git-Tag: 0.1.0~202 X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;ds=sidebyside;h=6460b7fcac2c8c28e5cd038a66451076e75ea5e8;p=dunshire.git Add a few SymmetricCone examples. --- diff --git a/src/dunshire/cones.py b/src/dunshire/cones.py index b60811e..18e6a1b 100644 --- a/src/dunshire/cones.py +++ b/src/dunshire/cones.py @@ -12,11 +12,9 @@ class SymmetricCone: There are three types of symmetric cones supported by CVXOPT: - * The nonnegative orthant in the real n-space. - - * The Lorentz "ice cream" cone, or the second-order cone. - - * The cone of symmetric positive-semidefinite matrices. + 1. The nonnegative orthant in the real n-space. + 2. The Lorentz "ice cream" cone, or the second-order cone. + 3. The cone of symmetric positive-semidefinite matrices. This class is intended to encompass them all. """ @@ -28,6 +26,11 @@ class SymmetricCone: product of them), the only information that we need is its dimension. We take that dimension as a parameter, and store it for later. + + INPUT: + + - ``dimension`` -- the dimension of this cone. + """ if dimension <= 0: raise ValueError('cones must have dimension greater than zero') @@ -37,6 +40,15 @@ class SymmetricCone: def __contains__(self, point): """ Return whether or not ``point`` belongs to this cone. + + EXAMPLES: + + >>> K = SymmetricCone(5) + >>> matrix([1,2]) in K + Traceback (most recent call last): + ... + NotImplementedError + """ raise NotImplementedError @@ -44,6 +56,14 @@ class SymmetricCone: """ Return whether or not ``point`` belongs to the interior of this cone. + + EXAMPLES: + + >>> K = SymmetricCone(5) + >>> K.contains_strict(matrix([1,2])) + Traceback (most recent call last): + ... + NotImplementedError """ raise NotImplementedError @@ -56,6 +76,13 @@ class SymmetricCone: should not need to be overridden in subclasses. We prefer to do any special computation in ``__init__()`` and record the result in ``self._dimension``. + + EXAMPLES: + + >>> K = SymmetricCone(5) + >>> K.dimension() + 5 + """ return self._dimension