[cvxopt] 28/64: Imported Upstream version 1.1.3

Andreas Tille tille at debian.org
Wed Jul 20 11:23:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository cvxopt.

commit eb56b143a951608522a451cb1b239de7a647eea5
Author: Andreas Tille <tille at debian.org>
Date:   Wed Jul 20 08:26:58 2016 +0200

    Imported Upstream version 1.1.3
---
 INSTALL                                            |  10 +-
 LICENSE                                            |   5 +-
 doc/source/coneprog.rst                            |  13 +-
 doc/source/copyright.rst                           |   5 +-
 doc/source/index.rst                               |   2 +-
 doc/source/matrices.rst                            |   6 +-
 doc/source/modeling.rst                            |  12 +-
 doc/source/spsolvers.rst                           |  10 +-
 examples/book/chap4/{portfolio => portfolio.py}    |   2 -
 examples/book/chap4/{rls => rls.py}                |   2 -
 .../book/chap6/{basispursuit => basispursuit.py}   |   2 -
 .../book/chap6/{consumerpref => consumerpref.py}   |   2 -
 examples/book/chap6/{cvxfit => cvxfit.py}          |   2 -
 examples/book/chap6/{huber => huber.py}            |   2 -
 .../book/chap6/{inputdesign => inputdesign.py}     |   2 -
 examples/book/chap6/{penalties => penalties.py}    |   2 -
 examples/book/chap6/{polapprox => polapprox.py}    |   2 -
 examples/book/chap6/{regsel => regsel.py}          |   2 -
 examples/book/chap6/{robls => robls.py}            |   2 -
 examples/book/chap6/{smoothrec => smoothrec.py}    |   2 -
 examples/book/chap6/{tv => tv.py}                  |   2 -
 examples/book/chap7/{chernoff => chernoff.py}      |   2 -
 examples/book/chap7/{expdesign => expdesign.py}    |   2 -
 examples/book/chap7/{logreg => logreg.py}          |   2 -
 examples/book/chap7/{maxent => maxent.py}          |   2 -
 examples/book/chap7/{probbounds => probbounds.py}  |   2 -
 examples/book/chap8/{centers => centers.py}        |   2 -
 examples/book/chap8/{ellipsoids => ellipsoids.py}  |   2 -
 examples/book/chap8/{floorplan => floorplan.py}    |   2 -
 examples/book/chap8/{linsep => linsep.py}          |   2 -
 examples/book/chap8/{placement => placement.py}    |   2 -
 examples/doc/chap10/{l1svc => l1svc.py}            |   2 -
 examples/doc/chap10/{lp => lp.py}                  |   2 -
 examples/doc/chap10/{normappr => normappr.py}      |   2 -
 examples/doc/chap10/{roblp => roblp.py}            |   2 -
 examples/doc/chap4/acent.py                        |  74 ++
 examples/doc/chap7/{covsel => covsel.py}           |   2 -
 examples/doc/chap8/{conelp => conelp.py}           |   2 -
 examples/doc/chap8/{coneqp => coneqp.py}           |   2 -
 examples/doc/chap8/{l1 => l1.py}                   |   2 -
 examples/doc/chap8/{l1regls => l1regls.py}         |   2 -
 examples/doc/chap8/{lp => lp.py}                   |   2 -
 examples/doc/chap8/{mcsdp => mcsdp.py}             |   2 -
 examples/doc/chap8/{portfolio => portfolio.py}     |   2 -
 examples/doc/chap8/{qcl1 => qcl1.py}               |   2 -
 examples/doc/chap8/{sdp => sdp.py}                 |   2 -
 examples/doc/chap8/{socp => socp.py}               |   2 -
 examples/doc/chap9/{acent => acent.py}             |   2 -
 examples/doc/chap9/{acent2 => acent2.py}           |   2 -
 examples/doc/chap9/{floorplan => floorplan.py}     |   2 -
 examples/doc/chap9/{gp => gp.py}                   |   2 -
 examples/doc/chap9/{l2ac => l2ac.py}               |   2 -
 examples/doc/chap9/{robls => robls.py}             |   2 -
 src/C/SuiteSparse/README_cvxopt                    |   4 +-
 src/C/amd.c                                        |   3 +-
 src/C/base.c                                       |   3 +-
 src/C/blas.c                                       |   3 +-
 src/C/cholmod.c                                    |   3 +-
 src/C/cvxopt.h                                     |   3 +-
 src/C/dense.c                                      |   5 +-
 src/C/dsdp.c                                       |   3 +-
 src/C/fftw.c                                       |   3 +-
 src/C/glpk.c                                       |   3 +-
 src/C/gsl.c                                        |   3 +-
 src/C/lapack.c                                     |   3 +-
 src/C/misc.h                                       |   3 +-
 src/C/misc_solvers.c                               |  67 +-
 src/C/sparse.c                                     |   5 +-
 src/C/umfpack.c                                    |   3 +-
 src/python/__init__.py                             |   3 +-
 src/python/coneprog.py                             | 403 +++++-----
 src/python/cvxprog.py                              | 192 ++---
 src/python/info.py                                 |   6 +-
 src/python/misc.py                                 |  35 +-
 src/python/modeling.py                             | 281 +++----
 src/python/mosek.py                                | 871 --------------------
 src/python/msk.py                                  | 881 +++++++++++++++++++++
 src/python/printing.py                             |  22 +-
 src/python/solvers.py                              |   3 +-
 src/setup.py                                       |   4 +-
 80 files changed, 1536 insertions(+), 1507 deletions(-)

diff --git a/INSTALL b/INSTALL
index 8b86791..e821da8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
-Installation instructions for CVXOPT Version 1.1.2.
+Installation instructions for CVXOPT Version 1.1.3.
 
 The package requires version 2.5 or newer of Python, and is built from 
 source, so the header files and libraries for Python must be installed, 
@@ -18,7 +18,7 @@ The following software libraries are optional.
 3) GLPK (www.gnu.org/software/glpk/glpk.html) is a linear programming 
 package.  
 
-4) MOSEK version 5 (www.mosek.com) is a commercial library of convex 
+4) MOSEK version 6 (www.mosek.com) is a commercial library of convex 
 optimization solvers.  
 
 5) DSDP5.8 (www-unix.mcs.anl.gov/DSDP) is a semidefinite programming
@@ -77,10 +77,10 @@ case PYTHONPATH must be updated, e.g., under Bash write
 
 Test it:
 --------
-To test that the installation was successful, go to the examples
-directory and try one of the examples, for example,
+To test that the installation was successful, go to the examples directory 
+and try one of the examples, for example,
 
     $ cd examples/doc/chap8
-    $ python lp
+    $ python lp.py
 
 If Python does not issue an error message installation was successful.
diff --git a/LICENSE b/LICENSE
index 461f174..9ba88e1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,7 @@
-CVXOPT version 1.1.2  Copyright (c) 2004-2009 J. Dahl and L. Vandenberghe.
+CVXOPT version 1.1.3. 
+
+Copyright (c) 2010 L. Vandenberghe.
+Copyright (c) 2004-2009 J. Dahl and L. Vandenberghe.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/doc/source/coneprog.rst b/doc/source/coneprog.rst
index 574bf06..b545de6 100644
--- a/doc/source/coneprog.rst
+++ b/doc/source/coneprog.rst
@@ -502,7 +502,7 @@ Quadratic Cone Programs
 
         .. math::
         
-            Gx+s = h, \qquad Ax = b, \qquad Px + G^Tz + A^T y + c = 0,
+            Gx+s = h, \qquad Ax = b, \qquad Px + G^Tz + A^T y + q = 0,
 
             s \succeq 0, \qquad z \succeq 0, \qquad s^T z  = 0.
   
@@ -1495,8 +1495,8 @@ We illustrate these features with three applications.
                     # z[:m] := d1[:m] .* ( P*x[:n] - x[n:] - bz[:m])
                     # z[m:] := d2[m:] .* (-P*x[:n] - x[n:] - bz[m:]) 
 
-                    z[:m] = mul(d[:m],  u - x[n:] - z[:m])
-                    z[m:] = mul(d[m:], -u - x[n:] - z[m:])
+                    z[:m] = mul(di[:m],  u - x[n:] - z[:m])
+                    z[m:] = mul(di[m:], -u - x[n:] - z[m:])
 
                 return f
 
@@ -2120,14 +2120,13 @@ The MOSEK interior-point algorithm parameters are set to their default
 values.  They can be modified by adding an entry 
 :attr:`solvers.options['MOSEK']`.  This entry is a dictionary with 
 MOSEK parameter/value pairs, with the parameter names imported from
-:mod:`pymosek`.  For details see Section 14.1.3 of the 
-`MOSEK Python API Manual <http://www.mosek.com/fileadmin/products/5_0/tools/doc/html/pyapi/index.html>`_.
+:mod:`mosek`.  For details see Section 15 of the MOSEK Python API Manual.
 
 For example the commands
 
 >>> from cvxopt import solvers 
->>> import pymosek
->>> solvers.options['MOSEK'] = {pymosek.iparam.log: 0}
+>>> import mosek
+>>> solvers.options['MOSEK'] = {mosek.iparam.log: 0}
 
 turn off the screen output during calls of 
 :func:`lp` or :func:`socp` with
diff --git a/doc/source/copyright.rst b/doc/source/copyright.rst
index 770d9d2..d503e02 100644
--- a/doc/source/copyright.rst
+++ b/doc/source/copyright.rst
@@ -5,8 +5,9 @@
 Copyright and License
 *********************
 
-:raw-html:`©` 2004-2009 J. Dahl and L. Vandenberghe. 
-
+|
+| :raw-html:`©` 2010 L. Vandenberghe. 
+| :raw-html:`©` 2004-2009 J. Dahl and L. Vandenberghe. 
 
 CVXOPT is free software; you can redistribute it and/or modify it under 
 the terms of the 
diff --git a/doc/source/index.rst b/doc/source/index.rst
index fa84d05..4e7b8ca 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -2,7 +2,7 @@
 CVXOPT 
 ######
 
-**Release 1.1.2 -- December 15, 2009**
+**Release 1.1.3 -- September 15, 2010**
 
 **Joachim Dahl & Lieven Vandenberghe**
 
diff --git a/doc/source/matrices.rst b/doc/source/matrices.rst
index 08e10bf..696c431 100644
--- a/doc/source/matrices.rst
+++ b/doc/source/matrices.rst
@@ -729,10 +729,10 @@ In addition, sparse matrices have the following attributes.
     attribute is an efficient way of changing the values of the sparse 
     matrix, without changing the sparsity pattern.
     
-    When the attribute :attr:`V <>` is read, a *copy* of :attr:`V <>` is 
+    When the attribute :attr:`V` is read, a *copy* of :attr:`V` is 
     returned, as a new dense matrix.  This implies, for example, that an 
     indexed assignment ``A.V[I] = B`` does not work, or at least 
-    cannot be used to modify ``A``.  Instead the attribute :attr:`V <>` 
+    cannot be used to modify ``A``.  Instead the attribute :attr:`V` 
     will be read and returned as a new matrix; then the elements of this 
     new matrix are modified.
 
@@ -881,7 +881,7 @@ tuple containing the i-th elements (or nonzero elements) of
 ``A``, ``B``, ....   
 
 >>> from cvxopt import matrix
->>> A = matrix([[-11., -5., -20.], [-6., -0., 7.]])
+>>> A = matrix([[-11., -5., -20.], [-6., 0., 7.]])
 >>> B = matrix(range(6), (3,2))
 >>> list(A)
 [-11.0, -5.0, -20.0, -6.0, 0.0, 7.0]
diff --git a/doc/source/modeling.rst b/doc/source/modeling.rst
index 0c1bdd1..c3f27cb 100644
--- a/doc/source/modeling.rst
+++ b/doc/source/modeling.rst
@@ -37,7 +37,7 @@ Optimization variables are represented by :class:`variable` objects.
     :func:`repr`  or :func:`str`, or when writing linear programs to MPS 
     files.
 
-The function :func:`len <>` returns the length of a :class:`variable`.  
+The function :func:`!len` returns the length of a :class:`variable`.  
 A :class:`variable` ``x`` has two attributes.
 
 .. attribute:: name 
@@ -268,7 +268,7 @@ convex piecewise-linear functions.  The general expression for a
     f(x_1,\ldots,x_n) = b + A_1 x_1 + \cdots + A_n x_n + 
         \sum_{k=1}^K \min (y_1, y_2, \ldots, y_{m_k}).
 
-Here the arguments of the :func:`min <>` 
+Here the arguments of the :func:`!min` 
 can be constants, variables, affine 
 functions or concave piecewise-linear functions.
 
@@ -277,11 +277,11 @@ operations.
 
 **Maximum**  
     If the arguments in ``f = max(y1, y2, ...)`` do not include any 
-    variables or functions, then the Python built-in :func:`max <>` is 
+    variables or functions, then the Python built-in :func:`!max` is 
     evaluated.  
 
     If one or more of the arguments are variables or functions, 
-    :func:`max <>` 
+    :func:`!max` 
     returns a piecewise-linear function defined as the elementwise maximum 
     of its arguments.  In other words, 
     ``f[k] = max(y1[k], y2[k], ...)`` for ``k`` = 0, ...,  
@@ -298,7 +298,7 @@ operations.
     ``f = max(u[0], u[1], ..., u[len(u)-1])``.  
 
 **Minimum** 
-    Similar to :func:`max <>` but returns a concave piecewise-linear 
+    Similar to :func:`!max` but returns a concave piecewise-linear 
     function.
     The arguments can be scalars of type integer or float, dense 
     :const:`'d'` matrices with one column, variables, affine functions or 
@@ -408,7 +408,7 @@ for a variable of length 5.
 >>> c3 = (sum(x) == 2)
 
 
-The built-in function :func:`len <>` returns the dimension of the 
+The built-in function :func:`!len` returns the dimension of the 
 constraint function.
 
 Constraints have four public attributes.
diff --git a/doc/source/spsolvers.rst b/doc/source/spsolvers.rst
index 01bc06d..20971e5 100644
--- a/doc/source/spsolvers.rst
+++ b/doc/source/spsolvers.rst
@@ -588,11 +588,11 @@ where :math:`\circ` denotes Hadamard product.
         D = [k for k in xrange(m) if I[k]==J[k]]  # position of diagonal elements
 
         # starting point: symmetric identity with nonzero pattern I,J
-        K = spmatrix(0, I, J) 
-        K[::n+1] = 1
+        K = spmatrix(0.0, I, J) 
+        K[::n+1] = 1.0
 
         # Kn is used in the line search
-        Kn = spmatrix(0, I, J)
+        Kn = spmatrix(0.0, I, J)
 
         # symbolic factorization of K 
         F = cholmod.symbolic(K)
@@ -607,8 +607,8 @@ where :math:`\circ` denotes Hadamard product.
             d = cholmod.diag(F)
 
             # compute Kinv by solving K*X = I 
-            Kinv[:] = 0
-            Kinv[::n+1] = 1
+            Kinv[:] = 0.0
+            Kinv[::n+1] = 1.0
             cholmod.solve(F, Kinv)
 
             # solve Newton system
diff --git a/examples/book/chap4/portfolio b/examples/book/chap4/portfolio.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/book/chap4/portfolio
rename to examples/book/chap4/portfolio.py
index 059dc4a..9f53cf5
--- a/examples/book/chap4/portfolio
+++ b/examples/book/chap4/portfolio.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
- 
 # Figure 4.12, page 187.
 # Risk-return trade-off.
 
diff --git a/examples/book/chap4/rls b/examples/book/chap4/rls.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap4/rls
rename to examples/book/chap4/rls.py
index 0130b80..c47f4b4
--- a/examples/book/chap4/rls
+++ b/examples/book/chap4/rls.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
- 
 # Figure 4.11, page 185.
 # Regularized least-squares.
 
diff --git a/examples/book/chap6/basispursuit b/examples/book/chap6/basispursuit.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/basispursuit
rename to examples/book/chap6/basispursuit.py
index dd1ca1e..bccb0d8
--- a/examples/book/chap6/basispursuit
+++ b/examples/book/chap6/basispursuit.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 6.21-23, pages 335-337.
 # Basis pursuit.
 
diff --git a/examples/book/chap6/consumerpref b/examples/book/chap6/consumerpref.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/consumerpref
rename to examples/book/chap6/consumerpref.py
index 9b4d763..72ddd62
--- a/examples/book/chap6/consumerpref
+++ b/examples/book/chap6/consumerpref.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 6.25 and 6.26, page 342.
 # Consumer preference analysis.
 
diff --git a/examples/book/chap6/cvxfit b/examples/book/chap6/cvxfit.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/book/chap6/cvxfit
rename to examples/book/chap6/cvxfit.py
index 8dfa2d0..441e8d5
--- a/examples/book/chap6/cvxfit
+++ b/examples/book/chap6/cvxfit.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figure 6.24, page 339.
 # Least-squares fit of a convex function.
 
diff --git a/examples/book/chap6/huber b/examples/book/chap6/huber.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/book/chap6/huber
rename to examples/book/chap6/huber.py
index 26a3c62..0a80c69
--- a/examples/book/chap6/huber
+++ b/examples/book/chap6/huber.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figure 6.5, page 300.
 # Robust regression.
 
diff --git a/examples/book/chap6/inputdesign b/examples/book/chap6/inputdesign.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/book/chap6/inputdesign
rename to examples/book/chap6/inputdesign.py
index 2188a9c..ebf5150
--- a/examples/book/chap6/inputdesign
+++ b/examples/book/chap6/inputdesign.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figure 6.6, page 309.
 # Input design.
 
diff --git a/examples/book/chap6/penalties b/examples/book/chap6/penalties.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/penalties
rename to examples/book/chap6/penalties.py
index d7bb1fd..964cb49
--- a/examples/book/chap6/penalties
+++ b/examples/book/chap6/penalties.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figure 6.2, page 297.
 # Penalty approximation.
 #
diff --git a/examples/book/chap6/polapprox b/examples/book/chap6/polapprox.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/polapprox
rename to examples/book/chap6/polapprox.py
index cfefba5..601d338
--- a/examples/book/chap6/polapprox
+++ b/examples/book/chap6/polapprox.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 6.19 and 6.20, page 332.
 # Polynomial and spline fitting.
 
diff --git a/examples/book/chap6/regsel b/examples/book/chap6/regsel.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/regsel
rename to examples/book/chap6/regsel.py
index 6128e30..6af9b94
--- a/examples/book/chap6/regsel
+++ b/examples/book/chap6/regsel.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figure 6.7, page 311.
 # Sparse regressor selection.
 #
diff --git a/examples/book/chap6/robls b/examples/book/chap6/robls.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/robls
rename to examples/book/chap6/robls.py
index e4a44da..c62d8fa
--- a/examples/book/chap6/robls
+++ b/examples/book/chap6/robls.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 6.15 and 6.16, pages 320 and 325.
 # Stochastic and worst-case robust approximation.
 
diff --git a/examples/book/chap6/smoothrec b/examples/book/chap6/smoothrec.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/smoothrec
rename to examples/book/chap6/smoothrec.py
index 96b8775..0f51fc1
--- a/examples/book/chap6/smoothrec
+++ b/examples/book/chap6/smoothrec.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 6.8-10, pages 313-314
 # Quadratic smoothing.
 
diff --git a/examples/book/chap6/tv b/examples/book/chap6/tv.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap6/tv
rename to examples/book/chap6/tv.py
index 54bcb7d..5f25fc8
--- a/examples/book/chap6/tv
+++ b/examples/book/chap6/tv.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 6.11-14, pages 315-317.
 # Total variation reconstruction.
 
diff --git a/examples/book/chap7/chernoff b/examples/book/chap7/chernoff.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap7/chernoff
rename to examples/book/chap7/chernoff.py
index fccefbb..8223449
--- a/examples/book/chap7/chernoff
+++ b/examples/book/chap7/chernoff.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figure 7.8, page 384.
 # Chernoff lower bound.
 
diff --git a/examples/book/chap7/expdesign b/examples/book/chap7/expdesign.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap7/expdesign
rename to examples/book/chap7/expdesign.py
index 94d9963..fc7eeb9
--- a/examples/book/chap7/expdesign
+++ b/examples/book/chap7/expdesign.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 7.9-12, pages 389-390.
 # Experiment design.
 
diff --git a/examples/book/chap7/logreg b/examples/book/chap7/logreg.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/book/chap7/logreg
rename to examples/book/chap7/logreg.py
index 5a1f6c3..5af42f0
--- a/examples/book/chap7/logreg
+++ b/examples/book/chap7/logreg.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 7.1, page 355.
 # Logistic regression.
 
diff --git a/examples/book/chap7/maxent b/examples/book/chap7/maxent.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap7/maxent
rename to examples/book/chap7/maxent.py
index b30be03..a5cfa73
--- a/examples/book/chap7/maxent
+++ b/examples/book/chap7/maxent.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 7.2 and 7.3, pages 363 and 364.
 # Maximum entropy distribution.
 
diff --git a/examples/book/chap7/probbounds b/examples/book/chap7/probbounds.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap7/probbounds
rename to examples/book/chap7/probbounds.py
index 8172cfe..00c3fa3
--- a/examples/book/chap7/probbounds
+++ b/examples/book/chap7/probbounds.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 7.6 and 7.7, page 383.
 # Chebyshev bounds.
 
diff --git a/examples/book/chap8/centers b/examples/book/chap8/centers.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap8/centers
rename to examples/book/chap8/centers.py
index 137bd7e..3008c11
--- a/examples/book/chap8/centers
+++ b/examples/book/chap8/centers.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 8.5-7, pages 417-421.
 # Centers of polyhedra.
  
diff --git a/examples/book/chap8/ellipsoids b/examples/book/chap8/ellipsoids.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap8/ellipsoids
rename to examples/book/chap8/ellipsoids.py
index 5debf74..96e5bc2
--- a/examples/book/chap8/ellipsoids
+++ b/examples/book/chap8/ellipsoids.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 8.3 and 8.4, pages 412 and 416.
 # Ellipsoidal approximations.
  
diff --git a/examples/book/chap8/floorplan b/examples/book/chap8/floorplan.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap8/floorplan
rename to examples/book/chap8/floorplan.py
index 0f8a35f..3043173
--- a/examples/book/chap8/floorplan
+++ b/examples/book/chap8/floorplan.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-#
 # Figure 8.20, page 444.
 # Floor planning example.
 
diff --git a/examples/book/chap8/linsep b/examples/book/chap8/linsep.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap8/linsep
rename to examples/book/chap8/linsep.py
index 714c612..f5c0c15
--- a/examples/book/chap8/linsep
+++ b/examples/book/chap8/linsep.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 8.10-12, page 426-429.
 # Approximate linear discrimination.
 
diff --git a/examples/book/chap8/placement b/examples/book/chap8/placement.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/book/chap8/placement
rename to examples/book/chap8/placement.py
index b5616c9..04241fb
--- a/examples/book/chap8/placement
+++ b/examples/book/chap8/placement.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # Figures 8.15-17, pages 435 and 436.
 # Linear, quadratic and fourth-order placement.
 #
diff --git a/examples/doc/chap10/l1svc b/examples/doc/chap10/l1svc.py
old mode 100755
new mode 100644
similarity index 96%
rename from examples/doc/chap10/l1svc
rename to examples/doc/chap10/l1svc.py
index 8e32c23..df0fcd2
--- a/examples/doc/chap10/l1svc
+++ b/examples/doc/chap10/l1svc.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The 1-norm support vector classifier of section 10.5 (Examples).
 
 from cvxopt import normal, setseed
diff --git a/examples/doc/chap10/lp b/examples/doc/chap10/lp.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/doc/chap10/lp
rename to examples/doc/chap10/lp.py
index 4285a33..8226346
--- a/examples/doc/chap10/lp
+++ b/examples/doc/chap10/lp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The small LP of section 10.4 (Optimization problems).  
 
 from cvxopt import matrix
diff --git a/examples/doc/chap10/normappr b/examples/doc/chap10/normappr.py
old mode 100755
new mode 100644
similarity index 97%
rename from examples/doc/chap10/normappr
rename to examples/doc/chap10/normappr.py
index 935e944..45aad05
--- a/examples/doc/chap10/normappr
+++ b/examples/doc/chap10/normappr.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The norm and penalty approximation problems of section 10.5 (Examples).
 
 from cvxopt import normal, setseed
diff --git a/examples/doc/chap10/roblp b/examples/doc/chap10/roblp.py
old mode 100755
new mode 100644
similarity index 96%
rename from examples/doc/chap10/roblp
rename to examples/doc/chap10/roblp.py
index 99cda5f..8ba724a
--- a/examples/doc/chap10/roblp
+++ b/examples/doc/chap10/roblp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The robust LP example of section 10.5 (Examples).
 
 from cvxopt import normal, uniform  
diff --git a/examples/doc/chap4/acent.py b/examples/doc/chap4/acent.py
new file mode 100644
index 0000000..81c09da
--- /dev/null
+++ b/examples/doc/chap4/acent.py
@@ -0,0 +1,74 @@
+# The analytic centering example at the end of chapter 4 (The LAPACK 
+# interface).
+
+from cvxopt import matrix, log, mul, div, blas, lapack, base
+from math import sqrt
+
+def acent(A,b):
+    """  
+    Computes analytic center of A*x <= b with A m by n of rank n. 
+    We assume that b > 0 and the feasible set is bounded.
+    """
+
+    MAXITERS = 100
+    ALPHA = 0.01
+    BETA = 0.5
+    TOL = 1e-8
+
+    ntdecrs = []
+    m, n = A.size
+    x = matrix(0.0, (n,1))
+    H = matrix(0.0, (n,n))
+
+    for iter in xrange(MAXITERS):
+        
+        # Gradient is g = A^T * (1./(b-A*x)).
+        d = (b-A*x)**-1
+        g = A.T * d
+
+        # Hessian is H = A^T * diag(1./(b-A*x))^2 * A.
+        Asc = mul( d[:,n*[0]], A)
+        blas.syrk(Asc, H, trans='T')
+
+        # Newton step is v = H^-1 * g.
+        v = -g
+        lapack.posv(H, v)
+
+        # Directional derivative and Newton decrement.
+	lam = blas.dot(g, v)
+        ntdecrs += [ sqrt(-lam) ]
+        print "%2d.  Newton decr. = %3.3e" %(iter,ntdecrs[-1])
+        if ntdecrs[-1] < TOL: return x, ntdecrs
+
+        # Backtracking line search.
+        y = mul(A*v, d)
+	step = 1.0
+        while 1-step*max(y) < 0: step *= BETA 
+	while True:
+            if -sum(log(1-step*y)) < ALPHA*step*lam: break
+	    step *= BETA
+        x += step*v
+
+
+# Generate an analytic centering problem  
+#
+#    -b1 <=  Ar*x <= b2 
+#
+# with random mxn Ar and random b1, b2.
+
+m, n  = 500, 500
+Ar = base.normal(m,n);
+A = matrix([Ar, -Ar])
+b = base.uniform(2*m,1)
+
+x, ntdecrs = acent(A, b)  
+try: 
+    import pylab
+except ImportError: 
+    pass
+else:
+    pylab.semilogy(range(len(ntdecrs)), ntdecrs, 'o', 
+             range(len(ntdecrs)), ntdecrs, '-')
+    pylab.xlabel('Iteration number')
+    pylab.ylabel('Newton decrement')
+    pylab.show()
diff --git a/examples/doc/chap7/covsel b/examples/doc/chap7/covsel.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/doc/chap7/covsel
rename to examples/doc/chap7/covsel.py
index 5b061c0..eb0b47c
--- a/examples/doc/chap7/covsel
+++ b/examples/doc/chap7/covsel.py
@@ -1,5 +1,3 @@
-#! /usr/bin/python
-
 # The covariance selection example at the end of chapter 7 (Sparse linear
 # equations).
 
diff --git a/examples/doc/chap8/conelp b/examples/doc/chap8/conelp.py
old mode 100755
new mode 100644
similarity index 97%
rename from examples/doc/chap8/conelp
rename to examples/doc/chap8/conelp.py
index 9a374ec..8c26078
--- a/examples/doc/chap8/conelp
+++ b/examples/doc/chap8/conelp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-# 
 # The small linear cone program of section 8.1 (Linear cone programs).
 
 from cvxopt import matrix, solvers
diff --git a/examples/doc/chap8/coneqp b/examples/doc/chap8/coneqp.py
old mode 100755
new mode 100644
similarity index 96%
rename from examples/doc/chap8/coneqp
rename to examples/doc/chap8/coneqp.py
index 8f267c0..6e4a234
--- a/examples/doc/chap8/coneqp
+++ b/examples/doc/chap8/coneqp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-# 
 # The quadratic cone program of section 8.2 (Quadratic cone programs).
   
 # minimize   (1/2)*x'*A'*A*x - b'*A*x
diff --git a/examples/doc/chap8/l1 b/examples/doc/chap8/l1.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/doc/chap8/l1
rename to examples/doc/chap8/l1.py
index 4b3116c..62adb8e
--- a/examples/doc/chap8/l1
+++ b/examples/doc/chap8/l1.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The 1-norm approximation example of section 8.7 (Exploiting structure).  
 
 from cvxopt import blas, lapack, solvers
diff --git a/examples/doc/chap8/l1regls b/examples/doc/chap8/l1regls.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/doc/chap8/l1regls
rename to examples/doc/chap8/l1regls.py
index 9b5b3ba..9b453e5
--- a/examples/doc/chap8/l1regls
+++ b/examples/doc/chap8/l1regls.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The 1-norm regularized least-squares example of section 8.7 (Exploiting
 # structure).
 
diff --git a/examples/doc/chap8/lp b/examples/doc/chap8/lp.py
old mode 100755
new mode 100644
similarity index 93%
rename from examples/doc/chap8/lp
rename to examples/doc/chap8/lp.py
index d0fdb52..5a0e0a4
--- a/examples/doc/chap8/lp
+++ b/examples/doc/chap8/lp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The small LP of section 8.3 (Linear programming). 
 
 from cvxopt import matrix, solvers  
diff --git a/examples/doc/chap8/mcsdp b/examples/doc/chap8/mcsdp.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/doc/chap8/mcsdp
rename to examples/doc/chap8/mcsdp.py
index 666ae5e..6612ccc
--- a/examples/doc/chap8/mcsdp
+++ b/examples/doc/chap8/mcsdp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The SDP example of section 8.7 (Exploiting structure).
 
 from cvxopt import blas, lapack, solvers, matrix, normal
diff --git a/examples/doc/chap8/portfolio b/examples/doc/chap8/portfolio.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/doc/chap8/portfolio
rename to examples/doc/chap8/portfolio.py
index 79831fd..a65d74f
--- a/examples/doc/chap8/portfolio
+++ b/examples/doc/chap8/portfolio.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
- 
 # The risk-return trade-off of section 8.4 (Quadratic programming).
 
 from math import sqrt
diff --git a/examples/doc/chap8/qcl1 b/examples/doc/chap8/qcl1.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/doc/chap8/qcl1
rename to examples/doc/chap8/qcl1.py
index 82887a4..a26b75a
--- a/examples/doc/chap8/qcl1
+++ b/examples/doc/chap8/qcl1.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The quadratically constrained 1-norm minimization example of section 8.7
 # (Exploiting structure).
 
diff --git a/examples/doc/chap8/sdp b/examples/doc/chap8/sdp.py
old mode 100755
new mode 100644
similarity index 97%
rename from examples/doc/chap8/sdp
rename to examples/doc/chap8/sdp.py
index 9c99605..471370f
--- a/examples/doc/chap8/sdp
+++ b/examples/doc/chap8/sdp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The small SDP of section 8.6 (Semidefinite programming).  
 
 from cvxopt import matrix, solvers  
diff --git a/examples/doc/chap8/socp b/examples/doc/chap8/socp.py
old mode 100755
new mode 100644
similarity index 96%
rename from examples/doc/chap8/socp
rename to examples/doc/chap8/socp.py
index f3ba272..99772e9
--- a/examples/doc/chap8/socp
+++ b/examples/doc/chap8/socp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The small SOCP of section 8.5 (Second-order cone programming).  
 
 from cvxopt import matrix, solvers 
diff --git a/examples/doc/chap9/acent b/examples/doc/chap9/acent.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/doc/chap9/acent
rename to examples/doc/chap9/acent.py
index 4d391ed..d99f5a6
--- a/examples/doc/chap9/acent
+++ b/examples/doc/chap9/acent.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The equality constrained analytical centering example of section 9.1 
 # (Problems with nonlinear objectives).
 
diff --git a/examples/doc/chap9/acent2 b/examples/doc/chap9/acent2.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/doc/chap9/acent2
rename to examples/doc/chap9/acent2.py
index c713759..a071160
--- a/examples/doc/chap9/acent2
+++ b/examples/doc/chap9/acent2.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The analytic centering with cone constraints example of section 9.1 
 # (Problems with nonlinear objectives).
 
diff --git a/examples/doc/chap9/floorplan b/examples/doc/chap9/floorplan.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/doc/chap9/floorplan
rename to examples/doc/chap9/floorplan.py
index 2a40a84..3ffd804
--- a/examples/doc/chap9/floorplan
+++ b/examples/doc/chap9/floorplan.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The floor planning example section 9.2 (Problems with linear objectives). 
 
 import pylab  
diff --git a/examples/doc/chap9/gp b/examples/doc/chap9/gp.py
old mode 100755
new mode 100644
similarity index 96%
rename from examples/doc/chap9/gp
rename to examples/doc/chap9/gp.py
index 67fb95a..bce0479
--- a/examples/doc/chap9/gp
+++ b/examples/doc/chap9/gp.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The small GP of section 9.3 (Geometric programming).
 
 from cvxopt import matrix, log, exp, solvers  
diff --git a/examples/doc/chap9/l2ac b/examples/doc/chap9/l2ac.py
old mode 100755
new mode 100644
similarity index 99%
rename from examples/doc/chap9/l2ac
rename to examples/doc/chap9/l2ac.py
index 80ca4b5..1efe906
--- a/examples/doc/chap9/l2ac
+++ b/examples/doc/chap9/l2ac.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The example of section 9.4 (Exploiting structure).. 
 
 from cvxopt import matrix, spdiag, mul, div, log, setseed, uniform, normal 
diff --git a/examples/doc/chap9/robls b/examples/doc/chap9/robls.py
old mode 100755
new mode 100644
similarity index 98%
rename from examples/doc/chap9/robls
rename to examples/doc/chap9/robls.py
index 5d502d2..6957362
--- a/examples/doc/chap9/robls
+++ b/examples/doc/chap9/robls.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
 # The robust least-squares example of section 9.1 (Problems with nonlinear
 # objectives). 
 
diff --git a/src/C/SuiteSparse/README_cvxopt b/src/C/SuiteSparse/README_cvxopt
index 315131e..ceda730 100644
--- a/src/C/SuiteSparse/README_cvxopt
+++ b/src/C/SuiteSparse/README_cvxopt
@@ -1,5 +1,5 @@
-This is the May 20, 2009 (version 3.4.0) distribution of the 
-SuiteSparse package from www.cise.ufl.edu/research/sparse/SuiteSparse/, 
+This is version 3.5.0 of the SuiteSparse package 
+from www.cise.ufl.edu/research/sparse/SuiteSparse/, 
 with the following files and directories removed.
 
 AMD/Demo
diff --git a/src/C/amd.c b/src/C/amd.c
index 1d682c1..6092329 100644
--- a/src/C/amd.c
+++ b/src/C/amd.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/base.c b/src/C/base.c
index 71e1ea2..2f531e3 100644
--- a/src/C/base.c
+++ b/src/C/base.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/blas.c b/src/C/blas.c
index 124ee01..ad2c929 100644
--- a/src/C/blas.c
+++ b/src/C/blas.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/cholmod.c b/src/C/cholmod.c
index 605943a..1655593 100644
--- a/src/C/cholmod.c
+++ b/src/C/cholmod.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/cvxopt.h b/src/C/cvxopt.h
index 9c38d06..22c60af 100644
--- a/src/C/cvxopt.h
+++ b/src/C/cvxopt.h
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/dense.c b/src/C/dense.c
index add49a0..d443472 100644
--- a/src/C/dense.c
+++ b/src/C/dense.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -844,6 +845,8 @@ matrix_ass_subscr(matrix* self, PyObject* args, PyObject* val)
         }
       }
 
+    if (decref_val) { Py_DECREF(val); }
+ 
     return 0;
   }
 
diff --git a/src/C/dsdp.c b/src/C/dsdp.c
index 6201b00..b6a0be9 100644
--- a/src/C/dsdp.c
+++ b/src/C/dsdp.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/fftw.c b/src/C/fftw.c
index b966651..15c6640 100644
--- a/src/C/fftw.c
+++ b/src/C/fftw.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/glpk.c b/src/C/glpk.c
index 8243f23..4b8a76b 100644
--- a/src/C/glpk.c
+++ b/src/C/glpk.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/gsl.c b/src/C/gsl.c
index 68e1ebc..86fc392 100644
--- a/src/C/gsl.c
+++ b/src/C/gsl.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/lapack.c b/src/C/lapack.c
index 2333537..466d3bf 100644
--- a/src/C/lapack.c
+++ b/src/C/lapack.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/misc.h b/src/C/misc.h
index de57b33..6df7a9f 100644
--- a/src/C/misc.h
+++ b/src/C/misc.h
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/C/misc_solvers.c b/src/C/misc_solvers.c
index 05a09d0..1f5df02 100644
--- a/src/C/misc_solvers.c
+++ b/src/C/misc_solvers.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -85,7 +86,8 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
     matrix *x, *d, *vk, *rk;
     PyObject *W, *v, *beta, *r, *betak;
     char trans = 'N', inverse = 'N';
-    int m, n, ind = 0, int0 = 0, int1 = 1, i, k, inc, len, ld, maxn, N;
+    int m, n, xr, xc, ind = 0, int0 = 0, int1 = 1, i, k, inc, len, ld, 
+        maxn, N;
     double b, dbl0 = 0.0, dbl1 = 1.0, dblm1 = -1.0, dbl2 = 2.0, dbl5 = 0.5,
         *wrk;
     char *kwlist[] = {"x", "W", "trans", "inverse", NULL};
@@ -93,6 +95,9 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
     if (!PyArg_ParseTupleAndKeywords(args, kwrds, "OO|cc", kwlist,
         &x, &W, &trans, &inverse)) return NULL;
 
+    xr = x->nrows;
+    xc = x->ncols;
+
 
     /*
      * Scaling for nonlinear component xk is xk := dnl .* xk; inverse is
@@ -102,9 +107,9 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
     if ((d = (inverse == 'N') ? (matrix *) PyDict_GetItemString(W, "dnl") :
         (matrix *) PyDict_GetItemString(W, "dnli"))){
         m = len(d);
-        for (i = 0; i < x->ncols; i++)
+        for (i = 0; i < xc; i++)
             dtbmv_("L", "N", "N", &m, &int0, MAT_BUFD(d), &int1,
-                MAT_BUFD(x) + i*x->nrows, &int1);
+                MAT_BUFD(x) + i*xr, &int1);
         ind += m;
     }
 
@@ -120,9 +125,9 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
         return NULL;
     }
     m = len(d);
-    for (i = 0; i < x->ncols; i++)
+    for (i = 0; i < xc; i++)
         dtbmv_("L", "N", "N", &m, &int0, MAT_BUFD(d), &int1, MAT_BUFD(x)
-            + i*x->nrows + ind, &int1);
+            + i*xr + ind, &int1);
     ind += m;
 
 
@@ -136,34 +141,34 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
      *
      * Inverse scaling is
      *
-     *    xk := 1/beta * (2*J*v*v'*J - J) * xk
-     *        = 1/beta * (-J) * (2*v*((-J*xk)'*v)' + xk).
+     *     xk := 1/beta * (2*J*v*v'*J - J) * xk
+     *         = 1/beta * (-J) * (2*v*((-J*xk)'*v)' + xk).
      */
 
     v = PyDict_GetItemString(W, "v");
     beta = PyDict_GetItemString(W, "beta");
     N = (int) PyList_Size(v);
-    if (!(wrk = (double *) calloc(x->ncols, sizeof(double))))
+    if (!(wrk = (double *) calloc(xc, sizeof(double))))
         return PyErr_NoMemory();
     for (k = 0; k < N; k++){
         vk = (matrix *) PyList_GetItem(v, (Py_ssize_t) k);
         m = vk->nrows;
         if (inverse == 'I')
-            dscal_(&(x->ncols), &dblm1, MAT_BUFD(x) + ind, &(x->nrows));
-        ld = MAX(x->nrows, 1);
-        dgemv_("T", &m, &(x->ncols), &dbl1, MAT_BUFD(x) + ind, &ld,
-            MAT_BUFD(vk), &int1, &dbl0, wrk, &int1);
-        dscal_(&(x->ncols), &dblm1, MAT_BUFD(x) + ind, &(x->nrows));
-        dger_(&m, &(x->ncols), &dbl2, MAT_BUFD(vk), &int1, wrk, &int1,
+            dscal_(&xc, &dblm1, MAT_BUFD(x) + ind, &xr);
+        ld = MAX(xr, 1);
+        dgemv_("T", &m, &xc, &dbl1, MAT_BUFD(x) + ind, &ld, MAT_BUFD(vk), 
+            &int1, &dbl0, wrk, &int1);
+        dscal_(&xc, &dblm1, MAT_BUFD(x) + ind, &xr);
+        dger_(&m, &xc, &dbl2, MAT_BUFD(vk), &int1, wrk, &int1,
             MAT_BUFD(x) + ind, &ld);
         if (inverse == 'I')
-            dscal_(&(x->ncols), &dblm1, MAT_BUFD(x) + ind, &(x->nrows));
+            dscal_(&xc, &dblm1, MAT_BUFD(x) + ind, &xr);
 
         betak = PyList_GetItem(beta, (Py_ssize_t) k);
         b = PyFloat_AS_DOUBLE(betak);
         if (inverse == 'I') b = 1.0 / b;
-        for (i = 0; i < x->ncols; i++)
-            dscal_(&m, &b, MAT_BUFD(x) + ind + i*x->nrows, &int1);
+        for (i = 0; i < xc; i++)
+            dscal_(&m, &b, MAT_BUFD(x) + ind + i*xr, &int1);
         ind += m;
     }
     free(wrk);
@@ -197,11 +202,11 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
     for (k = 0; k < N; k++){
         rk = (matrix *) PyList_GetItem(r, (Py_ssize_t) k);
         n = rk->nrows;
-        for (i = 0; i < x->ncols; i++){
+        for (i = 0; i < xc; i++){
 
             /* scale diagonal of rk by 0.5 */
             inc = n + 1;
-            dscal_(&n, &dbl5, MAT_BUFD(x) + ind + i*x->nrows, &inc);
+            dscal_(&n, &dbl5, MAT_BUFD(x) + ind + i*xr, &inc);
 
             /* wrk = r*tril(x) if inverse is 'N' and trans is 'T' or
              *                 inverse is 'I' and trans is 'N'
@@ -211,7 +216,7 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
             ld = MAX(1, n);
             dtrmm_( (( inverse == 'N' && trans == 'T') || ( inverse == 'I'
                 && trans == 'N')) ? "R" : "L", "L", "N", "N", &n, &n,
-                &dbl1, MAT_BUFD(x) + ind + i*x->nrows, &ld, wrk, &ld);
+                &dbl1, MAT_BUFD(x) + ind + i*xr, &ld, wrk, &ld);
 
             /* x := (r*wrk' + wrk*r') if inverse is 'N' and trans is 'T'
              *                        or inverse is 'I' and trans is 'N'
@@ -219,7 +224,7 @@ static PyObject* scale(PyObject *self, PyObject *args, PyObject *kwrds)
             dsyr2k_("L", ((inverse == 'N' && trans == 'T') ||
                 (inverse == 'I' && trans == 'N')) ? "N" : "T", &n, &n,
                 &dbl1, MAT_BUFD(rk), &ld, wrk, &ld, &dbl0, MAT_BUFD(x) +
-                ind + i*x->nrows, &ld);
+                ind + i*xr, &ld);
         }
         ind += n*n;
     }
@@ -415,7 +420,7 @@ static PyObject* pack(PyObject *self, PyObject *args, PyObject *kwrds)
 
 static char doc_pack2[] =
     "In-place version of pack().\n\n"
-    "pack2(x, y, dims, mnl = 0)\n\n"
+    "pack2(x, dims, mnl = 0)\n\n"
     "In-place version of pack(), which also accepts matrix arguments x.\n"
     "The columns of x are elements of S, with the 's' components stored\n"
     "in unpacked storage.  On return, the 's' components are stored in\n"
@@ -426,12 +431,15 @@ static PyObject* pack2(PyObject *self, PyObject *args, PyObject *kwrds)
     matrix *x;
     PyObject *O, *Ok, *dims;
     double a = sqrt(2.0), *wrk;
-    int i, j, k, nlq = 0, iu, ip, len, n, maxn;
+    int i, j, k, nlq = 0, iu, ip, len, n, maxn, xr, xc;
     char *kwlist[] = {"x", "dims", "mnl", NULL};
 
     if (!PyArg_ParseTupleAndKeywords(args, kwrds, "OO|i", kwlist, &x,
         &dims, &nlq)) return NULL;
 
+    xr = x->nrows;
+    xc = x->ncols;
+
     O = PyDict_GetItemString(dims, "l");
     nlq += (int) PyInt_AsLong(O);
 
@@ -447,7 +455,7 @@ static PyObject* pack2(PyObject *self, PyObject *args, PyObject *kwrds)
         maxn = MAX(maxn, (int) PyInt_AsLong(Ok));
     }
     if (!maxn) return Py_BuildValue("");
-    if (!(wrk = (double *) calloc(maxn * x->ncols, sizeof(double))))
+    if (!(wrk = (double *) calloc(maxn * xc, sizeof(double))))
         return PyErr_NoMemory();
 
     for (i = 0, iu = nlq, ip = nlq; i < (int) PyList_Size(O); i++){
@@ -455,12 +463,11 @@ static PyObject* pack2(PyObject *self, PyObject *args, PyObject *kwrds)
         n = (int) PyInt_AsLong(Ok);
         for (k = 0; k < n; k++){
             len = n-k;
-            dlacpy_(" ", &len, &(x->ncols), MAT_BUFD(x) + iu + k*(n+1),
-                &(x->nrows), wrk, &maxn);
+            dlacpy_(" ", &len, &xc, MAT_BUFD(x) + iu + k*(n+1), &xr, wrk, 
+                &maxn);
             for (j = 1; j < len; j++)
-                dscal_(&(x->ncols), &a, wrk + j, &maxn);
-            dlacpy_(" ", &len, &(x->ncols), wrk, &maxn, MAT_BUFD(x) + ip,
-                &(x->nrows));
+                dscal_(&xc, &a, wrk + j, &maxn);
+            dlacpy_(" ", &len, &xc, wrk, &maxn, MAT_BUFD(x) + ip, &xr);
             ip += len;
         }
         iu += n*n;
diff --git a/src/C/sparse.c b/src/C/sparse.c
index a2062b2..ebbacd5 100644
--- a/src/C/sparse.c
+++ b/src/C/sparse.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -402,7 +403,7 @@ spmatrix * sparse_concat(PyObject *L, int id_arg)
               }
               else if ((SP_ID(Lij) == COMPLEX) && (SP_VALZ(Lij)[ik] != 0.0)) {
 
-                SP_VALZ(A)[cnt] = SP_VALD(Lij)[ik];
+                SP_VALZ(A)[cnt] = SP_VALZ(Lij)[ik];
                 SP_ROW(A)[cnt++] = mk + SP_ROW(Lij)[ik];
                 SP_COL(A)[nk+1]++;
                 nnz++;
diff --git a/src/C/umfpack.c b/src/C/umfpack.c
index ba2f835..5abb802 100644
--- a/src/C/umfpack.c
+++ b/src/C/umfpack.c
@@ -1,7 +1,8 @@
 /*
+ * Copyright 2010 L. Vandenberghe.
  * Copyright 2004-2009 J. Dahl and L. Vandenberghe.
  *
- * This file is part of CVXOPT version 1.1.2
+ * This file is part of CVXOPT version 1.1.3.
  *
  * CVXOPT is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/python/__init__.py b/src/python/__init__.py
index 6aedfaa..3c0f9bc 100644
--- a/src/python/__init__.py
+++ b/src/python/__init__.py
@@ -11,9 +11,10 @@ library and on the strengths of Python as a high-level programming
 language.
 """ 
 
+# Copyright 2010 L. Vandenberghe.
 # Copyright 2004-2009 J. Dahl and L. Vandenberghe.
 # 
-# This file is part of CVXOPT version 1.1.2
+# This file is part of CVXOPT version 1.1.3.
 #
 # CVXOPT is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/src/python/coneprog.py b/src/python/coneprog.py
index 1416cbb..03bd1ef 100644
--- a/src/python/coneprog.py
+++ b/src/python/coneprog.py
@@ -2,9 +2,10 @@
 Solver for linear and quadratic cone programs. 
 """
 
+# Copyright 2010 L. Vandenberghe.
 # Copyright 2004-2009 J. Dahl and L. Vandenberghe.
 # 
-# This file is part of CVXOPT version 1.1.2
+# This file is part of CVXOPT version 1.1.3.
 #
 # CVXOPT is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -345,7 +346,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
         combination with 1. above, i.e., it requires the kktsolver 
         argument.
 
-        If G is a function, the call G(u, u, alpha, beta, trans)
+        If G is a function, the call G(u, v, alpha, beta, trans)
         should evaluate the matrix-vector products
 
             v := alpha * G * u + beta * v  if trans is 'N' 
@@ -426,32 +427,32 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
     except KeyError: MAXITERS = 100
     else:
         if type(MAXITERS) is not int or MAXITERS < 1:
-           raise ValueError, "options['maxiters'] must be a positive "\
-               "integer"
+           raise ValueError("options['maxiters'] must be a positive "\
+               "integer")
 
     try: ABSTOL = options['abstol']
     except KeyError: ABSTOL = 1e-7
     else:
         if type(ABSTOL) is not float and type(ABSTOL) is not int:
-            raise ValueError, "options['abstol'] must be a scalar"
+            raise ValueError("options['abstol'] must be a scalar")
 
     try: RELTOL = options['reltol']
     except KeyError: RELTOL = 1e-6
     else:
         if type(RELTOL) is not float and type(RELTOL) is not int:
-            raise ValueError, "options['reltol'] must be a scalar"
+            raise ValueError("options['reltol'] must be a scalar")
 
     if RELTOL <= 0.0 and ABSTOL <= 0.0 :
-        raise ValueError, "at least one of options['reltol'] and " \
-            "options['abstol'] must be positive"
+        raise ValueError("at least one of options['reltol'] and " \
+            "options['abstol'] must be positive")
 
     try: FEASTOL = options['feastol']
     except KeyError: FEASTOL = 1e-7
     else:
         if (type(FEASTOL) is not float and type(FEASTOL) is not int) or \
             FEASTOL <= 0.0:
-            raise ValueError, "options['feastol'] must be a positive "\
-                "scalar"
+            raise ValueError("options['feastol'] must be a positive "\
+                "scalar")
 
     try: show_progress = options['show_progress']
     except KeyError: show_progress = True
@@ -463,43 +464,43 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
             kktsolver = 'chol2'
     defaultsolvers = ('ldl', 'ldl2', 'qr', 'chol', 'chol2')
     if type(kktsolver) is str and kktsolver not in defaultsolvers:
-        raise ValueError, "'%s' is not a valid value for kktsolver" \
-            %kktsolver
+        raise ValueError("'%s' is not a valid value for kktsolver" \
+            %kktsolver)
 
     # Argument error checking depends on level of customization.
     customkkt = type(kktsolver) is not str
     matrixG = type(G) in (matrix, spmatrix)
     matrixA = type(A) in (matrix, spmatrix)
     if (not matrixG or (not matrixA and A is not None)) and not customkkt:
-        raise ValueError, "use of function valued G, A requires a "\
-            "user-provided kktsolver"
+        raise ValueError("use of function valued G, A requires a "\
+            "user-provided kktsolver")
     customx = (xnewcopy != None or xdot != None or xaxpy != None or 
         xscal != None)
     if customx and (matrixG or matrixA or not customkkt):
-        raise ValueError, "use of non-vector type for x requires "\
-            "function valued G, A and user-provided kktsolver"
+        raise ValueError("use of non-vector type for x requires "\
+            "function valued G, A and user-provided kktsolver")
     customy = (ynewcopy != None or ydot != None or yaxpy != None or 
         yscal != None)
     if customy and (matrixA or not customkkt):
-        raise ValueError, "use of non-vector type for y requires "\
-            "function valued A and user-provided kktsolver"
+        raise ValueError("use of non-vector type for y requires "\
+            "function valued A and user-provided kktsolver")
 
 
     if not customx and (type(c) is not matrix or c.typecode != 'd' or 
         c.size[1] != 1):
-        raise TypeError, "'c' must be a 'd' matrix with one column" 
+        raise TypeError("'c' must be a 'd' matrix with one column")
 
     if type(h) is not matrix or h.typecode != 'd' or h.size[1] != 1:
-        raise TypeError, "'h' must be a 'd' matrix with 1 column" 
+        raise TypeError("'h' must be a 'd' matrix with 1 column")
 
     if not dims: dims = {'l': h.size[0], 'q': [], 's': []}
     if type(dims['l']) is not int or dims['l'] < 0: 
-        raise TypeError, "'dims['l']' must be a nonnegative integer"
+        raise TypeError("'dims['l']' must be a nonnegative integer")
     if [ k for k in dims['q'] if type(k) is not int or k < 1 ]:
-        raise TypeError, "'dims['q']' must be a list of positive integers"
+        raise TypeError("'dims['q']' must be a list of positive integers")
     if [ k for k in dims['s'] if type(k) is not int or k < 0 ]:
-        raise TypeError, "'dims['s']' must be a list of nonnegative " \
-            "integers"
+        raise TypeError("'dims['s']' must be a list of nonnegative " \
+            "integers")
 
     try: refinement = options['refinement']
     except KeyError: 
@@ -507,8 +508,8 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
         else: refinement = 0
     else:
         if type(refinement) is not int or refinement < 0: 
-            raise ValueError, "options['refinement'] must be a "\
-                "nonnegative integer"
+            raise ValueError("options['refinement'] must be a "\
+                "nonnegative integer")
 
 
     cdim = dims['l'] + sum(dims['q']) + sum([k**2 for k in dims['s']])
@@ -517,7 +518,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
     cdim_diag = dims['l'] + sum(dims['q']) + sum(dims['s'])
 
     if h.size[0] != cdim:
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %cdim
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %cdim)
 
     # Data for kth 'q' constraint are found in rows indq[k]:indq[k+1] of G.
     indq = [ dims['l'] ]  
@@ -529,8 +530,8 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
 
     if matrixG:
         if G.typecode != 'd' or G.size != (cdim, c.size[0]):
-            raise TypeError, "'G' must be a 'd' matrix of size (%d, %d)"\
-                %(cdim, c.size[0])
+            raise TypeError("'G' must be a 'd' matrix of size (%d, %d)"\
+                %(cdim, c.size[0]))
         def Gf(x, y, trans = 'N', alpha = 1.0, beta = 0.0): 
             misc.sgemv(G, x, y, dims, trans = trans, alpha = alpha, 
                 beta = beta)
@@ -547,8 +548,8 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
             matrixA = True
     if matrixA:
         if A.typecode != 'd' or A.size[1] != c.size[0]:
-            raise TypeError, "'A' must be a 'd' matrix with %d columns "\
-                %c.size[0]
+            raise TypeError("'A' must be a 'd' matrix with %d columns "\
+                %c.size[0])
         def Af(x, y, trans = 'N', alpha = 1.0, beta = 0.0): 
             base.gemv(A, x, y, trans = trans, alpha = alpha, beta = beta)
     else: 
@@ -557,12 +558,12 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
     if not customy:
         if b is None: b = matrix(0.0, (0,1))
         if type(b) is not matrix or b.typecode != 'd' or b.size[1] != 1:
-            raise TypeError, "'b' must be a 'd' matrix with one column" 
+            raise TypeError("'b' must be a 'd' matrix with one column")
         if matrixA and b.size[0] != A.size[0]:
-            raise TypeError, "'b' must have length %d" %A.size[0]
+            raise TypeError("'b' must have length %d" %A.size[0])
     else:
         if b is None: 
-            raise ValueError, "use of non vector type for y requires b"
+            raise ValueError("use of non vector type for y requires b")
 
 
     # kktsolver(W) returns a routine for solving 3x3 block KKT system 
@@ -573,7 +574,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
 
     if kktsolver in defaultsolvers:
         if b.size[0] > c.size[0] or b.size[0] + cdim_pckd < c.size[0]:
-           raise ValueError, "Rank(A) < p or Rank([G; A]) < n"
+           raise ValueError("Rank(A) < p or Rank([G; A]) < n")
         if kktsolver == 'ldl': 
             factor = misc.kkt_ldl(G, dims, A)
         elif kktsolver == 'ldl2':
@@ -682,7 +683,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
         for rti in W['rti']: rti[::rti.size[0]+1 ] = 1.0
         try: f = kktsolver(W)
         except ArithmeticError:  
-            raise ValueError, "Rank(A) < p or Rank([G; A]) < n"
+            raise ValueError("Rank(A) < p or Rank([G; A]) < n")
 
     if primalstart is None:
 
@@ -700,7 +701,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
         blas.copy(h, s)
         try: f(x, dy, s) 
         except ArithmeticError:  
-            raise ValueError, "Rank(A) < p or Rank([G; A]) < n"
+            raise ValueError("Rank(A) < p or Rank([G; A]) < n")
         blas.scal(-1.0, s)  
 
     else:
@@ -710,7 +711,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
     # ts = min{ t | s + t*e >= 0 }
     ts = misc.max_step(s, dims)
     if ts >= 0 and primalstart: 
-        raise ValueError, "initial s is not positive"
+        raise ValueError("initial s is not positive")
 
 
     if dualstart is None:
@@ -730,7 +731,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
         blas.scal(0.0, z)
         try: f(dx, y, z)
         except ArithmeticError:  
-            raise ValueError, "Rank(A) < p or Rank([G; A]) < n"
+            raise ValueError("Rank(A) < p or Rank([G; A]) < n")
 
     else:
         if 'y' in dualstart: ycopy(dualstart['y'], y)
@@ -739,7 +740,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
     # tz = min{ t | z + t*e >= 0 }
     tz = misc.max_step(z, dims)
     if tz >= 0 and dualstart: 
-        raise ValueError, "initial z is not positive"
+        raise ValueError("initial z is not positive")
 
     nrms = misc.snrm2(s, dims)
     nrmz = misc.snrm2(z, dims)
@@ -791,7 +792,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
             cx, by, hz = xdot(c,x), ydot(b,y), misc.sdot(h, z, dims) 
 
             if show_progress:
-                print "Optimal solution found."
+                print("Optimal solution found.")
             return { 'x': x, 'y': y, 's': s, 'z': z,
                 'status': 'optimal', 
                 'gap': gap, 
@@ -919,10 +920,10 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
 
         if show_progress:
             if iters == 0:
-                print "% 10s% 12s% 10s% 8s% 7s % 5s" %("pcost", "dcost",
-                    "gap", "pres", "dres", "k/t")
-            print "%2d: % 8.4e % 8.4e % 4.0e% 7.0e% 7.0e% 7.0e" \
-                %(iters, pcost, dcost, gap, pres, dres, kappa/tau)
+                print("% 10s% 12s% 10s% 8s% 7s % 5s" %("pcost", "dcost",
+                    "gap", "pres", "dres", "k/t"))
+            print("%2d: % 8.4e % 8.4e % 4.0e% 7.0e% 7.0e% 7.0e" \
+                %(iters, pcost, dcost, gap, pres, dres, kappa/tau))
 
 
         if ( pres <= FEASTOL and dres <= FEASTOL and ( gap <= ABSTOL or 
@@ -941,8 +942,8 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
             tz = misc.max_step(z, dims)
             if iters == MAXITERS:
                 if show_progress:
-                    print "Terminated (maximum number of iterations "\
-                        "reached)."
+                    print("Terminated (maximum number of iterations "\
+                        "reached).")
                 return { 'x': x, 'y': y, 's': s, 'z': z,
                     'status': 'unknown', 
                     'gap': gap, 
@@ -961,7 +962,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
 
             else:
                 if show_progress:
-                    print "Optimal solution found."
+                    print("Optimal solution found.")
                 return { 'x': x, 'y': y, 's': s, 'z': z,
                     'status': 'optimal', 
                     'gap': gap, 
@@ -985,7 +986,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
                 ind += m**2
             tz = misc.max_step(z, dims)
             if show_progress:
-                print "Certificate of primal infeasibility found."
+                print("Certificate of primal infeasibility found.")
             return { 'x': None, 'y': y, 's': None, 'z': z,
                 'status': 'primal infeasible',
                 'gap': None, 
@@ -1010,7 +1011,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
             y, z = None, None
             ts = misc.max_step(s, dims)
             if show_progress:
-                print "Certificate of dual infeasibility found."
+                print("Certificate of dual infeasibility found.")
             return {'x': x, 'y': None, 's': s, 'z': None,
                 'status': 'dual infeasible',
                 'gap': None, 
@@ -1080,7 +1081,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
             blas.scal(dgi, z1)
         except ArithmeticError:
             if iters == 0 and primalstart and dualstart: 
-                raise ValueError, "Rank(A) < p or Rank([G; A]) < n"
+                raise ValueError("Rank(A) < p or Rank([G; A]) < n")
             else:
                 xscal(1.0/tau, x)
                 yscal(1.0/tau, y)
@@ -1094,7 +1095,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
                 ts = misc.max_step(s, dims)
                 tz = misc.max_step(z, dims)
                 if show_progress:
-                    print "Terminated (singular KKT matrix)."
+                    print("Terminated (singular KKT matrix).")
                 return { 'x': x, 'y': y, 's': s, 'z': z,
                     'status': 'unknown', 
                     'gap': gap, 
@@ -1108,7 +1109,7 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
                     'residual as primal infeasibility certificate': 
                         pinfres,
                     'residual as dual infeasibility certificate': 
-                        dinfres, 
+                        dinfres,
                     'iterations': iters }
 
 
@@ -1239,13 +1240,13 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
             if DEBUG:
                 res(x, y, z, tau, s, kappa, wx, wy, wz, wtau, ws, wkappa,
                     W, dg, lmbda)
-                print "KKT residuals"
-                print "    'x': %e" %math.sqrt(xdot(wx, wx)) 
-                print "    'y': %e" %math.sqrt(ydot(wy, wy))
-                print "    'z': %e" %misc.snrm2(wz, dims)
-                print "    'tau': %e" %abs(wtau[0])
-                print "    's': %e" %misc.snrm2(ws, dims)
-                print "    'kappa': %e" %abs(wkappa[0])
+                print("KKT residuals")
+                print("    'x': %e" %math.sqrt(xdot(wx, wx)))
+                print("    'y': %e" %math.sqrt(ydot(wy, wy)))
+                print("    'z': %e" %misc.snrm2(wz, dims))
+                print("    'tau': %e" %abs(wtau[0]))
+                print("    's': %e" %misc.snrm2(ws, dims))
+                print("    'kappa': %e" %abs(wkappa[0]))
  
 
         mu = blas.nrm2(lmbda)**2 / (1 + cdim_diag) 
@@ -1308,7 +1309,6 @@ def conelp(c, G, h, dims = None, A = None, b = None, primalstart = None,
                 misc.sprod(ws3, dz, dims)
                 wkappa3 = dtau[0] * dkappa[0]
 
-
             # Maximum step to boundary.
             #
             # If i is 1, also compute eigenvalue decomposition of the 's' 
@@ -1777,38 +1777,38 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
     # Use Mehrotra correction or not.
     try: correction = options['use_correction']
     except KeyError: correction = True
- 
+
 
     try: MAXITERS = options['maxiters']
     except KeyError: MAXITERS = 100
     else: 
         if type(MAXITERS) is not int or MAXITERS < 1: 
-            raise ValueError, "options['maxiters'] must be a positive "\
-                "integer"
+            raise ValueError("options['maxiters'] must be a positive "\
+                "integer")
 
     try: ABSTOL = options['abstol']
     except KeyError: ABSTOL = 1e-7
     else: 
         if type(ABSTOL) is not float and type(ABSTOL) is not int: 
-            raise ValueError, "options['abstol'] must be a scalar"
+            raise ValueError("options['abstol'] must be a scalar")
 
     try: RELTOL = options['reltol']
     except KeyError: RELTOL = 1e-6
     else: 
         if type(RELTOL) is not float and type(RELTOL) is not int: 
-            raise ValueError, "options['reltol'] must be a scalar"
+            raise ValueError("options['reltol'] must be a scalar")
 
     if RELTOL <= 0.0 and ABSTOL <= 0.0 :
-        raise ValueError, "at least one of options['reltol'] and " \
-            "options['abstol'] must be positive"
+        raise ValueError("at least one of options['reltol'] and " \
+            "options['abstol'] must be positive")
 
     try: FEASTOL = options['feastol']
     except KeyError: FEASTOL = 1e-7
     else: 
         if (type(FEASTOL) is not float and type(FEASTOL) is not int) or \
             FEASTOL <= 0.0:
-            raise ValueError, "options['feastol'] must be a positive "\
-                "scalar"
+            raise ValueError("options['feastol'] must be a positive "\
+                "scalar")
 
     try: show_progress = options['show_progress']
     except KeyError: show_progress = True
@@ -1821,8 +1821,8 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             kktsolver = 'chol2'            
     defaultsolvers = ('ldl', 'ldl2', 'chol', 'chol2')
     if type(kktsolver) is str and kktsolver not in defaultsolvers:
-        raise ValueError, "'%s' is not a valid value for kktsolver" \
-            %kktsolver
+        raise ValueError("'%s' is not a valid value for kktsolver" \
+            %kktsolver)
 
 
     # Argument error checking depends on level of customization.
@@ -1832,28 +1832,28 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
     matrixA = type(A) in (matrix, spmatrix)
     if (not matrixP or (not matrixG and G is not None) or 
         (not matrixA and A is not None)) and not customkkt:
-        raise ValueError, "use of function valued P, G, A requires a "\
-            "user-provided kktsolver"
+        raise ValueError("use of function valued P, G, A requires a "\
+            "user-provided kktsolver")
     customx = (xnewcopy != None or xdot != None or xaxpy != None or 
         xscal != None) 
     if customx and (matrixP or matrixG or matrixA or not customkkt):
-        raise ValueError, "use of non-vector type for x requires "\
-            "function valued P, G, A and user-provided kktsolver"
+        raise ValueError("use of non-vector type for x requires "\
+            "function valued P, G, A and user-provided kktsolver")
     customy = (ynewcopy != None or ydot != None or yaxpy != None or 
         yscal != None) 
     if customy and (matrixA or not customkkt):
-        raise ValueError, "use of non vector type for y requires "\
-            "function valued A and user-provided kktsolver"
+        raise ValueError("use of non vector type for y requires "\
+            "function valued A and user-provided kktsolver")
 
 
     if not customx and (type(q) is not matrix or q.typecode != 'd' or
         q.size[1] != 1):
-        raise TypeError, "'q' must be a 'd' matrix with one column"
+        raise TypeError("'q' must be a 'd' matrix with one column")
 
     if matrixP:
         if P.typecode != 'd' or P.size != (q.size[0], q.size[0]):
-            raise TypeError, "'P' must be a 'd' matrix of size (%d, %d)"\
-                %(q.size[0], q.size[0])
+            raise TypeError("'P' must be a 'd' matrix of size (%d, %d)"\
+                %(q.size[0], q.size[0]))
         def fP(x, y, alpha = 1.0, beta = 0.0):
             base.symv(P, x, y, alpha = alpha, beta = beta)
     else:
@@ -1862,16 +1862,16 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
 
     if h is None: h = matrix(0.0, (0,1))
     if type(h) is not matrix or h.typecode != 'd' or h.size[1] != 1:
-        raise TypeError, "'h' must be a 'd' matrix with one column" 
+        raise TypeError("'h' must be a 'd' matrix with one column")
 
     if not dims: dims = {'l': h.size[0], 'q': [], 's': []}
     if type(dims['l']) is not int or dims['l'] < 0: 
-        raise TypeError, "'dims['l']' must be a nonnegative integer"
+        raise TypeError("'dims['l']' must be a nonnegative integer")
     if [ k for k in dims['q'] if type(k) is not int or k < 1 ]:
-        raise TypeError, "'dims['q']' must be a list of positive integers"
+        raise TypeError("'dims['q']' must be a list of positive integers")
     if [ k for k in dims['s'] if type(k) is not int or k < 0 ]:
-        raise TypeError, "'dims['s']' must be a list of nonnegative " \
-            "integers"
+        raise TypeError("'dims['s']' must be a list of nonnegative " \
+            "integers")
 
     try: refinement = options['refinement']
     except KeyError: 
@@ -1879,13 +1879,13 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
         else: refinement = 0
     else:
         if type(refinement) is not int or refinement < 0: 
-            raise ValueError, "options['refinement'] must be a "\
-                "nonnegative integer"
+            raise ValueError("options['refinement'] must be a "\
+                "nonnegative integer")
 
 
     cdim = dims['l'] + sum(dims['q']) + sum([ k**2 for k in dims['s'] ])
     if h.size[0] != cdim:
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %cdim
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %cdim)
 
     # Data for kth 'q' constraint are found in rows indq[k]:indq[k+1] of G.
     indq = [ dims['l'] ]  
@@ -1905,8 +1905,8 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             matrixG = True
     if matrixG:
         if G.typecode != 'd' or G.size != (cdim, q.size[0]):
-            raise TypeError, "'G' must be a 'd' matrix of size (%d, %d)"\
-                %(cdim, q.size[0])
+            raise TypeError("'G' must be a 'd' matrix of size (%d, %d)"\
+                %(cdim, q.size[0]))
         def fG(x, y, trans = 'N', alpha = 1.0, beta = 0.0):
             misc.sgemv(G, x, y, dims, trans = trans, alpha = alpha, 
                 beta = beta)
@@ -1924,8 +1924,8 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             matrixA = True
     if matrixA:
         if A.typecode != 'd' or A.size[1] != q.size[0]:
-            raise TypeError, "'A' must be a 'd' matrix with %d columns" \
-                %q.size[0]
+            raise TypeError("'A' must be a 'd' matrix with %d columns" \
+                %q.size[0])
         def fA(x, y, trans = 'N', alpha = 1.0, beta = 0.0):
             base.gemv(A, x, y, trans = trans, alpha = alpha, beta = beta)
     else:
@@ -1933,11 +1933,11 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
     if not customy:
         if b is None: b = matrix(0.0, (0,1))
         if type(b) is not matrix or b.typecode != 'd' or b.size[1] != 1:
-            raise TypeError, "'b' must be a 'd' matrix with one column"
+            raise TypeError("'b' must be a 'd' matrix with one column")
         if matrixA and b.size[0] != A.size[0]:
-            raise TypeError, "'b' must have length %d" %A.size[0]
+            raise TypeError("'b' must have length %d" %A.size[0])
     if b is None and customy:  
-        raise ValueEror, "use of non-vector type for y requires b"
+        raise ValueEror("use of non-vector type for y requires b")
 
 
     ws3, wz3 = matrix(0.0, (cdim,1 )), matrix(0.0, (cdim,1 ))
@@ -1982,7 +1982,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
 
     if kktsolver in defaultsolvers:
          if b.size[0] > q.size[0]:
-             raise ValueError, "Rank(A) < p or Rank([P; G; A]) < n"
+             raise ValueError("Rank(A) < p or Rank([P; G; A]) < n")
          if kktsolver == 'ldl': 
              factor = misc.kkt_ldl(G, dims, A)
          elif kktsolver == 'ldl2': 
@@ -2024,7 +2024,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
         try: f3 = kktsolver({'d': matrix(0.0, (0,1)), 'di': 
             matrix(0.0, (0,1)), 'beta': [], 'v': [], 'r': [], 'rti': []})
         except ArithmeticError: 
-            raise ValueError, "Rank(A) < p or Rank([P; A; G]) < n"
+            raise ValueError("Rank(A) < p or Rank([P; A; G]) < n")
         x = xnewcopy(q)  
         xscal(-1.0, x)
         y = ynewcopy(b)
@@ -2078,7 +2078,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
         for rti in W['rti']: rti[::rti.size[0]+1 ] = 1.0
         try: f = kktsolver(W)
         except ArithmeticError:  
-            raise ValueError, "Rank(A) < p or Rank([P; A; G]) < n"
+            raise ValueError("Rank(A) < p or Rank([P; A; G]) < n")
 
              
         # Solve
@@ -2093,7 +2093,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
         blas.copy(h, z)
         try: f(x, y, z) 
         except ArithmeticError:  
-            raise ValueError, "Rank(A) < p or Rank([P; G; A]) < n"
+            raise ValueError("Rank(A) < p or Rank([P; G; A]) < n")
         blas.copy(z, s)  
         blas.scal(-1.0, s)  
 
@@ -2131,7 +2131,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             blas.copy(initvals['s'], s)
             # ts = min{ t | s + t*e >= 0 }
             if misc.max_step(s, dims) >= 0:
-                raise ValueError, "initial s is not positive"
+                raise ValueError("initial s is not positive")
         else: 
             s[: dims['l']] = 1.0 
             ind = dims['l']
@@ -2151,7 +2151,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             blas.copy(initvals['z'], z)
             # tz = min{ t | z + t*e >= 0 }
             if misc.max_step(z, dims) >= 0:
-                raise ValueError, "initial z is not positive"
+                raise ValueError("initial z is not positive")
         else:
             z[: dims['l']] = 1.0 
             ind = dims['l']
@@ -2173,9 +2173,8 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
 
 
     if show_progress: 
-        print "% 10s% 12s% 10s% 8s% 7s" %("pcost", "dcost", "gap", "pres",
-            "dres")
-
+        print("% 10s% 12s% 10s% 8s% 7s" %("pcost", "dcost", "gap", "pres",
+            "dres"))
 
     gap = misc.sdot(s, z, dims) 
 
@@ -2219,8 +2218,8 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
         dres = resx/resx0 
 
         if show_progress:
-            print "%2d: % 8.4e % 8.4e % 4.0e% 7.0e% 7.0e" \
-                %(iters, pcost, dcost, gap, pres, dres) 
+            print("%2d: % 8.4e % 8.4e % 4.0e% 7.0e% 7.0e" \
+                %(iters, pcost, dcost, gap, pres, dres))
 
         if ( pres <= FEASTOL and dres <= FEASTOL and ( gap <= ABSTOL or 
             (relgap is not None and relgap <= RELTOL) )) or \
@@ -2234,12 +2233,12 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             tz = misc.max_step(z, dims)
             if iters == MAXITERS:
                 if show_progress:
-                    print "Terminated (maximum number of iterations "\
-                        "reached)."
+                    print("Terminated (maximum number of iterations "\
+                        "reached).")
                 status = 'unknown'
             else:
                 if show_progress:
-                    print "Optimal solution found."
+                    print("Optimal solution found.")
                 status = 'optimal'
             return { 'x': x,  'y': y,  's': s,  'z': z,  'status': status,
                     'gap': gap,  'relative gap': relgap, 
@@ -2271,7 +2270,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
         try: f3 = kktsolver(W)
         except ArithmeticError: 
             if iters == 0:
-                raise ValueError, "Rank(A) < p or Rank([P; A; G]) < n"
+                raise ValueError("Rank(A) < p or Rank([P; A; G]) < n")
             else:  
                 ind = dims['l'] + sum(dims['q'])
                 for m in dims['s']:
@@ -2280,7 +2279,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
                     ind += m**2
                 ts = misc.max_step(s, dims)
                 tz = misc.max_step(z, dims)
-                print "Terminated (singular KKT matrix)."
+                print("Terminated (singular KKT matrix).")
                 return { 'x': x,  'y': y,  's': s,  'z': z,  
                     'status': 'unknown', 'gap': gap,  
                     'relative gap': relgap, 'primal objective': pcost,  
@@ -2361,11 +2360,11 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
                 blas.axpy(ws2, s)
             if DEBUG:
                 res(x, y, z, s, wx, wy, wz, ws, W, lmbda)
-                print "KKT residuals:"
-                print "    'x': %e" %math.sqrt(xdot(wx, wx)) 
-                print "    'y': %e" %math.sqrt(ydot(wy, wy))
-                print "    'z': %e" %misc.snrm2(wz, dims)
-                print "    's': %e" %misc.snrm2(ws, dims)
+                print("KKT residuals:")
+                print("    'x': %e" %math.sqrt(xdot(wx, wx)))
+                print("    'y': %e" %math.sqrt(ydot(wy, wy)))
+                print("    'z': %e" %misc.snrm2(wz, dims))
+                print("    's': %e" %misc.snrm2(ws, dims))
 
 
         mu = gap / (dims['l'] + len(dims['q']) + sum(dims['s']))
@@ -2415,7 +2414,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             try: f4(dx, dy, dz, ds)
             except ArithmeticError: 
                 if iters == 0:
-                    raise ValueError, "Rank(A) < p or Rank([P; A; G]) < n"
+                    raise ValueError("Rank(A) < p or Rank([P; A; G]) < n")
                 else:
                     ind = dims['l'] + sum(dims['q'])
                     for m in dims['s']:
@@ -2424,7 +2423,7 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
                         ind += m**2
                     ts = misc.max_step(s, dims)
                     tz = misc.max_step(z, dims)
-                    print "Terminated (singular KKT matrix)."
+                    print("Terminated (singular KKT matrix).")
                     return { 'x': x,  'y': y,  's': s,  'z': z,  
                         'status': 'unknown', 'gap': gap,  
                         'relative gap': relgap, 'primal objective': pcost, 
@@ -2436,9 +2435,9 @@ def coneqp(P, q, G = None, h = None, dims = None, A = None, b = None,
             dsdz = misc.sdot(ds, dz, dims)
 
             # Save ds o dz for Mehrotra correction
-            if correction and i == 0:   
-                    blas.copy(ds, ws3)
-                    misc.sprod(ws3, dz, dims)
+            if correction and i == 0:
+                blas.copy(ds, ws3)
+                misc.sprod(ws3, dz, dims)
 
 
             # Maximum steps to boundary.  
@@ -2609,7 +2608,7 @@ def lp(c, G, h, A = None, b = None, solver = None, primalstart = None,
         'primal objective', 'dual objective', 'gap', 'relative gap',  
         'primal infeasibility', 'dual infeasibility', 'primal slack', 
         'dual slack', 'residual as primal infeasibility certificate', 
-        'residual as dual infeasibility certificate'. 
+        'residual as dual infeasibility certificate'.
 
         The 'status' field has values 'optimal', 'primal infeasible',
         'dual infeasible', or 'unknown'.  The values of the other fields
@@ -2796,32 +2795,32 @@ def lp(c, G, h, A = None, b = None, solver = None, primalstart = None,
     from cvxopt.base import matrix, spmatrix
 
     if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
-        raise TypeError, "'c' must be a dense column matrix"
+        raise TypeError("'c' must be a dense column matrix")
     n = c.size[0]
-    if n < 1: raise ValueError, "number of variables must be at least 1"
+    if n < 1: raise ValueError("number of variables must be at least 1")
 
     if (type(G) is not matrix and type(G) is not spmatrix) or \
         G.typecode != 'd' or G.size[1] != n:
-        raise TypeError, "'G' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n 
+        raise TypeError("'G' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     m = G.size[0]
     if type(h) is not matrix or h.typecode != 'd' or h.size != (m,1):
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %m
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %m)
 
     if A is None:  A = spmatrix([], [], [], (0,n), 'd')
     if (type(A) is not matrix and type(A) is not spmatrix) or \
         A.typecode != 'd' or A.size[1] != n:
-        raise TypeError, "'A' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
+        raise TypeError("'A' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     p = A.size[0]
     if b is None: b = matrix(0.0, (0,1))
     if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
-        raise TypeError, "'b' must be a dense matrix of size (%d,1)" %p
+        raise TypeError("'b' must be a dense matrix of size (%d,1)" %p)
 
     if solver == 'glpk':
         try: from cvxopt import glpk
-        except ImportError: raise ValueError, "invalid option "\
-            "(solver = 'glpk'): cvxopt.glpk is not installed" 
+        except ImportError: raise ValueError("invalid option "\
+            "(solver = 'glpk'): cvxopt.glpk is not installed")
         glpk.options = options
         status, x, z, y = glpk.lp(c, G, h, A, b)
 
@@ -2887,24 +2886,24 @@ def lp(c, G, h, A = None, b = None, solver = None, primalstart = None,
 
     if solver == 'mosek':
         try: 
-            from cvxopt import mosek
-            import pymosek as msk
+            from cvxopt import msk
+            import mosek
         except ImportError: 
-            raise ValueError, "invalid option (solver = 'mosek'): "\
-                "cvxopt.mosek is not installed" 
+            raise ValueError("invalid option (solver = 'mosek'): "\
+                "cvxopt.mosek is not installed")
 
         if 'MOSEK' in options:
-            mosek.options = options['MOSEK']
+            msk.options = options['MOSEK']
         else:
-            mosek.options = {}
+            msk.options = {}
 
-        solsta, x, z, y  = mosek.lp(c, G, h, A, b)
+        solsta, x, z, y  = msk.lp(c, G, h, A, b)
 
         resx0 = max(1.0, blas.nrm2(c))
         resy0 = max(1.0, blas.nrm2(b))
         resz0 = max(1.0, blas.nrm2(h))
 
-        if solsta is msk.solsta.optimal:
+        if solsta is mosek.solsta.optimal:
             status = 'optimal'
 
             pcost = blas.dot(c,x)
@@ -2947,7 +2946,7 @@ def lp(c, G, h, A = None, b = None, solver = None, primalstart = None,
             pres, dres = max(resy, resz), resx
             pinfres, dinfres = None, None
 
-        elif solsta is msk.solsta.prim_infeas_cer:
+        elif solsta is mosek.solsta.prim_infeas_cer:
             status = 'primal infeasible'
 
             hz, by = blas.dot(h, z),  blas.dot(b, y)
@@ -2970,7 +2969,7 @@ def lp(c, G, h, A = None, b = None, solver = None, primalstart = None,
             dslack = -misc.max_step(z, dims)
             pslack = None
 
-        elif solsta == msk.solsta.dual_infeas_cer:
+        elif solsta == mosek.solsta.dual_infeas_cer:
             status = 'dual infeasible'
 
             cx = blas.dot(c,x)
@@ -3292,52 +3291,52 @@ def socp(c, Gl = None, hl = None, Gq = None, hq = None, A = None, b = None,
     from cvxopt.base import matrix, spmatrix
 
     if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
-        raise TypeError, "'c' must be a dense column matrix"
+        raise TypeError("'c' must be a dense column matrix")
     n = c.size[0]
-    if n < 1: raise ValueError, "number of variables must be at least 1"
+    if n < 1: raise ValueError("number of variables must be at least 1")
 
     if Gl is None:  Gl = spmatrix([], [], [], (0,n), tc='d')
     if (type(Gl) is not matrix and type(Gl) is not spmatrix) or \
         Gl.typecode != 'd' or Gl.size[1] != n:
-        raise TypeError, "'Gl' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
+        raise TypeError("'Gl' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     ml = Gl.size[0]
     if hl is None: hl = matrix(0.0, (0,1))
     if type(hl) is not matrix or hl.typecode != 'd' or \
         hl.size != (ml,1):
-        raise TypeError, "'hl' must be a dense 'd' matrix of " \
-            "size (%d,1)" %ml
+        raise TypeError("'hl' must be a dense 'd' matrix of " \
+            "size (%d,1)" %ml)
 
     if Gq is None: Gq = []
     if type(Gq) is not list or [ G for G in Gq if (type(G) is not matrix 
         and type(G) is not spmatrix) or G.typecode != 'd' or 
         G.size[1] != n ]:
-        raise TypeError, "'Gq' must be a list of sparse or dense 'd' "\
-            "matrices with %d columns" %n 
+        raise TypeError("'Gq' must be a list of sparse or dense 'd' "\
+            "matrices with %d columns" %n)
     mq = [ G.size[0] for G in Gq ]
     a = [ k for k in xrange(len(mq)) if mq[k] == 0 ] 
-    if a: raise TypeError, "the number of rows of Gq[%d] is zero" %a[0]
+    if a: raise TypeError("the number of rows of Gq[%d] is zero" %a[0])
     if hq is None: hq = []
     if type(hq) is not list or len(hq) != len(mq) or [ h for h in hq if
         (type(h) is not matrix and type(h) is not spmatrix) or 
         h.typecode != 'd' ]: 
-        raise TypeError, "'hq' must be a list of %d dense or sparse "\
-            "'d' matrices" %len(mq)
+        raise TypeError("'hq' must be a list of %d dense or sparse "\
+            "'d' matrices" %len(mq))
     a = [ k for k in xrange(len(mq)) if hq[k].size != (mq[k], 1) ]
     if a:
         k = a[0]
-        raise TypeError, "'hq[%d]' has size (%d,%d).  Expected size "\
-            "is (%d,1)." %(k, hq[k].size[0], hq[k].size[1], mq[k]) 
+        raise TypeError("'hq[%d]' has size (%d,%d).  Expected size "\
+            "is (%d,1)." %(k, hq[k].size[0], hq[k].size[1], mq[k]))
 
     if A is None: A = spmatrix([], [], [], (0,n), 'd')
     if (type(A) is not matrix and type(A) is not spmatrix) or \
         A.typecode != 'd' or A.size[1] != n:
-        raise TypeError, "'A' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
+        raise TypeError("'A' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     p = A.size[0]
     if b is None: b = matrix(0.0, (0,1))
     if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
-        raise TypeError, "'b' must be a dense matrix of size (%d,1)" %p
+        raise TypeError("'b' must be a dense matrix of size (%d,1)" %p)
 
     dims = {'l': ml, 'q': mq, 's': []}
     N = ml + sum(mq)
@@ -3345,25 +3344,25 @@ def socp(c, Gl = None, hl = None, Gq = None, hq = None, A = None, b = None,
     if solver == 'mosek':
         from cvxopt import misc
         try: 
-            from cvxopt import mosek
-            import pymosek as msk
+            from cvxopt import msk
+            import mosek
         except ImportError: 
-            raise ValueError, "invalid option (solver = 'mosek'): "\
-                "cvxopt.mosek is not installed" 
+            raise ValueError("invalid option (solver = 'mosek'): "\
+                "cvxopt.mosek is not installed")
         if 'MOSEK' in options:
-            mosek.options = options['MOSEK']
+            msk.options = options['MOSEK']
         else:
-            mosek.options = {}
-        if p: raise ValueError, "socp() with the solver = 'socp' option "\
-            "does not handle problems with equality constraints"
+            msk.options = {}
+        if p: raise ValueError("socp() with the solver = 'socp' option "\
+            "does not handle problems with equality constraints")
 
-        solsta, x, zl, zq  = mosek.socp(c, Gl, hl, Gq, hq)
+        solsta, x, zl, zq  = msk.socp(c, Gl, hl, Gq, hq)
 
         resx0 = max(1.0, blas.nrm2(c))
         rh = matrix([ blas.nrm2(hl) ] + [ blas.nrm2(hqk) for hqk in hq ])
         resz0 = max(1.0, blas.nrm2(rh))
 
-        if solsta is msk.solsta.optimal:
+        if solsta is mosek.solsta.optimal:
             status = 'optimal'
             y = matrix(0.0, (0,1))
             pcost = blas.dot(c,x)
@@ -3419,7 +3418,7 @@ def socp(c, Gl = None, hl = None, Gq = None, hq = None, A = None, b = None,
             pres, dres = resz, resx
             pinfres, dinfres = None, None
 
-        elif solsta is msk.solsta.prim_infeas_cer:
+        elif solsta is mosek.solsta.dual_infeas_cer:
             status = 'primal infeasible'
             y = matrix(0.0, (0,1))
             hz = blas.dot(hl, zl) + sum([blas.dot(hq[k],zq[k]) for k 
@@ -3452,7 +3451,7 @@ def socp(c, Gl = None, hl = None, Gq = None, hq = None, A = None, b = None,
             pcost, dcost = None, 1.0
             gap, relgap = None, None
 
-        elif solsta == msk.solsta.dual_infeas_cer:
+        elif solsta == mosek.solsta.prim_infeas_cer:
             status = 'dual infeasible'
             cx = blas.dot(c,x)
 
@@ -3499,7 +3498,7 @@ def socp(c, Gl = None, hl = None, Gq = None, hq = None, A = None, b = None,
             pinfres, dinfres = None, None
             pslack, dslack = None, None
 
-        print status
+        print(status)
 
         return {'status': status, 'x': x, 'sl': sl, 'sq': sq, 'y': y, 
             'zl': zl, 'zq': zq, 'primal objective': pcost, 
@@ -3856,63 +3855,63 @@ def sdp(c, Gl = None, hl = None, Gs = None, hs = None, A = None, b = None,
     from cvxopt.base import matrix, spmatrix
 
     if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
-        raise TypeError, "'c' must be a dense column matrix"
+        raise TypeError("'c' must be a dense column matrix")
     n = c.size[0]
-    if n < 1: raise ValueError, "number of variables must be at least 1"
+    if n < 1: raise ValueError("number of variables must be at least 1")
 
     if Gl is None: Gl = spmatrix([], [], [], (0,n), tc='d')
     if (type(Gl) is not matrix and type(Gl) is not spmatrix) or \
         Gl.typecode != 'd' or Gl.size[1] != n:
-        raise TypeError, "'Gl' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
+        raise TypeError("'Gl' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     ml = Gl.size[0]
     if hl is None: hl = matrix(0.0, (0,1))
     if type(hl) is not matrix or hl.typecode != 'd' or \
         hl.size != (ml,1):
-        raise TypeError, "'hl' must be a 'd' matrix of size (%d,1)" %ml
+        raise TypeError("'hl' must be a 'd' matrix of size (%d,1)" %ml)
 
     if Gs is None: Gs = []
     if type(Gs) is not list or [ G for G in Gs if (type(G) is not matrix 
         and type(G) is not spmatrix) or G.typecode != 'd' or 
         G.size[1] != n ]:
-        raise TypeError, "'Gs' must be a list of sparse or dense 'd' "\
-            "matrices with %d columns" %n 
+        raise TypeError("'Gs' must be a list of sparse or dense 'd' "\
+            "matrices with %d columns" %n)
     ms = [ int(math.sqrt(G.size[0])) for G in Gs ]
     a = [ k for k in xrange(len(ms)) if ms[k]**2 != Gs[k].size[0] ]
-    if a: raise TypeError, "the squareroot of the number of rows in "\
-        "'Gs[%d]' is not an integer" %k
+    if a: raise TypeError("the squareroot of the number of rows in "\
+        "'Gs[%d]' is not an integer" %k)
     if hs is None: hs = []
     if type(hs) is not list or len(hs) != len(ms) or [ h for h in hs if
         (type(h) is not matrix and type(h) is not spmatrix) or
         h.typecode != 'd' ]:
-        raise TypeError, "'hs' must be a list of %d dense or sparse "\
-            "'d' matrices" %len(ms)
+        raise TypeError("'hs' must be a list of %d dense or sparse "\
+            "'d' matrices" %len(ms))
     a = [ k for k in xrange(len(ms)) if hs[k].size != (ms[k],ms[k]) ]
     if a:
         k = a[0]
-        raise TypeError, "hs[%d] has size (%d,%d).  Expected size is "\
-            "(%d,%d)." %(k,hs[k].size[0], hs[k].size[1], ms[k], ms[k])
+        raise TypeError("hs[%d] has size (%d,%d).  Expected size is "\
+            "(%d,%d)." %(k,hs[k].size[0], hs[k].size[1], ms[k], ms[k]))
 
     if A is None: A = spmatrix([], [], [], (0,n), 'd')
     if (type(A) is not matrix and type(A) is not spmatrix) or \
         A.typecode != 'd' or A.size[1] != n:
-        raise TypeError, "'A' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
+        raise TypeError("'A' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     p = A.size[0]
     if b is None: b = matrix(0.0, (0,1))
     if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
-        raise TypeError, "'b' must be a dense matrix of size (%d,1)" %p
+        raise TypeError("'b' must be a dense matrix of size (%d,1)" %p)
 
     dims = {'l': ml, 'q': [], 's': ms}
     N = ml + sum([ m**2 for m in ms ])
 
     if solver == 'dsdp':
         try: from cvxopt import dsdp
-        except ImportError: raise ValueError, "invalid option "\
-            "(solver = 'dsdp'): cvxopt.dsdp is not installed"
+        except ImportError: raise ValueError("invalid option "\
+            "(solver = 'dsdp'): cvxopt.dsdp is not installed")
         dsdp.options = options
-        if p: raise ValueError, "sdp() with the solver = 'dsdp' option "\
-            "does not handle problems with equality constraints"
+        if p: raise ValueError("sdp() with the solver = 'dsdp' option "\
+            "does not handle problems with equality constraints")
         dsdpstatus, x, r, zl, zs = dsdp.sdp(c, Gl, hl, Gs, hs)
 
         resx0 = max(1.0, blas.nrm2(c))
@@ -4355,16 +4354,16 @@ def qp(P, q, G = None, h = None, A = None, b = None, solver = None,
     if solver == 'mosek':
         from cvxopt import misc
         try: 
-            from cvxopt import mosek
-            import pymosek 
-        except ImportError: raise ValueError, "invalid option "\
-            "(solver='mosek'): cvxopt.mosek is not installed" 
+            from cvxopt import msk
+            import mosek 
+        except ImportError: raise ValueError("invalid option "\
+            "(solver='mosek'): cvxopt.msk is not installed")
 
         if 'MOSEK' in options:
-            mosek.options = options['MOSEK']
+            msk.options = options['MOSEK']
         else:
-            mosek.options = {}
-        solsta, x, z, y = mosek.qp(P, q, G, h, A, b)
+            msk.options = {}
+        solsta, x, z, y = msk.qp(P, q, G, h, A, b)
 
         n = q.size[0]
         if G is None: G = spmatrix([], [], [], (0,n), 'd')
@@ -4377,7 +4376,7 @@ def qp(P, q, G = None, h = None, A = None, b = None, solver = None,
         resy0 = max(1.0, blas.nrm2(b))
         resz0 = max(1.0, blas.nrm2(h))
 
-        if solsta == pymosek.solsta.optimal:
+        if solsta == mosek.solsta.optimal:
             status = 'optimal'
 
             s = matrix(h)
@@ -4420,7 +4419,7 @@ def qp(P, q, G = None, h = None, A = None, b = None, solver = None,
             pres, dres = max(resy, resz), resx
             pinfres, dinfres = None, None
 
-        elif solsta == pymosek.solsta.prim_infeas_cer:
+        elif solsta == mosek.solsta.prim_infeas_cer:
             status = 'primal infeasible'
 
             hz, by = blas.dot(h, z),  blas.dot(b, y)
@@ -4443,7 +4442,7 @@ def qp(P, q, G = None, h = None, A = None, b = None, solver = None,
             dslack = -misc.max_step(z, dims)
             pslack = None
 
-        elif solsta == pymosek.solsta.dual_infeas_cer:
+        elif solsta == mosek.solsta.dual_infeas_cer:
             status = 'dual infeasible'
             qx = blas.dot(q,x)
             blas.scal(-1.0/qx, x)
diff --git a/src/python/cvxprog.py b/src/python/cvxprog.py
index af50805..310986f 100644
--- a/src/python/cvxprog.py
+++ b/src/python/cvxprog.py
@@ -6,9 +6,10 @@ for quadratic and geometric programming.  Also includes an interface
 to the quadratic programming solver from MOSEK.
 """
 
+# Copyright 2010 L. Vandenberghe.
 # Copyright 2004-2009 J. Dahl and L. Vandenberghe.
 # 
-# This file is part of CVXOPT version 1.1.2.
+# This file is part of CVXOPT version 1.1.3.
 #
 # CVXOPT is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -390,32 +391,32 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
     except KeyError: MAXITERS = 100
     else: 
         if type(MAXITERS) is not int or MAXITERS < 1: 
-            raise ValueError, "options['maxiters'] must be a positive "\
-                "integer"
+            raise ValueError("options['maxiters'] must be a positive "\
+                "integer")
 
     try: ABSTOL = options['abstol']
     except KeyError: ABSTOL = 1e-7
     else: 
         if type(ABSTOL) is not float and type(ABSTOL) is not int: 
-            raise ValueError, "options['abstol'] must be a scalar"
+            raise ValueError("options['abstol'] must be a scalar")
 
     try: RELTOL = options['reltol']
     except KeyError: RELTOL = 1e-6
     else: 
         if type(RELTOL) is not float and type(RELTOL) is not int: 
-            raise ValueError, "options['reltol'] must be a scalar"
+            raise ValueError("options['reltol'] must be a scalar")
 
     try: FEASTOL = options['feastol']
     except KeyError: FEASTOL = 1e-7
     else: 
         if (type(FEASTOL) is not float and type(FEASTOL) is not int) or \
             FEASTOL <= 0.0: 
-            raise ValueError, "options['feastol'] must be a positive "\
-                "scalar"
+            raise ValueError("options['feastol'] must be a positive "\
+                "scalar")
 
     if RELTOL <= 0.0 and ABSTOL <= 0.0:
-        raise ValueError, "at least one of options['reltol'] and " \
-            "options['abstol'] must be positive"
+        raise ValueError("at least one of options['reltol'] and " \
+            "options['abstol'] must be positive")
 
     try: show_progress = options['show_progress']
     except KeyError: show_progress = True
@@ -424,8 +425,8 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
     except KeyError: refinement = 1
     else:
         if type(refinement) is not int or refinement < 0:
-            raise ValueError, "options['refinement'] must be a "\
-                "nonnegative integer"
+            raise ValueError("options['refinement'] must be a "\
+                "nonnegative integer")
 
     if kktsolver is None: 
         if dims and (dims['q'] or dims['s']):  
@@ -434,40 +435,40 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
             kktsolver = 'chol2'            
     defaultsolvers = ('ldl', 'ldl2', 'chol', 'chol2')
     if type(kktsolver) is str and kktsolver not in defaultsolvers:
-        raise ValueError, "'%s' is not a valid value for kktsolver" \
-            %kktsolver
+        raise ValueError("'%s' is not a valid value for kktsolver" \
+            %kktsolver)
 
     try: mnl, x0 = F()   
-    except: raise ValueError, "function call 'F()' failed"
+    except: raise ValueError("function call 'F()' failed")
     
     # Argument error checking depends on level of customization.
     customkkt = type(kktsolver) is not str
     operatorG = G is not None and type(G) not in (matrix, spmatrix)
     operatorA = A is not None and type(A) not in (matrix, spmatrix)
     if (operatorG or operatorA) and not customkkt:
-        raise ValueError, "use of function valued G, A requires a "\
-            "user-provided kktsolver"
+        raise ValueError("use of function valued G, A requires a "\
+            "user-provided kktsolver")
     customx = (xnewcopy != None or xdot != None or xaxpy != None or 
         xscal != None)
     if customx and (not operatorG or not operatorA or not customkkt):
-        raise ValueError, "use of non-vector type for x requires "\
-            "function valued G, A and user-provided kktsolver"
+        raise ValueError("use of non-vector type for x requires "\
+            "function valued G, A and user-provided kktsolver")
     customy = (ynewcopy != None or ydot != None or yaxpy != None or 
         yscal != None) 
     if customy and (not operatorA or not customkkt):
-        raise ValueError, "use of non vector type for y requires "\
-            "function valued A and user-provided kktsolver"
+        raise ValueError("use of non vector type for y requires "\
+            "function valued A and user-provided kktsolver")
 
     if not customx:  
         if type(x0) is not matrix or x0.typecode != 'd' or x0.size[1] != 1:
-            raise TypeError, "'x0' must be a 'd' matrix with one column"
+            raise TypeError("'x0' must be a 'd' matrix with one column")
         if type(c) is not matrix or c.typecode != 'd' or c.size != x0.size:
-            raise TypeError, "'c' must be a 'd' matrix of size (%d,%d)"\
-                %(x0.size[0],1)
+            raise TypeError("'c' must be a 'd' matrix of size (%d,%d)"\
+                %(x0.size[0],1))
         
     if h is None: h = matrix(0.0, (0,1))
     if type(h) is not matrix or h.typecode != 'd' or h.size[1] != 1:
-        raise TypeError, "'h' must be a 'd' matrix with 1 column" 
+        raise TypeError("'h' must be a 'd' matrix with 1 column")
 
     if not dims:  dims = {'l': h.size[0], 'q': [], 's': []}
 
@@ -475,7 +476,7 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
     # components unpacked.
     cdim = dims['l'] + sum(dims['q']) + sum([ k**2 for k in dims['s'] ])
     if h.size[0] != cdim:
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %cdim
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %cdim)
 
     if G is None:
         if customx:
@@ -486,8 +487,8 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
             G = spmatrix([], [], [], (0, c.size[0]))
     if not operatorG:
         if G.typecode != 'd' or G.size != (cdim, c.size[0]):
-            raise TypeError, "'G' must be a 'd' matrix with size (%d, %d)"\
-                %(cdim, c.size[0])
+            raise TypeError("'G' must be a 'd' matrix with size (%d, %d)"\
+                %(cdim, c.size[0]))
         def fG(x, y, trans = 'N', alpha = 1.0, beta = 0.0):
             misc.sgemv(G, x, y, dims, trans = trans, alpha = alpha, 
                 beta = beta)
@@ -503,8 +504,8 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
             A = spmatrix([], [], [], (0, c.size[0]))
     if not operatorA:
         if A.typecode != 'd' or A.size[1] != c.size[0]:
-            raise TypeError, "'A' must be a 'd' matrix with %d columns" \
-                %c.size[0]
+            raise TypeError("'A' must be a 'd' matrix with %d columns" \
+                %c.size[0])
         def fA(x, y, trans = 'N', alpha = 1.0, beta = 0.0):
             base.gemv(A, x, y, trans = trans, alpha = alpha, beta = beta)
     else:
@@ -512,11 +513,11 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
     if not customy:
         if b is None: b = matrix(0.0, (0,1))
         if type(b) is not matrix or b.typecode != 'd' or b.size[1] != 1:
-            raise TypeError, "'b' must be a 'd' matrix with one column"
+            raise TypeError("'b' must be a 'd' matrix with one column")
         if not operatorA and b.size[0] != A.size[0]:
-            raise TypeError, "'b' must have length %d" %A.size[0]
+            raise TypeError("'b' must have length %d" %A.size[0])
     if b is None and customy:  
-        raise ValueEror, "use of non vector type for y requires b"
+        raise ValueEror("use of non vector type for y requires b")
 
    
     # kktsolver(x, z, W) returns a routine for solving
@@ -619,8 +620,9 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
     
 
     if show_progress: 
-        print "% 10s% 12s% 10s% 8s% 7s" %("pcost", "dcost", "gap", "pres",
-            "dres")
+        print("% 10s% 12s% 10s% 8s% 7s" %("pcost", "dcost", "gap", "pres",
+            "dres"))
+
 
     relaxed_iters = 0
     for iters in xrange(MAXITERS + 1):  
@@ -633,38 +635,38 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
        
         f = matrix(f, tc='d')
         if f.typecode != 'd' or f.size != (mnl, 1):
-            raise TypeError, "first output argument of F() must be a "\
-                "'d' matrix of size (%d, %d)" %(mnl, 1)
+            raise TypeError("first output argument of F() must be a "\
+                "'d' matrix of size (%d, %d)" %(mnl, 1))
 
         if type(Df) is matrix or type(Df) is spmatrix:
-            if customx: raise ValueError, "use of non-vector type for x "\
-                "requires function valued Df"
+            if customx: raise ValueError("use of non-vector type for x "\
+                "requires function valued Df")
             if Df.typecode != 'd' or Df.size != (mnl, c.size[0]):
-                raise TypeError, "second output argument of F() must "\
-                    "be a 'd' matrix of size (%d,%d)" %(mnl, c.size[0])
+                raise TypeError("second output argument of F() must "\
+                    "be a 'd' matrix of size (%d,%d)" %(mnl, c.size[0]))
             def fDf(u, v, alpha = 1.0, beta = 0.0, trans = 'N'): 
                 base.gemv(Df, u, v, alpha = alpha, beta = beta, trans = 
                     trans)
         else: 
             if not customkkt:
-                raise ValueError, "use of function valued Df requires "\
-                    "a user-provided kktsolver"
+                raise ValueError("use of function valued Df requires "\
+                    "a user-provided kktsolver")
             fDf = Df
 
         if refinement or DEBUG:
             if type(H) is matrix or type(H) is spmatrix:
-                if customx: raise ValueError, "use of non-vector type "\
-                    "for  x requires function valued H"
+                if customx: raise ValueError("use of non-vector type "\
+                    "for  x requires function valued H")
                 if H.typecode != 'd' or H.size != (c.size[0], c.size[0]):
-                    raise TypeError, "third output argument of F() must "\
+                    raise TypeError("third output argument of F() must "\
                         "be a 'd' matrix of size (%d,%d)" \
-                        %(c.size[0], c.size[0])
+                        %(c.size[0], c.size[0]))
                 def fH(u, v, alpha = 1.0, beta = 0.0): 
                     base.symv(H, u, v, alpha = alpha, beta = beta)
             else: 
                 if not customkkt:
-                    raise ValueError, "use of function valued H requires "\
-                        "a user-provided kktsolver"
+                    raise ValueError("use of function valued H requires "\
+                        "a user-provided kktsolver")
                 fH = H
            
 
@@ -725,8 +727,8 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
         dres = dres / dres0
 
         if show_progress:
-            print "%2d: % 8.4e % 8.4e % 4.0e% 7.0e% 7.0e" \
-                %(iters, pcost, dcost, gap, pres, dres) 
+            print("%2d: % 8.4e % 8.4e % 4.0e% 7.0e% 7.0e" \
+                %(iters, pcost, dcost, gap, pres, dres))
 
         # Stopping criteria.    
         if ( pres <= FEASTOL and dres <= FEASTOL and ( gap <= ABSTOL or 
@@ -742,12 +744,12 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
             tz = misc.max_step(z, dims, mnl)
             if iters == MAXITERS:
                 if show_progress:
-                    print "Terminated (maximum number of iterations "\
-                        "reached)."
+                    print("Terminated (maximum number of iterations "\
+                        "reached).")
                 status = 'unknown'
             else:
                 if show_progress:
-                    print "Optimal solution found."
+                    print("Optimal solution found.")
                 status = 'optimal'
 
             return {'status': status, 'x': x,  'y': y, 'znl': z[:mnl],  
@@ -782,8 +784,8 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
         except ArithmeticError: 
             singular_kkt_matrix = False
             if iters == 0:
-                raise ValueError, "Rank(A) < p or "\
-                    "Rank([H(x); A; Df(x); G]) < n"
+                raise ValueError("Rank(A) < p or "\
+                    "Rank([H(x); A; Df(x); G]) < n")
 
             elif 0 < relaxed_iters < MAX_RELAXED_ITERS > 0:
                 # The arithmetic error may be caused by a relaxed line 
@@ -832,7 +834,7 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
                 ts = misc.max_step(s, dims, mnl)
                 tz = misc.max_step(z, dims, mnl)
                 if show_progress:
-                    print "Terminated (singular KKT matrix)."
+                    print("Terminated (singular KKT matrix).")
                 status = 'unknown'
                 return {'status': status, 'x': x,  'y': y, 
                     'znl': z[:mnl],  'zl': zl, 'snl': s[:mnl], 
@@ -959,11 +961,11 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
                 blas.axpy(ws2, s)
             if DEBUG:
                 res(x, y, z, s, wx, wy, wz, ws)
-                print "KKT residuals:"
-                print "    'x': %e" %math.sqrt(xdot(wx, wx)) 
-                print "    'y': %e" %math.sqrt(ydot(wy, wy))
-                print "    'z': %e" %misc.snrm2(wz, dims, mnl)
-                print "    's': %e" %misc.snrm2(ws, dims, mnl)
+                print("KKT residuals:")
+                print("    'x': %e" %math.sqrt(xdot(wx, wx)))
+                print("    'y': %e" %math.sqrt(ydot(wy, wy)))
+                print("    'z': %e" %misc.snrm2(wz, dims, mnl))
+                print("    's': %e" %misc.snrm2(ws, dims, mnl))
      
 
         sigma, eta = 0.0, 0.0
@@ -1007,8 +1009,8 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
             try: f4(dx, dy, dz, ds)
             except ArithmeticError: 
                 if iters == 0:
-                    raise ValueError, "Rank(A) < p or "\
-                        "Rank([H(x); A; Df(x); G]) < n"
+                    raise ValueError("Rank(A) < p or "\
+                        "Rank([H(x); A; Df(x); G]) < n")
                 else:
                     sl, zl = s[mnl:], z[mnl:]
                     ind = dims['l'] + sum(dims['q'])
@@ -1019,7 +1021,7 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
                     ts = misc.max_step(s, dims, mnl)
                     tz = misc.max_step(z, dims, mnl)
                     if show_progress:
-                        print "Terminated (singular KKT matrix)."
+                        print("Terminated (singular KKT matrix).")
                     return {'status': 'unknown', 'x': x,  'y': y, 
                         'znl': z[:mnl],  'zl': zl, 'snl': s[:mnl], 
                         'sl': sl, 'gap': gap, 'relative gap': relgap, 
@@ -1137,9 +1139,9 @@ def cpl(c, F, G = None, h = None, dims = None, A = None, b = None,
                 if type(newDf) is matrix or type(Df) is spmatrix:
                     if newDf.typecode != 'd' or \
                         newDf.size != (mnl, c.size[0]):
-                            raise TypeError, "second output argument "\
+                            raise TypeError("second output argument "\
                                 "of F() must be a 'd' matrix of size "\
-                                "(%d,%d)" %(mnl, c.size[0])
+                                "(%d,%d)" %(mnl, c.size[0]))
                     def newfDf(u, v, alpha = 1.0, beta = 0.0, trans = 'N'):
                         base.gemv(newDf, u, v, alpha = alpha, beta = 
                                 beta, trans = trans)
@@ -1663,33 +1665,33 @@ def cp(F, G = None, h = None, dims = None, A = None, b = None,
     operatorG = G is not None and type(G) not in (matrix, spmatrix)
     operatorA = A is not None and type(A) not in (matrix, spmatrix)
     if (operatorG or operatorA) and not customkkt:
-        raise ValueError, "use of function valued G, A requires a "\
-            "user-provided kktsolver"
+        raise ValueError("use of function valued G, A requires a "\
+            "user-provided kktsolver")
     customx = (xnewcopy != None or xdot != None or xaxpy != None or
         xscal != None)
     if customx and (not operatorG or not operatorA or not customkkt):
-        raise ValueError, "use of non-vector type for x requires "\
-            "function valued G, A and user-provided kktsolver"
+        raise ValueError("use of non-vector type for x requires "\
+            "function valued G, A and user-provided kktsolver")
     customy = (ynewcopy != None or ydot != None or yaxpy != None or 
         yscal != None)
     if customy and (not operatorA or not customkkt):
-        raise ValueError, "use of non vector type for y requires "\
-            "function valued A and user-provided kktsolver"
+        raise ValueError("use of non vector type for y requires "\
+            "function valued A and user-provided kktsolver")
 
     if not customx:  
         if type(x0) is not matrix or x0.typecode != 'd' or x0.size[1] != 1:
-            raise TypeError, "'x0' must be a 'd' matrix with one column"
+            raise TypeError("'x0' must be a 'd' matrix with one column")
         
     if h is None: h = matrix(0.0, (0,1))
     if type(h) is not matrix or h.typecode != 'd' or h.size[1] != 1:
-        raise TypeError, "'h' must be a 'd' matrix with one column" 
+        raise TypeError("'h' must be a 'd' matrix with one column")
     if not dims: dims = {'l': h.size[0], 'q': [], 's': []}
 
     # Dimension of the product cone of the linear inequalities. with 's' 
     # components unpacked.
     cdim = dims['l'] + sum(dims['q']) + sum([ k**2 for k in dims['s'] ])
     if h.size[0] != cdim:
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %cdim
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %cdim)
 
     if G is None:
         if customx:
@@ -1700,8 +1702,8 @@ def cp(F, G = None, h = None, dims = None, A = None, b = None,
             G = spmatrix([], [], [], (0, x0.size[0]))
     if type(G) is matrix or type(G) is spmatrix:
         if G.typecode != 'd' or G.size != (cdim, x0.size[0]):
-            raise TypeError, "'G' must be a 'd' matrix with size (%d, %d)"\
-                %(cdim, x0.size[0])
+            raise TypeError("'G' must be a 'd' matrix with size (%d, %d)"\
+                %(cdim, x0.size[0]))
         def fG(x, y, trans = 'N', alpha = 1.0, beta = 0.0):
             misc.sgemv(G, x, y, dims, trans = trans, alpha = alpha, 
                 beta = beta)
@@ -1717,8 +1719,8 @@ def cp(F, G = None, h = None, dims = None, A = None, b = None,
             A = spmatrix([], [], [], (0, x0.size[0]))
     if type(A) is matrix or type(A) is spmatrix:
         if A.typecode != 'd' or A.size[1] != x0.size[0]:
-            raise TypeError, "'A' must be a 'd' matrix with %d columns" \
-                %x0.size[0]
+            raise TypeError("'A' must be a 'd' matrix with %d columns" \
+                %x0.size[0])
         def fA(x, y, trans = 'N', alpha = 1.0, beta = 0.0):
             base.gemv(A, x, y, trans = trans, alpha = alpha, beta = beta)
     else:
@@ -1726,11 +1728,11 @@ def cp(F, G = None, h = None, dims = None, A = None, b = None,
     if not customy:
         if b is None: b = matrix(0.0, (0,1))
         if type(b) is not matrix or b.typecode != 'd' or b.size[1] != 1:
-            raise TypeError, "'b' must be a 'd' matrix with one column"
+            raise TypeError("'b' must be a 'd' matrix with one column")
         if not operatorA and b.size[0] != A.size[0]:
-            raise TypeError, "'b' must have length %d" %A.size[0]
+            raise TypeError("'b' must have length %d" %A.size[0])
     if b is None and customy:  
-        raise ValueEror, "use of non vector type for y requires b"
+        raise ValueEror("use of non vector type for y requires b")
 
 
     if xnewcopy is None: xnewcopy = matrix 
@@ -2057,41 +2059,41 @@ def gp(K, F, g, G=None, h=None, A=None, b=None):
 
     if type(K) is not list or [ k for k in K if type(k) is not int 
         or k <= 0 ]:
-        raise TypeError, "'K' must be a list of positive integers" 
+        raise TypeError("'K' must be a list of positive integers")
     mnl = len(K)-1
     l = sum(K)
 
     if type(F) not in (matrix, spmatrix) or F.typecode != 'd' or \
         F.size[0] != l:
-        raise TypeError, "'F' must be a dense or sparse 'd' matrix "\
-            "with %d rows" %l
+        raise TypeError("'F' must be a dense or sparse 'd' matrix "\
+            "with %d rows" %l)
     if type(g) is not matrix or g.typecode != 'd' or g.size != (l,1): 
-        raise TypeError, "'g' must be a dene 'd' matrix of "\
-            "size (%d,1)" %l
+        raise TypeError("'g' must be a dene 'd' matrix of "\
+            "size (%d,1)" %l)
     n = F.size[1]
 
     if G is None: G = spmatrix([], [], [], (0,n))
     if h is None: h = matrix(0.0, (0,1))
     if type(G) not in (matrix, spmatrix) or G.typecode != 'd' or \
         G.size[1] != n:
-        raise TypeError, "'G' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n 
+        raise TypeError("'G' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     ml = G.size[0]
     if type(h) is not matrix or h.typecode != 'd' or h.size != (ml,1):
-        raise TypeError, "'h' must be a dense 'd' matrix of "\
-            "size (%d,1)" %ml
+        raise TypeError("'h' must be a dense 'd' matrix of "\
+            "size (%d,1)" %ml)
     dims = {'l': ml, 's': [], 'q': []}
 
     if A is None: A = spmatrix([], [], [], (0,n))
     if b is None: b = matrix(0.0, (0,1))
     if type(A) not in (matrix, spmatrix) or A.typecode != 'd' or \
         A.size[1] != n:
-        raise TypeError, "'A' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
+        raise TypeError("'A' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
     p = A.size[0]
     if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
-        raise TypeError, "'b' must be a dense 'd' matrix of "\
-            "size (%d,1)" %p
+        raise TypeError("'b' must be a dense 'd' matrix of "\
+            "size (%d,1)" %p)
 
     y = matrix(0.0, (l,1))
     u = matrix(0.0, (max(K),1))
diff --git a/src/python/info.py b/src/python/info.py
index 5885350..78c7919 100644
--- a/src/python/info.py
+++ b/src/python/info.py
@@ -1,8 +1,10 @@
-version = '1.1.2'
+version = '1.1.3'
 
 def license(): print(
 """
-CVXOPT version 1.1.2  Copyright (c) 2004-2009 J. Dahl and L. Vandenberghe.
+CVXOPT version 1.1.3. 
+Copyright (c) 2010 L. Vandenberghe.
+Copyright (c) 2004-2009 J. Dahl and L. Vandenberghe.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/src/python/misc.py b/src/python/misc.py
index a0fda62..8cac4fb 100644
--- a/src/python/misc.py
+++ b/src/python/misc.py
@@ -1,6 +1,7 @@
+# Copyright 2010 L. Vandenberghe.
 # Copyright 2004-2009 J. Dahl and L. Vandenberghe.
 # 
-# This file is part of CVXOPT version 1.1.2.
+# This file is part of CVXOPT version 1.1.3.
 #
 # CVXOPT is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -736,19 +737,19 @@ def sdot2(x, y):
 
     a = 0.0
     if type(x) is matrix:
-	n = x.size[0]
-	a += blas.dot(x, y, incx=n+1, incy=n+1, n=n)
-	for j in xrange(1,n):
-	    a += 2.0 * blas.dot(x, y, incx=n+1, incy=n+1, offsetx=j,
-		offsety=j, n=n-j)
+        n = x.size[0]
+        a += blas.dot(x, y, incx=n+1, incy=n+1, n=n)
+        for j in xrange(1,n):
+            a += 2.0 * blas.dot(x, y, incx=n+1, incy=n+1, offsetx=j,
+                offsety=j, n=n-j)
 
     else:
-	for k in xrange(len(x)):
-	    n = x[k].size[0]
-	    a += blas.dot(x[k], y[k], incx=n+1, incy=n+1, n=n)
-	    for j in xrange(1,n):
-		a += 2.0 * blas.dot(x[k], y[k], incx=n+1, incy=n+1, 
-		    offsetx=j, offsety=j, n=n-j)
+        for k in xrange(len(x)):
+            n = x[k].size[0]
+            a += blas.dot(x[k], y[k], incx=n+1, incy=n+1, n=n)
+            for j in xrange(1,n):
+                a += 2.0 * blas.dot(x[k], y[k], incx=n+1, incy=n+1, 
+                    offsetx=j, offsety=j, n=n-j)
     return a
 
 
@@ -805,7 +806,7 @@ def sgemv(A, x, y, dims, trans = 'N', alpha = 1.0, beta = 0.0, n = None,
     
         N = dims['l'] + sum(dims['q']) + sum( k**2 for k in dims['s'] ) 
 
-    representing a method from R^n to S.  
+    representing a mapping from R^n to S.  
     
     If trans is 'N': 
     
@@ -836,8 +837,8 @@ def jdot(x, y, n = None, offsetx = 0, offsety = 0):
     """
 
     if n is None: 
-        if len(x) != len(y): raise ValueError, "x and y must have the "\
-             "same length"
+        if len(x) != len(y): raise ValueError("x and y must have the "\
+             "same length")
         n = len(x)
     return x[offsetx] * y[offsety] - blas.dot(x, y, n = n-1, 
         offsetx = offsetx + 1, offsety = offsety + 1) 
@@ -1374,9 +1375,9 @@ def kkt_chol2(G, dims, A, mnl = 0):
     """
 
     if dims['q'] or dims['s']:
-        raise ValueError, "kktsolver option 'kkt_chol2' is implemented "\
+        raise ValueError("kktsolver option 'kkt_chol2' is implemented "\
             "only for problems with no second-order or semidefinite cone "\
-            "constraints"
+            "constraints")
     p, n = A.size
     ml = dims['l']
     F = {'firstcall': True, 'singular': False}
diff --git a/src/python/modeling.py b/src/python/modeling.py
index 7089bf0..75f270b 100644
--- a/src/python/modeling.py
+++ b/src/python/modeling.py
@@ -5,9 +5,10 @@ Routines for specifying and solving convex optimization problems with
 piecewise-linear objective and constraint functions.
 """
 
+# Copyright 2010 L. Vandenberghe.
 # Copyright 2004-2009 J. Dahl and L. Vandenberghe.
 # 
-# This file is part of CVXOPT version 1.1.2
+# This file is part of CVXOPT version 1.1.3.
 #
 # CVXOPT is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -57,7 +58,7 @@ class variable(object):
         if type(size) is int and size > 0: 
             self._size = size
         else: 
-            raise TypeError, "size must be a positive integer"
+            raise TypeError("size must be a positive integer")
 
 
     def __len__(self):
@@ -94,23 +95,23 @@ class variable(object):
                     matrix(value, (len(self),1), tc='d'))
 
             else:
-                raise AttributeError, "invalid type or size for "\
-                    "attribute 'value'"
+                raise AttributeError("invalid type or size for "\
+                    "attribute 'value'")
 
         elif name == 'name':
             if type(value) is str:
                 object.__setattr__(self,name,value)
 
             else:
-                raise AttributeError, "invalid type for attribute "\
-                    "'name'"
+                raise AttributeError("invalid type for attribute "\
+                    "'name'")
 
         elif name == '_size':
             object.__setattr__(self,name,value)
 
         else:
-            raise AttributeError, "'variable' object has no attribute "\
-                "'%s'" %name
+            raise AttributeError("'variable' object has no attribute "\
+                "'%s'" %name)
 
 
     def __pos__(self):
@@ -144,8 +145,8 @@ class variable(object):
 
     def __iadd__(self,other):
 
-        raise NotImplementedError, "in-place addition not implemented"\
-            " for 'variable' objects"
+        raise NotImplementedError("in-place addition not implemented"\
+            " for 'variable' objects")
 
 
     def __sub__(self,other):
@@ -160,8 +161,8 @@ class variable(object):
 
     def __isub__(self,other):
 
-        raise NotImplementedError, "in-place subtraction not "\
-            "implemented for 'variable' objects"
+        raise NotImplementedError("in-place subtraction not "\
+            "implemented for 'variable' objects")
 
 
     def __mul__(self,other):
@@ -176,8 +177,8 @@ class variable(object):
 
     def __imul__(self,other):
 
-        raise NotImplementedError, "in-place multiplication not "\
-            "implemented for 'variable' objects"
+        raise NotImplementedError("in-place multiplication not "\
+            "implemented for 'variable' objects")
 
 
     def __div__(self,other):
@@ -187,8 +188,8 @@ class variable(object):
 
     def __idiv__(self,other):
 
-        raise NotImplementedError, "in-place division not implemented "\
-            "for 'variable' objects"
+        raise NotImplementedError("in-place division not implemented "\
+            "for 'variable' objects")
 
 
     def __eq__(self,other):
@@ -444,14 +445,14 @@ class _function(object):
             other = matrix(other, tc='d')
         elif _ismatrix(other):  # ie, dense 'd' or sparse
             if other.size[1] != 1:
-                raise ValueError, 'incompatible dimensions'
+                raise ValueError('incompatible dimensions')
         elif type(other) is variable:
             other = +other
         elif type(other) is not _function:
             return NotImplemented
 
         if 1 != len(self) != len(other) != 1: 
-            raise ValueError, 'incompatible lengths'
+            raise ValueError('incompatible lengths')
 
         f = _function()
 
@@ -465,8 +466,8 @@ class _function(object):
         else:  #type(other) is _function:
             if not (self._isconvex() and other._isconvex()) and \
                 not (self._isconcave() and other._isconcave()):
-                raise ValueError, 'operands must be both convex or '\
-                    'both concave'
+                raise ValueError('operands must be both convex or '\
+                    'both concave')
 
             f._constant = self._constant + other._constant
             f._linear = self._linear + other._linear
@@ -490,14 +491,14 @@ class _function(object):
             other = matrix(other, tc='d')
         elif _ismatrix(other):
             if other.size[1] != 1: 
-                raise ValueError, 'incompatible dimensions'
+                raise ValueError('incompatible dimensions')
         elif type(other) is variable:
             other = +other
         elif type(other) is not _function:
             return NotImplemented
 
         if len(self) != len(other) != 1: 
-            raise ValueError, 'incompatible lengths'
+            raise ValueError('incompatible lengths')
 
         if _ismatrix(other):
             if 1 == len(self._constant) != len(other): 
@@ -508,8 +509,8 @@ class _function(object):
         else:   #type(other) is _function:
             if not (self._isconvex() and other._isconvex()) and \
                 not (self._isconcave() and other._isconcave()):
-                raise ValueError, 'operands must be both convex or '\
-                    'both concave'
+                raise ValueError('operands must be both convex or '\
+                    'both concave')
 
             if 1 == len(self._constant) != len(other._constant): 
                 self._constant = self._constant + other._constant
@@ -534,14 +535,14 @@ class _function(object):
             other = matrix(other, tc='d')
         elif _ismatrix(other):
             if other.size[1] != 1: 
-                raise ValueError, 'incompatible dimensions'
+                raise ValueError('incompatible dimensions')
         elif type(other) is variable:
             other = +other
         elif type(other) is not _function:
             return NotImplemented
 
         if 1 != len(self) != len(other) != 1: 
-            raise ValueError, 'incompatible lengths'
+            raise ValueError('incompatible lengths')
 
         f = _function()
 
@@ -554,8 +555,8 @@ class _function(object):
         else:   #type(other) is _function:
             if not (self._isconvex() and other._isconcave()) and \
                 not (self._isconcave() and other._isconvex()):
-                raise ValueError, 'operands must be convex and '\
-                    'concave or concave and convex'
+                raise ValueError('operands must be convex and '\
+                    'concave or concave and convex')
 
             f._constant = self._constant - other._constant
             f._linear = self._linear - other._linear
@@ -574,14 +575,14 @@ class _function(object):
             other = matrix(other, tc='d')
         elif _isdmatrix(other):
             if other.size[1] != 1: 
-                raise ValueError, 'incompatible dimensions'
+                raise ValueError('incompatible dimensions')
         elif type(other) is variable:
             other = +other
         elif type(other) is not _function:
             return NotImplemented
 
         if 1 != len(self) != len(other) != 1: 
-            raise ValueError, 'incompatible lengths'
+            raise ValueError('incompatible lengths')
 
         f = _function()
 
@@ -594,8 +595,8 @@ class _function(object):
         else:   # type(other) is _function:
             if not (self._isconvex() and other._isconcave()) and \
                 not (self._isconcave() and other._isconvex()):
-                raise ValueError, 'operands must be convex and '\
-                    'concave or concave and convex'
+                raise ValueError('operands must be convex and '\
+                    'concave or concave and convex')
 
             f._constant = other._constant - self._constant 
             f._linear = other._linear - self._linear 
@@ -614,14 +615,14 @@ class _function(object):
             other = matrix(other, tc='d')
         elif _ismatrix(other):
             if other.size[1] != 1: 
-                raise ValueError, 'incompatible dimensions'
+                raise ValueError('incompatible dimensions')
         elif type(other) is variable:
             other = +other
         elif type(other) is not _function:
             return NotImplemented
 
         if len(self) != len(other) != 1: 
-            raise ValueError, 'incompatible lengths'
+            raise ValueError('incompatible lengths')
 
         if _ismatrix(other):
             if 1 == len(self._constant) != len(other): 
@@ -632,8 +633,8 @@ class _function(object):
         else:   #type(other) is _function:
             if not (self._isconvex() and other._isconcave()) and \
                 not (self._isconcave() and other._isconvex()):
-                raise ValueError, 'operands must be convex and '\
-                    'concave or concave and convex'
+                raise ValueError('operands must be convex and '\
+                    'concave or concave and convex')
 
             if 1 == len(self._constant) != len(other._constant): 
                 self._constant = self._constant - other._constant
@@ -694,10 +695,10 @@ class _function(object):
                         pass
 
                 else: 
-                    raise ValueError, 'can only multiply with scalar'
+                    raise ValueError('can only multiply with scalar')
 
         else: 
-            raise TypeError, 'incompatible dimensions or types'
+            raise TypeError('incompatible dimensions or types')
 
         return f
 
@@ -752,10 +753,10 @@ class _function(object):
                     else: pass
 
                 else: 
-                    raise ValueError, 'can only multiply with scalar'
+                    raise ValueError('can only multiply with scalar')
 
         else: 
-            raise TypeError, 'incompatible dimensions or types'
+            raise TypeError('incompatible dimensions or types')
 
         return f
                 
@@ -793,7 +794,7 @@ class _function(object):
             return self
 
         else: 
-            raise TypeError, 'incompatible dimensions or types'
+            raise TypeError('incompatible dimensions or types')
 
 
     def __div__(self,other):
@@ -859,7 +860,7 @@ class _function(object):
 
         lg = len(self)
         l = _keytolist(key,lg)
-        if not l: raise ValueError, 'empty index set'
+        if not l: raise ValueError('empty index set')
 
         f = _function()
 
@@ -1056,7 +1057,7 @@ class _lin(object):
                     m[::newlg+1] += c[0]
                     self._coeff[v] = m
                 else:
-                    raise TypeError, 'incompatible dimensions'
+                    raise TypeError('incompatible dimensions')
                     
             elif _ismatrix(a) and a.size == (1,len(v)):
                 if c.size == (lg,len(v)):
@@ -1068,7 +1069,7 @@ class _lin(object):
                     m[::lg+1] += c[0]
                     self._coeff[v] = m
                 else:
-                    raise TypeError, 'incompatible dimensions'
+                    raise TypeError('incompatible dimensions')
 
             elif _isscalar(a) and len(v) > 1 and (lg == 1 or 
                 lg == len(v)):
@@ -1081,14 +1082,14 @@ class _lin(object):
                 elif _isscalar(c):
                     self._coeff[v] = c + a
                 else:
-                    raise TypeError, 'incompatible dimensions'
+                    raise TypeError('incompatible dimensions')
 
             elif _isscalar(a) and len(v) == 1:
                 self._coeff[v] = c + a    # add a to every elt of c
 
             else:
-                raise TypeError, 'coefficient has invalid type or '\
-                    'incompatible dimensions '
+                raise TypeError('coefficient has invalid type or '\
+                    'incompatible dimensions ')
 
         elif type(v) is variable:
 
@@ -1111,11 +1112,11 @@ class _lin(object):
                 self._coeff[v] = +a
 
             else:
-                raise TypeError, 'coefficient has invalid type or '\
-                    'incompatible dimensions '
+                raise TypeError('coefficient has invalid type or '\
+                    'incompatible dimensions ')
         
         else: 
-            raise TypeError, 'second argument must be a variable'
+            raise TypeError('second argument must be a variable')
 
 
     def _mul(self,a):
@@ -1134,7 +1135,7 @@ class _lin(object):
             for v,c in self._coeff.iteritems(): self._coeff[v] = a*c
 
         else: 
-            raise TypeError, 'incompatible dimensions'
+            raise TypeError('incompatible dimensions')
 
 
     def _rmul(self,a):
@@ -1158,7 +1159,7 @@ class _lin(object):
                     self._coeff[v] = a*c
              
         else: 
-            raise TypeError, 'incompatible dimensions'
+            raise TypeError('incompatible dimensions')
 
 
     def __pos__(self):
@@ -1221,8 +1222,8 @@ class _lin(object):
             for v,c in other._coeff.iteritems(): self._addterm(c,v)
 
         else: 
-            raise NotImplementedError, 'in-place addition must result '\
-                'in a function of the same length'
+            raise NotImplementedError('in-place addition must result '\
+                'in a function of the same length')
         
         return self
 
@@ -1274,8 +1275,8 @@ class _lin(object):
             for v,c in other._coeff.iteritems(): self._addterm(-c,v)
 
         else: 
-            raise NotImplementedError, 'in-place subtraction must '\
-                'result in a function of the same length'
+            raise NotImplementedError('in-place subtraction must '\
+                'result in a function of the same length')
         
         return self
 
@@ -1316,15 +1317,15 @@ class _lin(object):
         if _isscalar(other): 
             self._mul(other)
         else: 
-            raise NotImplementedError, 'in-place multiplication '  \
-                'only defined for scalar multiplication'
+            raise NotImplementedError('in-place multiplication '  \
+                'only defined for scalar multiplication')
         return self
 
 
     def __getitem__(self,key):
 
         l = _keytolist(key,len(self))
-        if not l: raise ValueError, 'empty index set'
+        if not l: raise ValueError('empty index set')
 
         f = _lin()
         for v,c in self._coeff.iteritems():
@@ -1394,7 +1395,7 @@ class _minmax(object):
                 (s[0]._isconcave() and not self._ismax)):
                 self._flist += [+s[0]]
             else:
-                raise TypeError, 'unsupported argument type'
+                raise TypeError('unsupported argument type')
 
         else:
             # cnst will be max/min of the constant arguments
@@ -1417,11 +1418,11 @@ class _minmax(object):
                     self._flist += [+f]
 
                 else:
-                    raise TypeError, 'unsupported argument type'
+                    raise TypeError('unsupported argument type')
 
                 lgf = len(f)
                 if 1 != lg != lgf != 1:
-                    raise ValueError, 'incompatible dimensions'
+                    raise ValueError('incompatible dimensions')
                 elif 1 == lg != lgf: 
                     lg = lgf
 
@@ -1537,15 +1538,15 @@ class _minmax(object):
             if other < 0.0: self._ismax = not self._ismax
             return self
 
-        raise NotImplementedError, 'in-place multiplication is only '\
-            'defined for scalars'
+        raise NotImplementedError('in-place multiplication is only '\
+            'defined for scalars')
 
 
     def __getitem__(self,key):
 
         lg = len(self)
         l = _keytolist(key,lg)
-        if not l: raise ValueError, 'empty index set'
+        if not l: raise ValueError('empty index set')
 
         if len(self._flist) == 1: fl = list(self._flist[0])    
         else: fl = self._flist
@@ -1669,7 +1670,7 @@ class _sum_minmax(_minmax):
 
         _minmax.__init__(self,op,*s)
         if len(self._flist) == 1: 
-            raise TypeError, 'expected more than 1 argument'
+            raise TypeError('expected more than 1 argument')
 
 
     def __len__(self):
@@ -1767,7 +1768,7 @@ class _sum_minmax(_minmax):
     def __getitem__(self,key):
 
         l = _keytolist(key,1)
-        if not l: raise ValueError, 'empty index set'
+        if not l: raise ValueError('empty index set')
 
         # expand sum and convert to a  _function
         if self._ismax: f = sum(_minmax('max',*self._flist))
@@ -1817,20 +1818,20 @@ class constraint(object):
         if ctype == '=' or ctype  == '<':
             self._type = ctype
         else:
-            raise TypeError, "'ctype' argument must be '<' or '='"
+            raise TypeError("'ctype' argument must be '<' or '='")
 
         if type(f) is not _function:
-            raise TypeError, "'f' argument must be a function"
+            raise TypeError("'f' argument must be a function")
         
         if ctype == '=':
             if f._isaffine(): self._f = f
             else:
-                raise TypeError, "constraint function must be affine"
+                raise TypeError("constraint function must be affine")
         
         else:
             if f._isconvex(): self._f = f
             else:
-                raise TypeError, "constraint function must be convex"
+                raise TypeError("constraint function must be convex")
  
         self.name = name
         self.multiplier = variable(len(self), name + '_mul')
@@ -1869,14 +1870,14 @@ class constraint(object):
                 if hasattr(self,'multiplier'): 
                     self.multiplier.name = value + '_mul'
             else:
-                raise TypeError, "invalid type for attribute 'name'"
+                raise TypeError("invalid type for attribute 'name'")
 
         elif name == 'multiplier' or name == '_type' or name == '_f': 
             object.__setattr__(self,name,value)
 
         else:
-            raise AttributeError, "'constraint' object has no "\
-                "attribute '%s'" %name
+            raise AttributeError("'constraint' object has no "\
+                "attribute '%s'" %name)
 
 
     def type(self):
@@ -1924,7 +1925,7 @@ class constraint(object):
         """
 
         if self.type() != '<': 
-            raise TypeError, 'constraint must be an inequality'
+            raise TypeError('constraint must be an inequality')
 
         ineqs, aux_ineqs, aux_vars = [], [], varlist()
 
@@ -2114,7 +2115,7 @@ class op(object):
                 else:
                     self._equalities += [c]
         else: 
-            raise TypeError, 'invalid argument for constraints' 
+            raise TypeError('invalid argument for constraints')
 
         for c in self._inequalities:
             for v in c.variables():
@@ -2155,8 +2156,8 @@ class op(object):
                 len(value) == 1:
                 pass
             else:
-                raise TypeError, "attribute 'objective' must be a "\
-                    "scalar affine or convex PWL function"
+                raise TypeError("attribute 'objective' must be a "\
+                    "scalar affine or convex PWL function")
 
             # remove variables in _variables that only appear in current
             # objective 
@@ -2177,15 +2178,15 @@ class op(object):
             if type(value) is str:
                 object.__setattr__(self,name,value)
             else:
-                raise TypeError, "attribute 'name' must be string"
+                raise TypeError("attribute 'name' must be string")
 
         elif name == '_inequalities' or name == '_equalities' or \
             name == '_variables' or name == 'status':
             object.__setattr__(self,name,value)
 
         else:
-            raise AttributeError, "'op' object has no attribute "\
-                "'%s'" %name
+            raise AttributeError("'op' object has no attribute "\
+                "'%s'" %name)
 
 
     def variables(self):    
@@ -2223,7 +2224,7 @@ class op(object):
         """
 
         if type(c) is not constraint:
-            raise TypeError, "argument must be of type 'constraint'"
+            raise TypeError("argument must be of type 'constraint'")
 
         try: 
             if c.type() == '<': 
@@ -2250,7 +2251,7 @@ class op(object):
         """
 
         if type(c) is not constraint:
-            raise TypeError, 'argument must be of type constraint'
+            raise TypeError('argument must be of type constraint')
 
         if c.type() == '<': self._inequalities += [c]             
         if c.type() == '=': self._equalities += [c]             
@@ -2549,14 +2550,14 @@ class op(object):
 
         variables = lp1.variables()
         if not variables: 
-            raise TypeError, 'lp must have at least one variable'
+            raise TypeError('lp must have at least one variable')
         x = variables[0]
         c = lp1.objective._linear._coeff[x]
         if _isspmatrix(c): c = matrix(c, tc='d')
 
         inequalities = lp1._inequalities
         if not inequalities:
-            raise TypeError, 'lp must have at least one inequality'
+            raise TypeError('lp must have at least one inequality')
         G = inequalities[0]._f._linear._coeff[x]
         h = -inequalities[0]._f._constant
 
@@ -2590,7 +2591,7 @@ class op(object):
         writes LP to file 'filename' in MPS format.
         '''
 
-        if not self._islp(): raise TypeError, 'problem must be an LP'
+        if not self._islp(): raise TypeError('problem must be an LP')
 
         constraints = self.constraints()
         variables = self.variables()
@@ -2728,15 +2729,15 @@ class op(object):
         while s[:4] != 'NAME': 
             s = f.readline()
             if not s: 
-                raise SyntaxError, "EOF reached before 'NAME' section "\
-                    "was found" 
+                raise SyntaxError("EOF reached before 'NAME' section "\
+                    "was found")
         self.name = strip(s[14:22])
 
         s = f.readline()
         while s[:4] != 'ROWS': 
             if not s: 
-                raise SyntaxError, "EOF reached before 'ROWS' section "\
-                    "was found" 
+                raise SyntaxError("EOF reached before 'ROWS' section "\
+                    "was found")
             s = f.readline()
         s = f.readline()
 
@@ -2746,7 +2747,7 @@ class op(object):
         rowtypes = dict()    # {MPS row label: 'E', 'G' or 'L'}
         foundobj = False     # first occurrence of 'N' counts
         while s[:7] != 'COLUMNS': 
-            if not s: raise SyntaxError, "file has no 'COLUMNS' section"
+            if not s: raise SyntaxError("file has no 'COLUMNS' section")
             if len(strip(s)) == 0 or s[0] == '*': 
                 pass
             elif strip(s[1:3]) in ['E','L','G']:
@@ -2759,7 +2760,7 @@ class op(object):
                     functions[rowlabel] = self.objective
                     foundobj = True
             else: 
-                raise ValueError, "unknown row type '%s'" %strip(s[1:3])
+                raise ValueError("unknown row type '%s'" %strip(s[1:3]))
             s = f.readline()
         s = f.readline()
 
@@ -2768,8 +2769,8 @@ class op(object):
         variables = dict()   # {MPS column label: variable}
         while s[:3] != 'RHS': 
             if not s: 
-                raise SyntaxError, "EOF reached before 'RHS' section "\
-                    "was found" 
+                raise SyntaxError("EOF reached before 'RHS' section "\
+                    "was found")
             if len(strip(s)) == 0 or s[0] == '*': 
                 pass
             else:
@@ -2779,13 +2780,13 @@ class op(object):
                 v = variables[collabel]
                 rowlabel = strip(s[14:22])
                 if not functions.has_key(rowlabel):
-                    raise KeyError, "no row label '%s'" %rowlabel
+                    raise KeyError("no row label '%s'" %rowlabel)
                 functions[rowlabel]._linear._coeff[v] = \
                     matrix(float(s[24:36]), tc='d')
                 rowlabel = strip(s[39:47])
                 if rowlabel:
                     if not functions.has_key(rowlabel):
-                        raise KeyError, "no row label '%s'" %rowlabel
+                        raise KeyError("no row label '%s'" %rowlabel)
                     functions[rowlabel]._linear._coeff[v] =  \
                         matrix(float(s[49:61]), tc='d')
             s = f.readline()
@@ -2800,8 +2801,8 @@ class op(object):
         rhslabel = None
         while s[:6] != 'RANGES' and s[:6] != 'BOUNDS' and \
             s[:6] != 'ENDATA':
-            if not s: raise SyntaxError, \
-                "EOF reached before 'ENDATA' was found"
+            if not s: raise SyntaxError( \
+                 "EOF reached before 'ENDATA' was found")
             if len(strip(s)) == 0 or s[0] == '*': 
                 pass
             else:
@@ -2813,14 +2814,14 @@ class op(object):
                     if rhslabel is None: rhslabel = strip(s[4:12])
                     rowlabel = strip(s[14:22])
                     if not functions.has_key(rowlabel):
-                        raise KeyError, "no row label '%s'" %rowlabel
+                        raise KeyError("no row label '%s'" %rowlabel)
                     functions[rowlabel]._constant = \
                         matrix(-float(s[24:36]), tc='d')
                     rowlabel = strip(s[39:47])
                     if rowlabel:
                         if not functions.has_key(rowlabel):
-                            raise KeyError, "no row label '%s'" \
-                                %rowlabel
+                            raise KeyError("no row label '%s'" \
+                                %rowlabel)
                         functions[rowlabel]._constant = \
                             matrix(-float(s[49:61]), tc='d')
             s = f.readline()
@@ -2838,8 +2839,8 @@ class op(object):
         if s[:6] == 'RANGES':
             s = f.readline()
             while s[:6] != 'BOUNDS' and s[:6] != 'ENDATA':
-                if not s: raise SyntaxError, \
-                    "EOF reached before 'ENDATA' was found"
+                if not s: raise SyntaxError( \
+                    "EOF reached before 'ENDATA' was found")
                 if len(strip(s)) == 0 or s[0] == '*': 
                     pass
                 else:
@@ -2850,13 +2851,13 @@ class op(object):
                             rangeslabel = strip(s[4:12])
                         rowlabel = strip(s[14:22])
                         if not rowtypes.has_key(rowlabel):
-                            raise KeyError, "no row label '%s'"%rowlabel
+                            raise KeyError("no row label '%s'"%rowlabel)
                         ranges[rowlabel] = float(s[24:36])
                         rowlabel = strip(s[39:47])
                         if rowlabel != '':
                             if not functions.has_key(rowlabel):
-                                raise KeyError, "no row label '%s'" \
-                                    %rowlabel
+                                raise KeyError("no row label '%s'" \
+                                    %rowlabel)
                             ranges[rowlabel] =  float(s[49:61])
                 s = f.readline()
 
@@ -2873,8 +2874,8 @@ class op(object):
         if s[:6] == 'BOUNDS':
             s = f.readline()
             while s[:6] != 'ENDATA':
-                if not s: raise SyntaxError, \
-                    "EOF reached before 'ENDATA' was found"
+                if not s: raise SyntaxError( \
+                    "EOF reached before 'ENDATA' was found")
                 if len(strip(s)) == 0 or s[0] == '*': 
                     pass
                 else:
@@ -2885,42 +2886,42 @@ class op(object):
                             boundslabel = strip(s[4:12])
                         collabel = strip(s[14:22])
                         if not variables.has_key(collabel):
-                            raise ValueError, 'unknown column label ' \
-                                + "'%s'" %collabel
+                            raise ValueError('unknown column label ' \
+                                + "'%s'" %collabel)
                         if strip(s[1:3]) == 'LO': 
                             if bounds[collabel][0] != 0.0:
-                                raise ValueError, "repeated lower "\
-                                    "bound for variable '%s'" %collabel
+                                raise ValueError("repeated lower "\
+                                    "bound for variable '%s'" %collabel)
                             bounds[collabel][0] = float(s[24:36])
                         elif strip(s[1:3]) == 'UP': 
                             if bounds[collabel][1] != None:
-                                raise ValueError, "repeated upper "\
-                                    "bound for variable '%s'" %collabel
+                                raise ValueError("repeated upper "\
+                                    "bound for variable '%s'" %collabel)
                             bounds[collabel][1] = float(s[24:36])
                         elif strip(s[1:3]) == 'FX': 
                             if bounds[collabel] != [0, None]:
-                                raise ValueError, "repeated bounds "\
-                                    "for variable '%s'" %collabel
+                                raise ValueError("repeated bounds "\
+                                    "for variable '%s'" %collabel)
                             bounds[collabel][0] = float(s[24:36])
                             bounds[collabel][1] = float(s[24:36])
                         elif strip(s[1:3]) == 'FR': 
                             if bounds[collabel] != [0, None]:
-                                raise ValueError, "repeated bounds "\
-                                    "for variable '%s'" %collabel
+                                raise ValueError("repeated bounds "\
+                                    "for variable '%s'" %collabel)
                             bounds[collabel][0] = None
                             bounds[collabel][1] = None
                         elif strip(s[1:3]) == 'MI': 
                             if bounds[collabel][0] != 0.0:
-                                raise ValueError, "repeated lower " \
-                                    "bound for variable '%s'" %collabel
+                                raise ValueError("repeated lower " \
+                                    "bound for variable '%s'" %collabel)
                             bounds[collabel][0] = None
                         elif strip(s[1:3]) == 'PL': 
                             if bounds[collabel][1] != None:
-                                raise ValueError, "repeated upper " \
-                                    "bound for variable '%s'" %collabel
+                                raise ValueError("repeated upper " \
+                                    "bound for variable '%s'" %collabel)
                         else:
-                            raise ValueError, "unknown bound type '%s'"\
-                                %strip(s[1:3])
+                            raise ValueError("unknown bound type '%s'"\
+                                %strip(s[1:3]))
                 s = f.readline()
 
         for l, type in rowtypes.iteritems():
@@ -2977,15 +2978,15 @@ class op(object):
         for c in self._inequalities + self._equalities:
             if len(c._f._linear._coeff) == 0:
                 if c.type() == '=' and c._f._constant[0] != 0.0:
-                    raise ValueError, "equality constraint '%s' "\
+                    raise ValueError("equality constraint '%s' "\
                        "has no variables and a nonzero righthand side"\
-                       %c.name
+                       %c.name)
                 elif c.type() == '<' and c._f._constant[0] > 0.0:
-                    raise ValueError, "inequality constraint '%s' "\
+                    raise ValueError("inequality constraint '%s' "\
                        "has no variables and a negative righthand side"\
-                       %c.name
+                       %c.name)
                 else:
-                    print "removing redundant constraint '%s'" %c.name
+                    print("removing redundant constraint '%s'" %c.name)
                     if c.type() == '<': self._inequalities.remove(c)
                     if c.type() == '=': self._equalities.remove(c)
 
@@ -3032,8 +3033,8 @@ def dot(x,y):
         return y.trans() * x
 
     else:
-        raise TypeError, 'invalid argument types or incompatible '\
-            'dimensions' 
+        raise TypeError('invalid argument types or incompatible '\
+            'dimensions')
 
 
 
@@ -3096,13 +3097,13 @@ def _keytolist(key,n):
         elif 0 <= key < n:  
             l = [key] 
         else:  
-            raise IndexError, 'variable index out of range'
+            raise IndexError('variable index out of range')
 
     elif (type(key) is list and not [k for k in key if type(k) is not 
         int]) or (type(key) is matrix and key.typecode == 'i'):
         l = [k for k in key if -n <= k < n]
         if len(l) != len(key):
-            raise IndexError, 'variable index out of range'
+            raise IndexError('variable index out of range')
         for i in xrange(len(l)): 
             if l[i] < 0: l[i] += n
         
@@ -3112,7 +3113,7 @@ def _keytolist(key,n):
         l = range(ind[0],ind[1],ind[2])
 
     else: 
-        raise TypeError, 'invalid key'
+        raise TypeError('invalid key')
 
     return l
 
@@ -3146,7 +3147,7 @@ def _vecmax(*s):
     """
 
     if not s:
-        raise TypeError, "_vecmax expected at least 1 argument, got 0"
+        raise TypeError("_vecmax expected at least 1 argument, got 0")
 
     val = None
     for c in s:
@@ -3158,7 +3159,7 @@ def _vecmax(*s):
             c = matrix(c, tc='d')
 
         elif not _isdmatrix(c) or c.size[1] != 1:
-            raise TypeError, "incompatible type or size" 
+            raise TypeError("incompatible type or size")
 
         if val is None:
             if len(s) == 1:  return matrix(max(c), tc='d')
@@ -3175,7 +3176,7 @@ def _vecmax(*s):
                 tc='d' )
     
         else: 
-            raise ValueError, 'incompatible dimensions'
+            raise ValueError('incompatible dimensions')
 
     return val
 
@@ -3194,7 +3195,7 @@ def _vecmin(*s):
     """
 
     if not s:
-        raise TypeError, "_vecmin expected at least 1 argument, got 0"
+        raise TypeError("_vecmin expected at least 1 argument, got 0")
 
     val = None
     for c in s:
@@ -3206,7 +3207,7 @@ def _vecmin(*s):
             c = matrix(c, tc='d')
 
         elif not _isdmatrix(c) or c.size[1] != 1:
-            raise TypeError, "incompatible type or size" 
+            raise TypeError("incompatible type or size")
 
         if val is None:
             if len(s) == 1:  return matrix(min(c), tc='d')
@@ -3223,6 +3224,6 @@ def _vecmin(*s):
                 tc='d' )
     
         else: 
-            raise ValueError, 'incompatible dimensions'
+            raise ValueError('incompatible dimensions')
 
     return val
diff --git a/src/python/mosek.py b/src/python/mosek.py
deleted file mode 100644
index 7574d96..0000000
--- a/src/python/mosek.py
+++ /dev/null
@@ -1,871 +0,0 @@
-"""
-CVXOPT interface for MOSEK 5.0
-"""
-
-# Copyright 2004-2009 J. Dahl and L. Vandenberghe.
-# 
-# This file is part of CVXOPT version 1.1.2
-#
-# CVXOPT is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# CVXOPT is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-from cvxopt.base import matrix, spmatrix, sparse
-
-import pymosek as msk
-from mosekarr import array, zeros, Float
-
-# Define a stream printer to grab output from MOSEK 
-def streamprinter(text): print text,
-    
-inf = 0.0  # numeric value doesn't matter
-
-options = {}
-
-def lp(c, G, h, A=None, b=None):
-    """
-    Solves a pair of primal and dual LPs 
-
-        minimize    c'*x             maximize    -h'*z - b'*y 
-        subject to  G*x + s = h      subject to  G'*z + A'*y + c = 0
-                    A*x = b                      z >= 0.
-                    s >= 0
-                    
-    using MOSEK 5.0.
-
-    (solsta, x, z, y) = lp(c, G, h, A=None, b=None).
-
-    Input arguments 
-
-        G is m x n, h is m x 1, A is p x n, b is p x 1.  G and A must be 
-        dense or sparse 'd' matrices.   h and b are dense 'd' matrices 
-        with one column.  The default values for A and b are empty 
-        matrices with zero rows.
-
-
-    Return values
-
-        solsta   the solution status.
-                 If solsta is solsta.optimal, then (x, y, z) contains the 
-                     primal-dual solution.
-                 If solsta is solsta.prim_infeas_cer, then (x, y, z) is a 
-                     certificate of primal infeasibility.
-                 If solsta is solsta.dual_infeas_cer, then (x, y, z) is a 
-                     certificate of dual infeasibility.
-                 If solsta is solsta.unknown, then (x, y, z) are all None.
-
-                 Other return values for solsta include:  
-                     solsta.dual_feas  
-                     solsta.near_dual_feas
-                     solsta.near_optimal
-                     solsta.near_prim_and_dual_feas
-                     solsta.near_prim_feas
-                     solsta.prim_and_dual_feas
-                     solsta.prim_feas
-                 in which case the (x,y,z) value may not be well-defined,
-                 c.f., the MOSEK documentation.
-        
-        x, y, z  the primal-dual solution.                    
-
-    Options are passed to MOSEK solvers via the mosek.options dictionary. 
-    For example, the following turns off output from the MOSEK solvers
-    
-    >>> mosek.options = {iparam.log:0} 
-    
-    see chapter 14 of the MOSEK Python API manual.                    
-    """
-    if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
-        raise TypeError, "'c' must be a dense column matrix"
-    n = c.size[0]
-    if n < 1: raise ValueError, "number of variables must be at least 1"
-
-    if (type(G) is not matrix and type(G) is not spmatrix) or \
-        G.typecode != 'd' or G.size[1] != n:
-        raise TypeError, "'G' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n 
-    m = G.size[0]
-    if m is 0: raise ValueError, "m cannot be 0"
-
-    if type(h) is not matrix or h.typecode != 'd' or h.size != (m,1):
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %m
-
-    if A is None:  A = spmatrix([], [], [], (0,n), 'd')
-    if (type(A) is not matrix and type(A) is not spmatrix) or \
-        A.typecode != 'd' or A.size[1] != n:
-        raise TypeError, "'A' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
-    p = A.size[0]
-    if b is None: b = matrix(0.0, (0,1))
-    if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
-        raise TypeError, "'b' must be a dense matrix of size (%d,1)" %p
- 
-    c   = array(c)        
-
-    bkc = m*[ msk.boundkey.up ] + p*[ msk.boundkey.fx ]
-    blc = m*[ -inf ] + [ bi for bi in b ]
-    buc = matrix([h, b])
-
-    bkx = n*[msk.boundkey.fr] 
-    blx = n*[ -inf ] 
-    bux = n*[ +inf ]
-
-    colptr, asub, acof = sparse([G,A]).CCS
-    aptrb, aptre = colptr[:-1], colptr[1:]
-
-    mskhandle = msk.mosek ()
-    env = mskhandle.Env ()
-    env.set_Stream (msk.streamtype.log, streamprinter)
-        
-    env.init () 
-    task = env.Task(0,0) 
-    task.set_Stream (msk.streamtype.log, streamprinter) 
-
-    # set MOSEK options 
-    for (param, val) in options.items():
-        if str(param)[:6] == "iparam":
-            task.putintparam(param, val)
-        elif str(param)[:6] == "dparam":
-            task.putdouparam(param, val)
-        elif str(param)[:6] == "sparam":
-            task.putstrparam(param, val)
-        else:
-            raise ValueError, "invalid MOSEK parameter: "+str(param)
-
-    task.inputdata (m+p, # number of constraints
-                    n,   # number of variables
-                    array(c), # linear objective coefficients  
-                    0.0, # objective fixed value  
-                    array(aptrb), 
-                    array(aptre), 
-                    array(asub),
-                    array(acof), 
-                    array(bkc),
-                    array(blc),
-                    array(buc), 
-                    array(bkx),
-                    array(blx),
-                    array(bux)) 
-
-    task.putobjsense(msk.objsense.minimize)
-
-    task.optimize()
-
-    task.solutionsummary (msk.streamtype.msg); 
-
-    prosta, solsta = list(), list()
-    task.getsolutionstatus(msk.soltype.bas, prosta, solsta)
-
-    x, z = zeros(n, Float), zeros(m, Float)
-    task.getsolutionslice(msk.soltype.bas, msk.solitem.xx, 0, n, x) 
-    task.getsolutionslice(msk.soltype.bas, msk.solitem.suc, 0, m, z) 
-    x, z = matrix(x), matrix(z)
-    
-    if p is not 0:
-        yu, yl = zeros(p, Float), zeros(p, Float)
-        task.getsolutionslice(msk.soltype.bas, msk.solitem.suc, m, m+p, yu) 
-        task.getsolutionslice(msk.soltype.bas, msk.solitem.slc, m, m+p, yl) 
-        y = matrix(yu) - matrix(yl)
-    else:
-        y = matrix(0.0, (0,1))
-
-    if (solsta[0] is msk.solsta.unknown):
-        return (solsta[0], None, None, None)
-    else:
-        return (solsta[0], x, z, y)
-
-
-def conelp(c, G, h, dims = None):
-    """
-    Solves a pair of primal and dual SOCPs
-
-        minimize    c'*x             
-        subject to  Gl*x + sl = hl      
-                    Gq[k]*x + sq[k] = hq[k],  k = 0, ..., N-1
-                    sl >= 0,  
-                    sq[k] >= 0, k = 0, ..., N-1
-
-        maximize    -hl'*zl - sum_k hq[k]'*zq[k] 
-        subject to  Gl'*zl + sum_k Gq[k]'*zq[k] + c = 0
-                    zl >= 0,  zq[k] >= 0, k = 0, ..., N-1.
-                    
-    using MOSEK 5.0.
-
-    (solsta, x, zl, zq) = conelp(c, G, h, dims = None)
-
-    The formats of G and h are identical to that used in the
-    solvers.conelp method, except that only carthesian and quadratic cones 
-    are allow  (dims['s'] must be zero, if defined).
- 
-    Return values
-
-        solsta   the solution status.
-                 If solsta is solsta.optimal,
-                   then (x, zl, zq) contains the primal-dual solution.
-                 If solsta is solsta.prim_infeas_cer,
-                   then (x, zl, zq) is a certificate of primal infeasibility.
-                 If solsta is solsta.dual_infeas_cer,
-                   then (x, zl, zq) is a certificate of dual infeasibility.
-                 If solsta is solsta.unknown,
-                   then (x, zl, zq) are all None
-
-                 Other return values for solsta include:  
-                   solsta.dual_feas  
-                   solsta.near_dual_feas
-                   solsta.near_optimal
-                   solsta.near_prim_and_dual_feas
-                   solsta.near_prim_feas
-                   solsta.prim_and_dual_feas
-                   solsta.prim_feas
-                 in which case the (x,y,z) value may not be well-defined,
-                 c.f., the MOSEK documentation.
-        
-        x, zl, zq  the primal-dual solution.
-
-
-    Options are passed to MOSEK solvers via the mosek.options 
-    dictionary, e.g., the following turns off output from 
-    the MOSEK solvers
-    
-    >>> mosek.options = {iparam.log:0} 
-    
-    see chapter 14 of the MOSEK Python API manual.                    
-    """
-
-    if dims is None: 
-        (solsta, x, y, z) = lp(c, G, h)
-        return (solsta, x, z, None)
-
-    try:
-        if len(dims['s']) > 0: raise ValueError, "dims['s'] must be zero"
-    except:
-        pass
-
-    N, n = G.size
-    ml, mq = dims['l'], dims['q']
-    cdim = ml + sum(mq)
-    if cdim is 0: raise ValueError, "ml+mq cannot be 0"
-
-    # Data for kth 'q' constraint are found in rows indq[k]:indq[k+1] of G.
-    indq = [ dims['l'] ]  
-    for k in dims['q']:  indq = indq + [ indq[-1] + k ] 
-
-    if type(h) is not matrix or h.typecode != 'd' or h.size[1] != 1:
-        raise TypeError, "'h' must be a 'd' matrix with 1 column" 
-    if type(G) is matrix or type(G) is spmatrix:
-        if G.typecode != 'd' or G.size[0] != cdim:
-            raise TypeError, "'G' must be a 'd' matrix with %d rows " %cdim
-        if h.size[0] != cdim:
-            raise TypeError, "'h' must have %d rows" %cdim 
-    else: 
-        raise TypeError, "'G' must be a matrix"
-
-    if min(dims['q'])<1: raise TypeError, \
-            "dimensions of quadratic cones must be positive"
-
-    bkc = n*[ msk.boundkey.fx ] 
-    blc = array(-c)
-    buc = array(-c)
-
-    bkx = ml*[ msk.boundkey.lo ] + sum(mq)*[ msk.boundkey.fr ]
-    blx = ml*[ 0.0 ] + sum(mq)*[ -inf ]
-    bux = N*[ +inf ] 
-
-    c   = -h        
-    
-    colptr, asub, acof = sparse([G.T]).CCS
-    aptrb, aptre = colptr[:-1], colptr[1:]
-
-    mskhandle = msk.mosek ()
-    env = mskhandle.Env ()
-    env.set_Stream (msk.streamtype.log, streamprinter)
-        
-    env.init () 
-    task = env.Task(0,0) 
-    task.set_Stream (msk.streamtype.log, streamprinter) 
-
-    # set MOSEK options 
-    for (param, val) in options.items():
-        if str(param)[:6] == "iparam":
-            task.putintparam(param, val)
-        elif str(param)[:6] == "dparam":
-            task.putdouparam(param, val)
-        elif str(param)[:6] == "sparam":
-            task.putstrparam(param, val)
-        else:
-            raise ValueError, "invalid MOSEK parameter: "+str(param)
-
-    task.inputdata (n,   # number of constraints
-                    N,   # number of variables
-                    array(c), # linear objective coefficients  
-                    0.0, # objective fixed value  
-                    array(aptrb), 
-                    array(aptre), 
-                    array(asub),
-                    array(acof), 
-                    array(bkc),
-                    array(blc),
-                    array(buc), 
-                    array(bkx),
-                    array(blx),
-                    array(bux)) 
-
-    task.putobjsense(msk.objsense.maximize)
-
-    for k in xrange(len(mq)):
-        task.appendcone(msk.conetype.quad, 0.0, 
-                        array(range(ml+sum(mq[:k]),ml+sum(mq[:k+1]))))
-    task.optimize()
-
-    task.solutionsummary (msk.streamtype.msg); 
-
-    prosta, solsta = list(), list()
-    task.getsolutionstatus(msk.soltype.itr, prosta, solsta)
-
-    xu, xl, zq = zeros(n, Float), zeros(n, Float), zeros(sum(mq), Float)
-    task.getsolutionslice(msk.soltype.itr, msk.solitem.slc, 0, n, xl) 
-    task.getsolutionslice(msk.soltype.itr, msk.solitem.suc, 0, n, xu) 
-    task.getsolutionslice(msk.soltype.itr, msk.solitem.xx, ml, N, zq) 
-    x = matrix(xu-xl)
-
-    if ml:
-        zl = zeros(ml, Float)
-        task.getsolutionslice(msk.soltype.itr, msk.solitem.xx, 0, ml, zl) 
-        zl = matrix(zl)
-    else:
-        zl = matrix(0.0, (0,1))
-
-    if (solsta[0] is msk.solsta.unknown):
-        return (solsta[0], None, None, None)
-    else:
-        return (solsta[0], x, zl, zq)
-    
-
-
-
-def socp(c, Gl = None, hl = None, Gq = None, hq = None):
-    """
-    Solves a pair of primal and dual SOCPs
-
-        minimize    c'*x             
-        subject to  Gl*x + sl = hl      
-                    Gq[k]*x + sq[k] = hq[k],  k = 0, ..., N-1
-                    sl >= 0,  
-                    sq[k] >= 0, k = 0, ..., N-1
-
-        maximize    -hl'*zl - sum_k hq[k]'*zq[k] 
-        subject to  Gl'*zl + sum_k Gq[k]'*zq[k] + c = 0
-                    zl >= 0,  zq[k] >= 0, k = 0, ..., N-1.
-                    
-    using MOSEK 5.0.
-
-    (solsta, x, zl, zq) = socp(c, Gl = None, hl = None, Gq = None, hq = None)
-
-    Return values
-
-        solsta   the solution status.
-                 If solsta is solsta.optimal,
-                   then (x, zl, zq) contains the primal-dual solution.
-                 If solsta is solsta.prim_infeas_cer,
-                   then (x, zl, zq) is a certificate of primal infeasibility.
-                 If solsta is solsta.dual_infeas_cer,
-                   then (x, zl, zq) is a certificate of dual infeasibility.
-                 If solsta is solsta.unknown,
-                   then (x, zl, zq) are all None
-
-                 Other return values for solsta include:  
-                   solsta.dual_feas  
-                   solsta.near_dual_feas
-                   solsta.near_optimal
-                   solsta.near_prim_and_dual_feas
-                   solsta.near_prim_feas
-                   solsta.prim_and_dual_feas
-                   solsta.prim_feas
-                 in which case the (x,y,z) value may not be well-defined,
-                 c.f., the MOSEK documentation.
-        
-        x, zl, zq  the primal-dual solution.
-
-
-    Options are passed to MOSEK solvers via the mosek.options 
-    dictionary, e.g., the following turns off output from 
-    the MOSEK solvers
-    
-    >>> mosek.options = {iparam.log:0} 
-    
-    see chapter 14 of the MOSEK Python API manual.                    
-    """
-    if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
-        raise TypeError, "'c' must be a dense column matrix"
-    n = c.size[0]
-    if n < 1: raise ValueError, "number of variables must be at least 1"
-
-    if Gl is None:  Gl = spmatrix([], [], [], (0,n), tc='d')
-    if (type(Gl) is not matrix and type(Gl) is not spmatrix) or \
-        Gl.typecode != 'd' or Gl.size[1] != n:
-        raise TypeError, "'Gl' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
-    ml = Gl.size[0]
-    if hl is None: hl = matrix(0.0, (0,1))
-    if type(hl) is not matrix or hl.typecode != 'd' or \
-        hl.size != (ml,1):
-        raise TypeError, "'hl' must be a dense 'd' matrix of " \
-            "size (%d,1)" %ml
-
-    if Gq is None: Gq = []
-    if type(Gq) is not list or [ G for G in Gq if (type(G) is not matrix 
-        and type(G) is not spmatrix) or G.typecode != 'd' or 
-        G.size[1] != n ]:
-        raise TypeError, "'Gq' must be a list of sparse or dense 'd' "\
-            "matrices with %d columns" %n 
-    mq = [ G.size[0] for G in Gq ]
-    a = [ k for k in xrange(len(mq)) if mq[k] == 0 ] 
-    if a: raise TypeError, "the number of rows of Gq[%d] is zero" %a[0]
-    if hq is None: hq = []
-    if type(hq) is not list or len(hq) != len(mq) or [ h for h in hq if
-        (type(h) is not matrix and type(h) is not spmatrix) or 
-        h.typecode != 'd' ]: 
-        raise TypeError, "'hq' must be a list of %d dense or sparse "\
-            "'d' matrices" %len(mq)
-    a = [ k for k in xrange(len(mq)) if hq[k].size != (mq[k], 1) ]
-    if a:
-        k = a[0]
-        raise TypeError, "'hq[%d]' has size (%d,%d).  Expected size "\
-            "is (%d,1)." %(k, hq[k].size[0], hq[k].size[1], mq[k]) 
-
-    N = ml + sum(mq)
-    h = matrix(0.0, (N,1))
-    if type(Gl) is matrix or [ Gk for Gk in Gq if type(Gk) is matrix ]:
-        G = matrix(0.0, (N, n))
-    else:
-        G = spmatrix([], [], [], (N, n), 'd')
-    h[:ml] = hl
-    G[:ml,:] = Gl
-    ind = ml
-    for k in xrange(len(mq)):
-        h[ind : ind + mq[k]] = hq[k]
-        G[ind : ind + mq[k], :] = Gq[k]
-        ind += mq[k]
-
-    bkc = n*[ msk.boundkey.fx ] 
-    blc = array(-c)
-    buc = array(-c)
-
-    bkx = ml*[ msk.boundkey.lo ] + sum(mq)*[ msk.boundkey.fr ]
-    blx = ml*[ 0.0 ] + sum(mq)*[ -inf ]
-    bux = N*[ +inf ] 
-
-    c   = -h        
-    
-    colptr, asub, acof = sparse([G.T]).CCS
-    aptrb, aptre = colptr[:-1], colptr[1:]
-
-    mskhandle = msk.mosek ()
-    env = mskhandle.Env ()
-    env.set_Stream (msk.streamtype.log, streamprinter)
-        
-    env.init () 
-    task = env.Task(0,0) 
-    task.set_Stream (msk.streamtype.log, streamprinter) 
-
-    # set MOSEK options 
-    for (param, val) in options.items():
-        if str(param)[:6] == "iparam":
-            task.putintparam(param, val)
-        elif str(param)[:6] == "dparam":
-            task.putdouparam(param, val)
-        elif str(param)[:6] == "sparam":
-            task.putstrparam(param, val)
-        else:
-            raise ValueError, "invalid MOSEK parameter: "+str(param)
-
-    task.inputdata (n,   # number of constraints
-                    N,   # number of variables
-                    array(c), # linear objective coefficients  
-                    0.0, # objective fixed value  
-                    array(aptrb), 
-                    array(aptre), 
-                    array(asub),
-                    array(acof), 
-                    array(bkc),
-                    array(blc),
-                    array(buc), 
-                    array(bkx),
-                    array(blx),
-                    array(bux)) 
-
-    task.putobjsense(msk.objsense.maximize)
-
-    for k in xrange(len(mq)):
-        task.appendcone(msk.conetype.quad, 0.0, 
-                        array(range(ml+sum(mq[:k]),ml+sum(mq[:k+1]))))
-    task.optimize()
-
-    task.solutionsummary (msk.streamtype.msg); 
-
-    prosta, solsta = list(), list()
-    task.getsolutionstatus(msk.soltype.itr, prosta, solsta)
-
-    xu, xl, zq = zeros(n, Float), zeros(n, Float), zeros(sum(mq), Float)
-    task.getsolutionslice(msk.soltype.itr, msk.solitem.slc, 0, n, xl) 
-    task.getsolutionslice(msk.soltype.itr, msk.solitem.suc, 0, n, xu) 
-    task.getsolutionslice(msk.soltype.itr, msk.solitem.xx, ml, N, zq) 
-    x = matrix(xu-xl)
-
-    zq = [ matrix(zq[sum(mq[:k]):sum(mq[:k+1])]) for k in xrange(len(mq)) ]
-    
-    if ml:
-        zl = zeros(ml, Float)
-        task.getsolutionslice(msk.soltype.itr, msk.solitem.xx, 0, ml, zl) 
-        zl = matrix(zl)
-    else:
-        zl = matrix(0.0, (0,1))
-
-    if (solsta[0] is msk.solsta.unknown):
-        return (solsta[0], None, None, None)
-    else:
-        return (solsta[0], x, zl, zq)
-
-
-def qp(P, q, G=None, h=None, A=None, b=None):
-    """
-    Solves a quadratic program
-
-        minimize    (1/2)*x'*P*x + q'*x 
-        subject to  G*x <= h      
-                    A*x = b.                    
-                    
-    using MOSEK 5.0.
-
-    (solsta, x, z, y) = qp(P, q, G=None, h=None, A=None, b=None)
-
-    Return values
-
-        solsta   the solution status.
-                 If solsta is solsta.optimal,
-                   then (x, y, z) contains the primal-dual solution.
-                 If solsta is solsta.prim_infeas_cer,
-                   then (x, y, z) is a certificate of primal infeasibility.
-                 If solsta is solsta.dual_infeas_cer,
-                   then (x, y, z) is a certificate of dual infeasibility.
-                 If solsta is solsta.unknown,
-                   then (x, y, z) are all None
-
-                 Other return values for solsta include:  
-                   solsta.dual_feas  
-                   solsta.near_dual_feas
-                   solsta.near_optimal
-                   solsta.near_prim_and_dual_feas
-                   solsta.near_prim_feas
-                   solsta.prim_and_dual_feas
-                   solsta.prim_feas
-                 in which case the (x,y,z) value may not be well-defined,
-                 c.f., the MOSEK documentation.
-        
-        x, z, y  the primal-dual solution.                    
-
-    Options are passed to MOSEK solvers via the mosek.options 
-    dictionary, e.g., the following turns off output from 
-    the MOSEK solvers
-    
-    >>> mosek.options = {iparam.log:0} 
-    
-    see chapter 14 of the MOSEK Python API manual.                    
-    """
-    if (type(P) is not matrix and type(P) is not spmatrix) or \
-        P.typecode != 'd' or P.size[0] != P.size[1]:
-        raise TypeError, "'P' must be a square dense or sparse 'd' matrix "
-    n = P.size[0]
-
-    if n < 1: raise ValueError, "number of variables must be at least 1"
-
-    if type(q) is not matrix or q.typecode != 'd' or q.size != (n,1):
-        raise TypeError, "'q' must be a 'd' matrix of size (%d,1)" %n
-
-    if G is None: G = spmatrix([], [], [], (0,n), 'd')
-    if (type(G) is not matrix and type(G) is not spmatrix) or \
-        G.typecode != 'd' or G.size[1] != n:
-        raise TypeError, "'G' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n 
-
-    m = G.size[0]
-    if h is None: h = matrix(0.0, (0,1))
-    if type(h) is not matrix or h.typecode != 'd' or h.size != (m,1):
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %m
-
-    if A is None:  A = spmatrix([], [], [], (0,n), 'd')
-    if (type(A) is not matrix and type(A) is not spmatrix) or \
-        A.typecode != 'd' or A.size[1] != n:
-        raise TypeError, "'A' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
-    p = A.size[0]
-    if b is None: b = matrix(0.0, (0,1))
-    if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
-        raise TypeError, "'b' must be a dense matrix of size (%d,1)" %p
- 
-    if m+p is 0: raise ValueError, "m + p must be greater than 0"
-
-    c   = array(q)        
-
-    bkc = m*[ msk.boundkey.up ] + p*[ msk.boundkey.fx ]
-    blc = m*[ -inf ] + [ bi for bi in b ]
-    buc = matrix([h, b])
-
-    bkx = n*[msk.boundkey.fr] 
-    blx = n*[ -inf ] 
-    bux = n*[ +inf ]
-
-    colptr, asub, acof = sparse([G,A]).CCS
-    aptrb, aptre = colptr[:-1], colptr[1:]
-
-    mskhandle = msk.mosek ()
-    env = mskhandle.Env ()
-    env.set_Stream (msk.streamtype.log, streamprinter)
-        
-    env.init () 
-    task = env.Task(0,0) 
-    task.set_Stream (msk.streamtype.log, streamprinter) 
-
-    # set MOSEK options 
-    for (param, val) in options.items():
-        if str(param)[:6] == "iparam":
-            task.putintparam(param, val)
-        elif str(param)[:6] == "dparam":
-            task.putdouparam(param, val)
-        elif str(param)[:6] == "sparam":
-            task.putstrparam(param, val)
-        else:
-            raise ValueError, "invalid MOSEK parameter: "+str(param)
-
-    task.inputdata (m+p, # number of constraints
-                    n,   # number of variables
-                    array(c), # linear objective coefficients  
-                    0.0, # objective fixed value  
-                    array(aptrb), 
-                    array(aptre), 
-                    array(asub),
-                    array(acof), 
-                    array(bkc),
-                    array(blc),
-                    array(buc), 
-                    array(bkx),
-                    array(blx),
-                    array(bux)) 
-
-    Ps = sparse(P)
-    I, J = Ps.I, Ps.J
-    tril = [ k for k in xrange(len(I)) if I[k] >= J[k] ]
-    task.putqobj(array(I[tril]), array(J[tril]), array(Ps.V[tril]))
-    
-    task.putobjsense(msk.objsense.minimize)
-
-    task.optimize()
-
-    task.solutionsummary (msk.streamtype.msg); 
-
-    prosta, solsta = list(), list()
-    task.getsolutionstatus(msk.soltype.itr, prosta, solsta)
-
-    x = zeros(n, Float)
-    task.getsolutionslice(msk.soltype.itr, msk.solitem.xx, 0, n, x) 
-    x = matrix(x)
-
-    if m is not 0:
-        z = zeros(m, Float)
-        task.getsolutionslice(msk.soltype.itr, msk.solitem.suc, 0, m, z) 
-        z = matrix(z)
-    else:
-        z = matrix(0.0, (0,1))
-
-    if p is not 0:
-        yu, yl = zeros(p, Float), zeros(p, Float)
-        task.getsolutionslice(msk.soltype.itr, msk.solitem.suc, m, m+p, yu) 
-        task.getsolutionslice(msk.soltype.itr, msk.solitem.slc, m, m+p, yl) 
-        y = matrix(yu) - matrix(yl)
-    else:
-        y = matrix(0.0, (0,1))
-
-    if (solsta[0] is msk.solsta.unknown):
-        return (solsta[0], None, None, None)
-    else:
-        return (solsta[0], x, z, y)
-
-
-def ilp(c, G, h, A=None, b=None, I=None):
-    """
-    Solves the mixed integer LP
-
-        minimize    c'*x       
-        subject to  G*x + s = h
-                    A*x = b    
-                    s >= 0
-                    xi integer, forall i in I
-                    
-    using MOSEK 5.0.
-
-    (solsta, x) = ilp(c, G, h, A=None, b=None, I=None).
-
-    Input arguments 
-
-        G is m x n, h is m x 1, A is p x n, b is p x 1.  G and A must be 
-        dense or sparse 'd' matrices.   h and b are dense 'd' matrices 
-        with one column.  The default values for A and b are empty 
-        matrices with zero rows.
-
-        I is a Python set with indices of integer elements of x.  By 
-        default all elements in x are constrained to be integer, i.e.,
-        the default value of I is I = set(range(n))
-
-        Dual variables are not returned for MOSEK.
-
-    Return values
-
-        solsta   the solution status.
-                 If solsta is solsta.integer_optimal,
-                   then x contains the solution.
-                 If solsta is solsta.unknown,
-                   then x is None
-
-                 Other return values for solsta include:  
-                   mosek.solsta.near_integer_optimal
-                 in which case the x value may not be well-defined,
-                 c.f., the MOSEK documentation.
-        
-        x        the solution
-
-    Options are passed to MOSEK solvers via the mosek.options
-    dictionary, e.g., the following turns off output from 
-    the MOSEK solvers
-    
-    >>> mosek.options = {iparam.log:0} 
-    
-    see chapter 14 of the MOSEK Python API manual.                    
-    """
-    if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
-        raise TypeError, "'c' must be a dense column matrix"
-    n = c.size[0]
-    if n < 1: raise ValueError, "number of variables must be at least 1"
-
-    if (type(G) is not matrix and type(G) is not spmatrix) or \
-        G.typecode != 'd' or G.size[1] != n:
-        raise TypeError, "'G' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n 
-    m = G.size[0]
-    if m is 0: raise ValueError, "m cannot be 0"
-
-    if type(h) is not matrix or h.typecode != 'd' or h.size != (m,1):
-        raise TypeError, "'h' must be a 'd' matrix of size (%d,1)" %m
-
-    if A is None:  A = spmatrix([], [], [], (0,n), 'd')
-    if (type(A) is not matrix and type(A) is not spmatrix) or \
-        A.typecode != 'd' or A.size[1] != n:
-        raise TypeError, "'A' must be a dense or sparse 'd' matrix "\
-            "with %d columns" %n
-    p = A.size[0]
-    if b is None: b = matrix(0.0, (0,1))
-    if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
-        raise TypeError, "'b' must be a dense matrix of size (%d,1)" %p
- 
-    c   = array(c)        
-
-    if I is None: I = set(range(n))
-
-    if type(I) is not set: 
-        raise TypeError, "invalid argument for integer index set"
-
-    for i in I:
-        if type(i) is not int: 
-            raise TypeError, "invalid integer index set I"
-
-    if len(I) > 0 and min(I) < 0: raise IndexError, \
-            "negative element in integer index set I"
-    if len(I) > 0 and max(I) > n-1: raise IndexError, \
-            "maximum element in in integer index set I is larger than n-1"
-
-    bkc = m*[ msk.boundkey.up ] + p*[ msk.boundkey.fx ]
-    blc = m*[ -inf ] + [ bi for bi in b ]
-    buc = matrix([h, b])
-
-    bkx = n*[msk.boundkey.fr] 
-    blx = n*[ -inf ] 
-    bux = n*[ +inf ]
-
-    colptr, asub, acof = sparse([G,A]).CCS
-    aptrb, aptre = colptr[:-1], colptr[1:]
-
-    mskhandle = msk.mosek ()
-    env = mskhandle.Env ()
-    env.set_Stream (msk.streamtype.log, streamprinter)
-        
-    env.init () 
-    task = env.Task(0,0) 
-    task.set_Stream (msk.streamtype.log, streamprinter) 
-
-    # set MOSEK options 
-    for (param, val) in options.items():
-        if str(param)[:6] == "iparam":
-            task.putintparam(param, val)
-        elif str(param)[:6] == "dparam":
-            task.putdouparam(param, val)
-        elif str(param)[:6] == "sparam":
-            task.putstrparam(param, val)
-        else:
-            raise ValueError, "invalid MOSEK parameter: "+str(param)
-    
-    task.inputdata (m+p, # number of constraints
-                    n,   # number of variables
-                    array(c), # linear objective coefficients  
-                    0.0, # objective fixed value  
-                    array(aptrb), 
-                    array(aptre), 
-                    array(asub),
-                    array(acof), 
-                    array(bkc),
-                    array(blc),
-                    array(buc), 
-                    array(bkx),
-                    array(blx),
-                    array(bux)) 
-
-    task.putobjsense(msk.objsense.minimize)
-
-    # Define integer variables 
-    if len(I) > 0:
-        task.putvartypelist(array(I), 
-                            array(len(I)*[ msk.variabletype.type_int ])) 
-
-    task.putintparam (msk.iparam.mio_mode, msk.miomode.satisfied) 
-
-    task.optimize()
-
-    task.solutionsummary (msk.streamtype.msg); 
-
-    prosta, solsta = list(), list()
-    if len(I) > 0:
-        task.getsolutionstatus(msk.soltype.itg, prosta, solsta)
-    else:
-        task.getsolutionstatus(msk.soltype.bas, prosta, solsta)
-        
-    x = zeros(n, Float)
-    if len(I) > 0:
-        task.getsolutionslice(msk.soltype.itg, msk.solitem.xx, 0, n, x) 
-    else:
-        task.getsolutionslice(msk.soltype.bas, msk.solitem.xx, 0, n, x) 
-    x = matrix(x)
-
-    if (solsta[0] is msk.solsta.unknown):
-        return (solsta[0], None)
-    else:
-        return (solsta[0], x)
-
-
-            
diff --git a/src/python/msk.py b/src/python/msk.py
new file mode 100644
index 0000000..e324a59
--- /dev/null
+++ b/src/python/msk.py
@@ -0,0 +1,881 @@
+"""
+CVXOPT interface for MOSEK 6.0
+"""
+
+# Copyright 2010 L. Vandenberghe.
+# Copyright 2004-2009 J. Dahl and L. Vandenberghe.
+# 
+# This file is part of CVXOPT version 1.1.3.
+#
+# CVXOPT is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# CVXOPT is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+import mosek
+from cvxopt import matrix, spmatrix, sparse
+from mosek.array import array, zeros
+env = mosek.Env()
+env.init()
+def streamprinter(text): print(text)
+env.set_Stream (mosek.streamtype.log, streamprinter)
+
+inf = 0.0
+
+options = {}
+
+def lp(c, G, h, A=None, b=None):
+    """
+    Solves a pair of primal and dual LPs 
+
+        minimize    c'*x             maximize    -h'*z - b'*y 
+        subject to  G*x + s = h      subject to  G'*z + A'*y + c = 0
+                    A*x = b                      z >= 0.
+                    s >= 0
+                    
+    using MOSEK 6.0.
+
+    (solsta, x, z, y) = lp(c, G, h, A=None, b=None).
+
+    Input arguments 
+
+        G is m x n, h is m x 1, A is p x n, b is p x 1.  G and A must be 
+        dense or sparse 'd' matrices.   h and b are dense 'd' matrices 
+        with one column.  The default values for A and b are empty 
+        matrices with zero rows.
+
+
+    Return values
+
+        solsta is a MOSEK solution status key.
+
+            If solsta is mosek.solsta.optimal, then (x, y, z) contains the 
+                primal-dual solution.
+            If solsta is mosek.solsta.prim_infeas_cer, then (x, y, z) is a 
+                certificate of primal infeasibility.
+            If solsta is mosek.solsta.dual_infeas_cer, then (x, y, z) is a 
+                certificate of dual infeasibility.
+            If solsta is mosek.solsta.unknown, then (x, y, z) are all None.
+
+            Other return values for solsta include:  
+                mosek.solsta.dual_feas  
+                mosek.solsta.near_dual_feas
+                mosek.solsta.near_optimal
+                mosek.solsta.near_prim_and_dual_feas
+                mosek.solsta.near_prim_feas
+                mosek.solsta.prim_and_dual_feas
+                mosek.solsta.prim_feas
+             in which case the (x,y,z) value may not be well-defined,
+             c.f., section 17.48 of the MOSEK Python API manual.
+        
+        x, y, z  the primal-dual solution.                    
+
+    Options are passed to MOSEK solvers via the msk.options dictionary. 
+    For example, the following turns off output from the MOSEK solvers
+    
+        >>> msk.options = {mosek.iparam.log: 0} 
+    
+    see chapter 15 of the MOSEK Python API manual.                    
+    """
+
+    if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
+        raise TypeError("'c' must be a dense column matrix")
+    n = c.size[0]
+    if n < 1: raise ValueError("number of variables must be at least 1")
+
+    if (type(G) is not matrix and type(G) is not spmatrix) or \
+        G.typecode != 'd' or G.size[1] != n:
+        raise TypeError("'G' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
+    m = G.size[0]
+    if m is 0: raise ValueError("m cannot be 0")
+
+    if type(h) is not matrix or h.typecode != 'd' or h.size != (m,1):
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %m)
+
+    if A is None:  A = spmatrix([], [], [], (0,n), 'd')
+    if (type(A) is not matrix and type(A) is not spmatrix) or \
+        A.typecode != 'd' or A.size[1] != n:
+        raise TypeError("'A' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
+    p = A.size[0]
+    if b is None: b = matrix(0.0, (0,1))
+    if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
+        raise TypeError("'b' must be a dense matrix of size (%d,1)" %p)
+ 
+    bkc = m*[ mosek.boundkey.up ] + p*[ mosek.boundkey.fx ]
+    blc = m*[ -inf ] + [ bi for bi in b ]
+    buc = matrix([h, b])
+
+    bkx = n*[mosek.boundkey.fr] 
+    blx = n*[ -inf ] 
+    bux = n*[ +inf ]
+
+    colptr, asub, acof = sparse([G,A]).CCS
+    aptrb, aptre = colptr[:-1], colptr[1:]
+
+    task = env.Task(0,0) 
+    task.set_Stream (mosek.streamtype.log, streamprinter) 
+
+    # set MOSEK options 
+    for (param, val) in options.items():
+        if str(param)[:6] == "iparam":
+            task.putintparam(param, val)
+        elif str(param)[:6] == "dparam":
+            task.putdouparam(param, val)
+        elif str(param)[:6] == "sparam":
+            task.putstrparam(param, val)
+        else:
+            raise ValueError("invalid MOSEK parameter: " + str(param))
+
+    task.inputdata (m+p, # number of constraints
+                    n,   # number of variables
+                    array(c), # linear objective coefficients  
+                    0.0, # objective fixed value  
+                    array(aptrb), 
+                    array(aptre), 
+                    array(asub),
+                    array(acof), 
+                    bkc,
+                    blc,
+                    buc, 
+                    bkx,
+                    blx,
+                    bux) 
+
+    task.putobjsense(mosek.objsense.minimize)
+
+    task.optimize()
+
+    task.solutionsummary (mosek.streamtype.msg); 
+
+    prosta, solsta = task.getsolutionstatus(mosek.soltype.bas)
+
+    x, z = zeros(n, float), zeros(m, float)
+    task.getsolutionslice(mosek.soltype.bas, mosek.solitem.xx, 0, n, x) 
+    task.getsolutionslice(mosek.soltype.bas, mosek.solitem.suc, 0, m, z) 
+    x, z = matrix(x), matrix(z)
+    
+    if p is not 0:
+        yu, yl = zeros(p, float), zeros(p, float)
+        task.getsolutionslice(mosek.soltype.bas, mosek.solitem.suc, m, 
+            m+p, yu) 
+        task.getsolutionslice(mosek.soltype.bas, mosek.solitem.slc, m, 
+            m+p, yl) 
+        y = matrix(yu) - matrix(yl)
+    else:
+        y = matrix(0.0, (0,1))
+
+    if (solsta is mosek.solsta.unknown):
+        return (solsta, None, None, None)
+    else:
+        return (solsta, x, z, y)
+
+
+def conelp(c, G, h, dims = None):
+    """
+    Solves a pair of primal and dual SOCPs
+
+        minimize    c'*x
+        subject to  G*x + s = h
+                    s >= 0
+
+        maximize    -h'*z 
+        subject to  G'*z + c = 0
+                    z >= 0 
+
+    using MOSEK 6.0.   
+
+    The inequalities are with respect to a cone C defined as the Cartesian
+    product of N + 1 cones:
+    
+        C = C_0 x C_1 x .... x C_N x C_{N+1}.
+
+    The first cone C_0 is the nonnegative orthant of dimension ml.
+    The other cones are second order cones of dimension mq[0], ..., 
+    mq[N-1].  The second order cone of dimension m is defined as
+    
+        { (u0, u1) in R x R^{m-1} | u0 >= ||u1||_2 }.
+
+    The formats of G and h are identical to that used in solvers.conelp(), 
+    except that only componentwise and second order cone inequalities are 
+    (dims['s'] must be zero, if defined).
+
+    Input arguments.
+   
+        c is a dense 'd' matrix of size (n,1).
+
+        dims is a dictionary with the dimensions of the components of C.  
+        It has three fields.
+        - dims['l'] = ml, the dimension of the nonnegative orthant C_0.
+          (ml >= 0.)
+        - dims['q'] = mq = [ mq[0], mq[1], ..., mq[N-1] ], a list of N 
+          integers with the dimensions of the second order cones C_1, ..., 
+          C_N.  (N >= 0 and mq[k] >= 1.)
+        The default value of dims is {'l': G.size[0], 'q': []}.
+
+        G is a dense or sparse 'd' matrix of size (K,n), where
+
+            K = ml + mq[0] + ... + mq[N-1].
+
+        Each column of G describes a vector 
+
+            v = ( v_0, v_1, ..., v_N, vec(v_{N+1}) )
+
+        in V = R^ml x R^mq[0] x ... x R^mq[N-1] stored as a column vector.
+
+        h is a dense 'd' matrix of size (K,1), representing a vector in V,
+        in the same format as the columns of G.
+    
+
+ 
+    Return values
+
+        solsta is a MOSEK solution status key.
+
+            If solsta is mosek.solsta.optimal,
+                then (x, zl, zq) contains the primal-dual solution.
+            If solsta is moseksolsta.prim_infeas_cer,
+                then (x, zl, zq) is a certificate of dual infeasibility.
+            If solsta is moseksolsta.dual_infeas_cer,
+                then (x, zl, zq) is a certificate of primal infeasibility.
+            If solsta is mosek.solsta.unknown,
+                then (x, zl, zq) are all None
+
+            Other return values for solsta include:  
+                mosek.solsta.dual_feas  
+                mosek.solsta.near_dual_feas
+                mosek.solsta.near_optimal
+                mosek.solsta.near_prim_and_dual_feas
+                mosek.solsta.near_prim_feas
+                mosek.solsta.prim_and_dual_feas
+                mosek.solsta.prim_feas
+            in which case the (x,y,z) value may not be well-defined,
+            c.f., section 17.48 of the MOSEK Python API manual.
+        
+        x, z the primal-dual solution.
+
+
+    Options are passed to MOSEK solvers via the msk.options dictionary, 
+    e.g., the following turns off output from the MOSEK solvers
+    
+        >>> msk.options = {mosek.iparam.log:0} 
+    
+    see chapter 15 of the MOSEK Python API manual.                    
+    """
+
+    if dims is None: 
+        (solsta, x, y, z) = lp(c, G, h)
+        return (solsta, x, z, None)
+
+    try:
+        if len(dims['s']) > 0: raise ValueError("dims['s'] must be zero")
+    except:
+        pass
+
+    N, n = G.size
+    ml, mq = dims['l'], dims['q']
+    cdim = ml + sum(mq)
+    if cdim is 0: raise ValueError("ml+mq cannot be 0")
+
+    # Data for kth 'q' constraint are found in rows indq[k]:indq[k+1] of G.
+    indq = [ dims['l'] ]  
+    for k in dims['q']:  indq = indq + [ indq[-1] + k ] 
+
+    if type(h) is not matrix or h.typecode != 'd' or h.size[1] != 1:
+        raise TypeError("'h' must be a 'd' matrix with 1 column")
+    if type(G) is matrix or type(G) is spmatrix:
+        if G.typecode != 'd' or G.size[0] != cdim:
+            raise TypeError("'G' must be a 'd' matrix with %d rows " %cdim)
+        if h.size[0] != cdim:
+            raise TypeError("'h' must have %d rows" %cdim)
+    else: 
+        raise TypeError("'G' must be a matrix")
+
+    if min(dims['q'])<1: raise TypeError(
+        "dimensions of quadratic cones must be positive")
+
+    bkc = n*[ mosek.boundkey.fx ] 
+    blc = array(-c)
+    buc = array(-c)
+
+    bkx = ml*[ mosek.boundkey.lo ] + sum(mq)*[ mosek.boundkey.fr ]
+    blx = ml*[ 0.0 ] + sum(mq)*[ -inf ]
+    bux = N*[ +inf ] 
+
+    c   = array(-h)       
+    
+    colptr, asub, acof = sparse([G.T]).CCS
+    aptrb, aptre = colptr[:-1], colptr[1:]
+
+    task = env.Task(0,0) 
+    task.set_Stream (mosek.streamtype.log, streamprinter) 
+
+    # set MOSEK options 
+    for (param, val) in options.items():
+        if str(param)[:6] == "iparam":
+            task.putintparam(param, val)
+        elif str(param)[:6] == "dparam":
+            task.putdouparam(param, val)
+        elif str(param)[:6] == "sparam":
+            task.putstrparam(param, val)
+        else:
+            raise ValueError("invalid MOSEK parameter: "+str(param))
+
+    task.inputdata (n,   # number of constraints
+                    N,   # number of variables
+                    c,   # linear objective coefficients  
+                    0.0, # objective fixed value  
+                    array(aptrb), 
+                    array(aptre), 
+                    array(asub),
+                    array(acof), 
+                    bkc,
+                    blc,
+                    buc, 
+                    bkx,
+                    blx,
+                    bux) 
+
+    task.putobjsense(mosek.objsense.maximize)
+
+    for k in xrange(len(mq)):
+        task.appendcone(mosek.conetype.quad, 0.0, 
+                        array(range(ml+sum(mq[:k]),ml+sum(mq[:k+1]))))
+    task.optimize()
+
+    task.solutionsummary (mosek.streamtype.msg); 
+
+    prosta, solsta = task.getsolutionstatus(mosek.soltype.itr)
+
+    xu, xl, zq = zeros(n, float), zeros(n, float), zeros(sum(mq), float)
+    task.getsolutionslice(mosek.soltype.itr, mosek.solitem.slc, 0, n, xl) 
+    task.getsolutionslice(mosek.soltype.itr, mosek.solitem.suc, 0, n, xu) 
+    task.getsolutionslice(mosek.soltype.itr, mosek.solitem.xx, ml, N, zq) 
+    x = matrix(xu-xl)
+    zq = matrix(zq)
+
+    if ml:
+        zl = zeros(ml, float)
+        task.getsolutionslice(mosek.soltype.itr, mosek.solitem.xx, 0, ml, 
+            zl) 
+        zl = matrix(zl)
+    else:
+        zl = matrix(0.0, (0,1))
+
+    if (solsta is mosek.solsta.unknown):
+        return (solsta, None, None)
+    else:
+        return (solsta, x, matrix([zl, zq]))
+
+
+
+def socp(c, Gl = None, hl = None, Gq = None, hq = None):
+    """
+    Solves a pair of primal and dual SOCPs
+
+        minimize    c'*x             
+        subject to  Gl*x + sl = hl      
+                    Gq[k]*x + sq[k] = hq[k],  k = 0, ..., N-1
+                    sl >= 0,  
+                    sq[k] >= 0, k = 0, ..., N-1
+
+        maximize    -hl'*zl - sum_k hq[k]'*zq[k] 
+        subject to  Gl'*zl + sum_k Gq[k]'*zq[k] + c = 0
+                    zl >= 0,  zq[k] >= 0, k = 0, ..., N-1.
+                    
+    using MOSEK 6.0.
+
+    solsta, x, zl, zq = socp(c, Gl = None, hl = None, Gq = None, hq = None)
+
+    Return values
+
+        solsta is a MOSEK solution status key.
+            If solsta is mosek.solsta.optimal,
+                then (x, zl, zq) contains the primal-dual solution.
+            If solsta is mosek.solsta.prim_infeas_cer,
+                then (x, zl, zq) is a certificate of dual infeasibility.
+            If solsta is mosek.solsta.dual_infeas_cer,
+                then (x, zl, zq) is a certificate of primal infeasibility.
+            If solsta is mosek.solsta.unknown,
+                then (x, zl, zq) are all None
+
+            Other return values for solsta include:  
+                mosek.solsta.dual_feas  
+                mosek.solsta.near_dual_feas
+                mosek.solsta.near_optimal
+                mosek.solsta.near_prim_and_dual_feas
+                mosek.solsta.near_prim_feas
+                mosek.solsta.prim_and_dual_feas
+                mosek.solsta.prim_feas
+             in which case the (x,y,z) value may not be well-defined,
+             c.f., section 17.48 of the MOSEK Python API manual.
+        
+        x, zl, zq  the primal-dual solution.
+
+
+    Options are passed to MOSEK solvers via the msk.options dictionary, 
+    e.g., the following turns off output from the MOSEK solvers
+    
+        >>> msk.options = {mosek.iparam.log: 0} 
+    
+    see chapter 15 of the MOSEK Python API manual.                    
+    """
+
+    if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
+        raise TypeError("'c' must be a dense column matrix")
+    n = c.size[0]
+    if n < 1: raise ValueError("number of variables must be at least 1")
+
+    if Gl is None:  Gl = spmatrix([], [], [], (0,n), tc='d')
+    if (type(Gl) is not matrix and type(Gl) is not spmatrix) or \
+        Gl.typecode != 'd' or Gl.size[1] != n:
+        raise TypeError("'Gl' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
+    ml = Gl.size[0]
+    if hl is None: hl = matrix(0.0, (0,1))
+    if type(hl) is not matrix or hl.typecode != 'd' or \
+        hl.size != (ml,1):
+        raise TypeError("'hl' must be a dense 'd' matrix of " \
+            "size (%d,1)" %ml)
+
+    if Gq is None: Gq = []
+    if type(Gq) is not list or [ G for G in Gq if (type(G) is not matrix 
+        and type(G) is not spmatrix) or G.typecode != 'd' or 
+        G.size[1] != n ]:
+        raise TypeError("'Gq' must be a list of sparse or dense 'd' "\
+            "matrices with %d columns" %n)
+    mq = [ G.size[0] for G in Gq ]
+    a = [ k for k in xrange(len(mq)) if mq[k] == 0 ] 
+    if a: raise TypeError("the number of rows of Gq[%d] is zero" %a[0])
+    if hq is None: hq = []
+    if type(hq) is not list or len(hq) != len(mq) or [ h for h in hq if
+        (type(h) is not matrix and type(h) is not spmatrix) or 
+        h.typecode != 'd' ]: 
+            raise TypeError("'hq' must be a list of %d dense or sparse "\
+                "'d' matrices" %len(mq))
+    a = [ k for k in xrange(len(mq)) if hq[k].size != (mq[k], 1) ]
+    if a:
+        k = a[0]
+        raise TypeError("'hq[%d]' has size (%d,%d).  Expected size "\
+            "is (%d,1)." %(k, hq[k].size[0], hq[k].size[1], mq[k]))
+
+    N = ml + sum(mq)
+    h = matrix(0.0, (N,1))
+    if type(Gl) is matrix or [ Gk for Gk in Gq if type(Gk) is matrix ]:
+        G = matrix(0.0, (N, n))
+    else:
+        G = spmatrix([], [], [], (N, n), 'd')
+    h[:ml] = hl
+    G[:ml,:] = Gl
+    ind = ml
+    for k in xrange(len(mq)):
+        h[ind : ind + mq[k]] = hq[k]
+        G[ind : ind + mq[k], :] = Gq[k]
+        ind += mq[k]
+
+    bkc = n*[ mosek.boundkey.fx ] 
+    blc = array(-c)
+    buc = array(-c)
+
+    bkx = ml*[ mosek.boundkey.lo ] + sum(mq)*[ mosek.boundkey.fr ]
+    blx = ml*[ 0.0 ] + sum(mq)*[ -inf ]
+    bux = N*[ +inf ] 
+
+    c   = -h        
+    
+    colptr, asub, acof = sparse([G.T]).CCS
+    aptrb, aptre = colptr[:-1], colptr[1:]
+
+    task = env.Task(0,0) 
+    task.set_Stream (mosek.streamtype.log, streamprinter) 
+
+    # set MOSEK options 
+    for (param, val) in options.items():
+        if str(param)[:6] == "iparam":
+            task.putintparam(param, val)
+        elif str(param)[:6] == "dparam":
+            task.putdouparam(param, val)
+        elif str(param)[:6] == "sparam":
+            task.putstrparam(param, val)
+        else:
+            raise ValueError("invalid MOSEK parameter: "+str(param))
+
+    task.inputdata (n,   # number of constraints
+                    N,   # number of variables
+                    array(c), # linear objective coefficients  
+                    0.0, # objective fixed value  
+                    array(aptrb), 
+                    array(aptre), 
+                    array(asub),
+                    array(acof), 
+                    bkc,
+                    blc,
+                    buc, 
+                    bkx,
+                    blx,
+                    bux) 
+
+    task.putobjsense(mosek.objsense.maximize)
+
+    for k in xrange(len(mq)):
+        task.appendcone(mosek.conetype.quad, 0.0, 
+                        array(range(ml+sum(mq[:k]),ml+sum(mq[:k+1]))))
+    task.optimize()
+
+    task.solutionsummary (mosek.streamtype.msg); 
+
+    prosta, solsta = task.getsolutionstatus(mosek.soltype.itr)
+
+    xu, xl, zq = zeros(n, float), zeros(n, float), zeros(sum(mq), float)
+    task.getsolutionslice(mosek.soltype.itr, mosek.solitem.slc, 0, n, xl) 
+    task.getsolutionslice(mosek.soltype.itr, mosek.solitem.suc, 0, n, xu) 
+    task.getsolutionslice(mosek.soltype.itr, mosek.solitem.xx, ml, N, zq) 
+    x = matrix(xu-xl)
+
+    zq = [ matrix(zq[sum(mq[:k]):sum(mq[:k+1])]) for k in xrange(len(mq)) ]
+    
+    if ml:
+        zl = zeros(ml, float)
+        task.getsolutionslice(mosek.soltype.itr, mosek.solitem.xx, 0, ml, 
+            zl) 
+        zl = matrix(zl)
+    else:
+        zl = matrix(0.0, (0,1))
+
+    if (solsta is mosek.solsta.unknown):
+        return (solsta, None, None, None)
+    else:
+        return (solsta, x, zl, zq)
+
+
+def qp(P, q, G=None, h=None, A=None, b=None):
+    """
+    Solves a quadratic program
+
+        minimize    (1/2)*x'*P*x + q'*x 
+        subject to  G*x <= h      
+                    A*x = b.                    
+                    
+    using MOSEK 6.0.
+
+    solsta, x, z, y = qp(P, q, G=None, h=None, A=None, b=None)
+
+    Return values
+
+        solsta is a MOSEK solution status key.
+
+            If solsta is mosek.solsta.optimal,
+                then (x, y, z) contains the primal-dual solution.
+            If solsta is mosek.solsta.prim_infeas_cer,
+                then (x, y, z) is a certificate of primal infeasibility.
+            If solsta is mosek.solsta.dual_infeas_cer,
+                then (x, y, z) is a certificate of dual infeasibility.
+            If solsta is mosek.solsta.unknown, then (x, y, z) are all None.
+
+            Other return values for solsta include:  
+                mosek.solsta.dual_feas  
+                mosek.solsta.near_dual_feas
+                mosek.solsta.near_optimal
+                mosek.solsta.near_prim_and_dual_feas
+                mosek.solsta.near_prim_feas
+                mosek.solsta.prim_and_dual_feas
+                mosek.solsta.prim_feas
+            in which case the (x,y,z) value may not be well-defined,
+            c.f., section 17.48 of the MOSEK Python API manual.
+        
+        x, z, y  the primal-dual solution.                    
+
+    Options are passed to MOSEK solvers via the msk.options dictionary, 
+    e.g., the following turns off output from the MOSEK solvers
+    
+        >>> msk.options = {mosek.iparam.log: 0} 
+    
+    see chapter 15 of the MOSEK Python API manual.                    
+    """
+
+    if (type(P) is not matrix and type(P) is not spmatrix) or \
+        P.typecode != 'd' or P.size[0] != P.size[1]:
+        raise TypeError("'P' must be a square dense or sparse 'd' matrix ")
+    n = P.size[0]
+
+    if n < 1: raise ValueError("number of variables must be at least 1")
+
+    if type(q) is not matrix or q.typecode != 'd' or q.size != (n,1):
+        raise TypeError("'q' must be a 'd' matrix of size (%d,1)" %n)
+
+    if G is None: G = spmatrix([], [], [], (0,n), 'd')
+    if (type(G) is not matrix and type(G) is not spmatrix) or \
+        G.typecode != 'd' or G.size[1] != n:
+        raise TypeError("'G' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
+
+    m = G.size[0]
+    if h is None: h = matrix(0.0, (0,1))
+    if type(h) is not matrix or h.typecode != 'd' or h.size != (m,1):
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %m)
+
+    if A is None:  A = spmatrix([], [], [], (0,n), 'd')
+    if (type(A) is not matrix and type(A) is not spmatrix) or \
+        A.typecode != 'd' or A.size[1] != n:
+        raise TypeError("'A' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
+    p = A.size[0]
+    if b is None: b = matrix(0.0, (0,1))
+    if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
+        raise TypeError("'b' must be a dense matrix of size (%d,1)" %p)
+ 
+    if m+p is 0: raise ValueError("m + p must be greater than 0")
+
+    c = array(q)        
+
+    bkc = m*[ mosek.boundkey.up ] + p*[ mosek.boundkey.fx ]
+    blc = m*[ -inf ] + [ bi for bi in b ]
+    buc = matrix([h, b])
+
+    bkx = n*[mosek.boundkey.fr] 
+    blx = n*[ -inf ] 
+    bux = n*[ +inf ]
+
+    colptr, asub, acof = sparse([G,A]).CCS
+    aptrb, aptre = colptr[:-1], colptr[1:]
+
+    task = env.Task(0,0) 
+    task.set_Stream (mosek.streamtype.log, streamprinter) 
+
+    # set MOSEK options 
+    for (param, val) in options.items():
+        if str(param)[:6] == "iparam":
+            task.putintparam(param, val)
+        elif str(param)[:6] == "dparam":
+            task.putdouparam(param, val)
+        elif str(param)[:6] == "sparam":
+            task.putstrparam(param, val)
+        else:
+            raise ValueError("invalid MOSEK parameter: "+str(param))
+
+    task.inputdata (m+p, # number of constraints
+                    n,   # number of variables
+                    array(c), # linear objective coefficients  
+                    0.0, # objective fixed value  
+                    array(aptrb), 
+                    array(aptre), 
+                    array(asub),
+                    array(acof), 
+                    bkc,
+                    blc,
+                    buc, 
+                    bkx,
+                    blx,
+                    bux) 
+
+    Ps = sparse(P)
+    I, J = Ps.I, Ps.J
+    tril = [ k for k in xrange(len(I)) if I[k] >= J[k] ]
+    task.putqobj(array(I[tril]), array(J[tril]), array(Ps.V[tril]))
+    
+    task.putobjsense(mosek.objsense.minimize)
+
+    task.optimize()
+
+    task.solutionsummary (mosek.streamtype.msg); 
+
+    prosta, solsta = task.getsolutionstatus(mosek.soltype.itr)
+
+    x = zeros(n, float)
+    task.getsolutionslice(mosek.soltype.itr, mosek.solitem.xx, 0, n, x) 
+    x = matrix(x)
+
+    if m is not 0:
+        z = zeros(m, float)
+        task.getsolutionslice(mosek.soltype.itr, mosek.solitem.suc, 0, m, 
+            z) 
+        z = matrix(z)
+    else:
+        z = matrix(0.0, (0,1))
+
+    if p is not 0:
+        yu, yl = zeros(p, float), zeros(p, float)
+        task.getsolutionslice(mosek.soltype.itr, mosek.solitem.suc, m, m+p,
+            yu) 
+        task.getsolutionslice(mosek.soltype.itr, mosek.solitem.slc, m, m+p,
+            yl) 
+        y = matrix(yu) - matrix(yl)
+    else:
+        y = matrix(0.0, (0,1))
+
+    if (solsta is mosek.solsta.unknown):
+        return (solsta, None, None, None)
+    else:
+        return (solsta, x, z, y)
+
+
+def ilp(c, G, h, A=None, b=None, I=None):
+    """
+    Solves the mixed integer LP
+
+        minimize    c'*x       
+        subject to  G*x + s = h
+                    A*x = b    
+                    s >= 0
+                    xi integer, forall i in I
+                    
+    using MOSEK 6.0.
+
+    solsta, x = ilp(c, G, h, A=None, b=None, I=None).
+
+    Input arguments 
+
+        G is m x n, h is m x 1, A is p x n, b is p x 1.  G and A must be 
+        dense or sparse 'd' matrices.   h and b are dense 'd' matrices 
+        with one column.  The default values for A and b are empty 
+        matrices with zero rows.
+
+        I is a Python set with indices of integer elements of x.  By 
+        default all elements in x are constrained to be integer, i.e.,
+        the default value of I is I = set(range(n))
+
+        Dual variables are not returned for MOSEK.
+
+
+    Return values
+
+        solsta is a MOSEK solution status key.
+            
+            If solsta is mosek.solsta.integer_optimal, then x contains 
+                the solution.
+            If solsta is mosek.solsta.unknown, then x is None.
+
+            Other return values for solsta include:  
+                mosek.solsta.near_integer_optimal
+            in which case the x value may not be well-defined,
+            c.f., section 17.48 of the MOSEK Python API manual.
+        
+        x is the solution
+
+    Options are passed to MOSEK solvers via the msk.options dictionary, 
+    e.g., the following turns off output from the MOSEK solvers
+    
+    >>> msk.options = {mosek.iparam.log: 0} 
+    
+    see chapter 15 of the MOSEK Python API manual.                    
+    """
+
+    if type(c) is not matrix or c.typecode != 'd' or c.size[1] != 1: 
+        raise TypeError("'c' must be a dense column matrix")
+    n = c.size[0]
+    if n < 1: raise ValueError("number of variables must be at least 1")
+
+    if (type(G) is not matrix and type(G) is not spmatrix) or \
+        G.typecode != 'd' or G.size[1] != n:
+        raise TypeError("'G' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
+    m = G.size[0]
+    if m is 0: raise ValueError("m cannot be 0")
+
+    if type(h) is not matrix or h.typecode != 'd' or h.size != (m,1):
+        raise TypeError("'h' must be a 'd' matrix of size (%d,1)" %m)
+
+    if A is None:  A = spmatrix([], [], [], (0,n), 'd')
+    if (type(A) is not matrix and type(A) is not spmatrix) or \
+        A.typecode != 'd' or A.size[1] != n:
+        raise TypeError("'A' must be a dense or sparse 'd' matrix "\
+            "with %d columns" %n)
+    p = A.size[0]
+    if b is None: b = matrix(0.0, (0,1))
+    if type(b) is not matrix or b.typecode != 'd' or b.size != (p,1): 
+        raise TypeError("'b' must be a dense matrix of size (%d,1)" %p)
+ 
+    c = array(c)        
+
+    if I is None: I = set(range(n))
+
+    if type(I) is not set: 
+        raise TypeError("invalid argument for integer index set")
+
+    for i in I:
+        if type(i) is not int: 
+            raise TypeError("invalid integer index set I")
+
+    if len(I) > 0 and min(I) < 0: raise IndexError(
+            "negative element in integer index set I")
+    if len(I) > 0 and max(I) > n-1: raise IndexError(
+            "maximum element in in integer index set I is larger than n-1")
+
+    bkc = m*[ mosek.boundkey.up ] + p*[ mosek.boundkey.fx ]
+    blc = m*[ -inf ] + [ bi for bi in b ]
+    buc = matrix([h, b])
+
+    bkx = n*[mosek.boundkey.fr] 
+    blx = n*[ -inf ] 
+    bux = n*[ +inf ]
+
+    colptr, asub, acof = sparse([G,A]).CCS
+    aptrb, aptre = colptr[:-1], colptr[1:]
+
+    task = env.Task(0,0) 
+    task.set_Stream (mosek.streamtype.log, streamprinter) 
+
+    # set MOSEK options 
+    for (param, val) in options.items():
+        if str(param)[:6] == "iparam":
+            task.putintparam(param, val)
+        elif str(param)[:6] == "dparam":
+            task.putdouparam(param, val)
+        elif str(param)[:6] == "sparam":
+            task.putstrparam(param, val)
+        else:
+            raise ValueError("invalid MOSEK parameter: "+str(param))
+    
+    task.inputdata (m+p, # number of constraints
+                    n,   # number of variables
+                    array(c), # linear objective coefficients  
+                    0.0, # objective fixed value  
+                    array(aptrb), 
+                    array(aptre), 
+                    array(asub),
+                    array(acof), 
+                    bkc,
+                    blc,
+                    buc, 
+                    bkx,
+                    blx,
+                    bux) 
+
+    task.putobjsense(mosek.objsense.minimize)
+
+    # Define integer variables 
+    if len(I) > 0:
+        task.putvartypelist(list(I), len(I)*[ mosek.variabletype.type_int ])
+
+    task.putintparam (mosek.iparam.mio_mode, mosek.miomode.satisfied) 
+
+    task.optimize()
+
+    task.solutionsummary (mosek.streamtype.msg); 
+
+    if len(I) > 0:
+        prosta, solsta = task.getsolutionstatus(mosek.soltype.itg)
+    else:
+        prosta, solsta = task.getsolutionstatus(mosek.soltype.bas)
+        
+    x = zeros(n, float)
+    if len(I) > 0:
+        task.getsolutionslice(mosek.soltype.itg, mosek.solitem.xx, 0, n, x) 
+    else:
+        task.getsolutionslice(mosek.soltype.bas, mosek.solitem.xx, 0, n, x) 
+    x = matrix(x)
+
+    if (solsta is mosek.solsta.unknown):
+        return (solsta, None)
+    else:
+        return (solsta, x)
diff --git a/src/python/printing.py b/src/python/printing.py
index f3e7196..29cb462 100644
--- a/src/python/printing.py
+++ b/src/python/printing.py
@@ -1,6 +1,7 @@
+# Copyright 2010 L. Vandenberghe.
 # Copyright 2004-2009 J. Dahl and L. Vandenberghe.
 # 
-# This file is part of CVXOPT version 1.1.2
+# This file is part of CVXOPT version 1.1.3.
 #
 # CVXOPT is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -31,7 +32,7 @@ def matrix_str_default(X):
 
     sgn = ['-','+']
 
-    if   X.typecode is 'i': fmt = iformat
+    if   X.typecode == 'i': fmt = iformat
     else: fmt = dformat
 
     s = ""
@@ -41,11 +42,11 @@ def matrix_str_default(X):
 
     if width*height is 0: return ""
     if len(X) is 0: return ""
- 
+
     rlist = range(0,min(m,height))
     clist = range(0,min(n,width))
 
-    if X.typecode is 'z':
+    if X.typecode == 'z':
         twidth = max([ len(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' + \
                               (fmt % abs(X[i,j].imag)).lstrip() ) \
                           for i in rlist for j in clist ])
@@ -57,7 +58,7 @@ def matrix_str_default(X):
 
         for j in clist:
 
-            if X.typecode is 'z':
+            if X.typecode == 'z':
                 s += rjust(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' + \
                                (fmt % abs(X[i,j].imag)).lstrip(),twidth) 
             else:
@@ -90,7 +91,7 @@ def spmatrix_str_default(X):
 
     sgn = ['-','+']
 
-    if   X.typecode is 'i': fmt = iformat
+    if   X.typecode == 'i': fmt = iformat
     else: fmt = dformat
 
     s = ""
@@ -108,7 +109,7 @@ def spmatrix_str_default(X):
     Zero = '0'
     
     if len(Idx) > 0:
-        if X.typecode is 'z':
+        if X.typecode == 'z':
             twidth = max([ len(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' + \
                                   (fmt % abs(X[i,j].imag)).lstrip() ) \
                               for i in rlist for j in clist ])
@@ -123,7 +124,7 @@ def spmatrix_str_default(X):
         for j in clist:
 
             if (i,j) in Idx:
-                if X.typecode is 'z':
+                if X.typecode == 'z':
                     s += rjust(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' + \
                                    (fmt % abs(X[i,j].imag)).lstrip(),twidth)
                 else:
@@ -154,14 +155,13 @@ def spmatrix_str_triplet(X):
 
     sgn = ['-','+']
 
-    if   X.typecode is 'i': fmt = iformat
+    if   X.typecode == 'i': fmt = iformat
     else: fmt = dformat
 
     s = ""
-    #s = "<%ix%i sparse matrix with %i non-zeros>\n" %(m, n, len(X))
     
     if len(X) > 0:
-        if X.typecode is 'z':
+        if X.typecode == 'z':
             twidth = max([ len(fmt % Xk.real + sgn[Xk.imag>0] + 'j' + \
                                    (fmt % abs(Xk.imag)).lstrip() ) \
                                for Xk in X.V ])
diff --git a/src/python/solvers.py b/src/python/solvers.py
index 63d6c40..aefc2a6 100644
--- a/src/python/solvers.py
+++ b/src/python/solvers.py
@@ -13,9 +13,10 @@ socp:     solves second-order cone programs.
 options:  dictionary with customizable algorithm parameters.
 """
 
+# Copyright 2010 L. Vandenberghe.
 # Copyright 2004-2009 J. Dahl and L. Vandenberghe.
 # 
-# This file is part of CVXOPT version 1.1.2
+# This file is part of CVXOPT version 1.1.3.
 #
 # CVXOPT is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/src/setup.py b/src/setup.py
index c6959bf..4704b39 100644
--- a/src/setup.py
+++ b/src/setup.py
@@ -148,7 +148,7 @@ extmods += [base, blas, lapack, umfpack, cholmod, amd, misc_solvers]
 
 setup (name = 'cvxopt', 
     description = 'Convex optimization package',
-    version = '1.1.2', 
+    version = '1.1.3', 
     long_description = '''
 CVXOPT is a free software package for convex optimization based on the 
 Python programming language. It can be used with the interactive Python 
@@ -159,7 +159,7 @@ applications straightforward by building on Python's extensive standard
 library and on the strengths of Python as a high-level programming 
 language.''', 
     author = 'J. Dahl and L. Vandenberghe',
-    author_email = 'joachim at es.aau.dk, vandenbe at ee.ucla.edu',
+    author_email = 'dahl.joachim at gmail.com, vandenbe at ee.ucla.edu',
     url = 'http://abel.ee.ucla.edu/cvxopt',
     license = 'GNU GPL version 3',
     ext_package = "cvxopt",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cvxopt.git



More information about the debian-science-commits mailing list