[SciPy-user] openopt vs. cvxopt, 'f' vs. 'd','z'

Mclean Edwards mcleane at math.ubc.ca
Tue Jan 29 01:27:50 EST 2008


Dmitrey:

There seems to be a problem with openopt/cvxopt working together.

I am using double ('d') for my cvxopt.base.matrix matrices, and so the 
line 27 in QP.py:

kwargs[fn] = asarray(kwargs[fn], float)

caused the program to crash since it tried to treat the double values as 
floating point.

Removing the 'float' and recompiling led to
'Array not contiguous' error.

I admit I'm not too such what this means exactly, and was only able to
discover that arrays can be ordered in a contiguous fashion or in a 
FORTRAN fashion.

Replacing the above line (27 in QP.py in Rev 166) with:

kwargs[fn] = asarray(kwargs[fn], order='C')

fixes this problem (by forcing the new array to be contiguous).
However errors eventually occur with the other 
values, so the for loop initial line (25) needed to be changed to:

for fn in ('H', 'f', 'A', 'b', 'Aeq', 'beq', 'lb', 'ub'):

Recompiling openopt with these changes
results in no more errors in my code.
I have not tested this for matrix(*, 'z') formats,
but it seems to work for the standard floating point format.

I do not understand the note:
#TODO: handle the case in runProbSolver()
but perhaps the original reason for casting to float has now disappeared 
with more recent changes to runProbSolver().
(I am running off of Subversion's most recent code base.)

I am running cvxopt version 0.8.1 (there is a problem with the QP solver 
in the most recent version 0.9.2).

Cheers,

Mclean



More information about the SciPy-User mailing list