From 6460b7fcac2c8c28e5cd038a66451076e75ea5e8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 6 Oct 2016 13:56:27 -0400 Subject: [PATCH] Add a few SymmetricCone examples. --- src/dunshire/cones.py | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) 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 -- 2.44.2