[Numpy-discussion] trouble with numpy.float64 multiplied with cvxopt.matrix

Jonathan Stickel jjstickel at gmail.com
Tue Jul 2 17:07:14 EDT 2013


I recently ran into some trouble with multiplying scalar variables of 
type numpy.float64 with cvxopt matrices. The cvxopt matrix is converted 
to a numpy array. I first reported this at the cvxopt google groups, 
where I give an example:

https://groups.google.com/forum/#!topic/cvxopt/4suFNOY75E4

The response I got is that it would be difficult to correct this in 
cvxopt, and that a workaround would be to do A*s rather than s*A (where 
s is the scalar of type numpy.float64 and A is the cvxopt matrix). I 
inferred from this that the leading object takes charge of how operator 
works, including the type conversion.

Now, I don't know much about low-level programming for operators and 
type conversion, but I want to ask whether this should be considered a 
bug or whether correcting this might be a reasonable feature request in 
numpy. It seems to me that scalars of any numpy type, when operated with 
other objects, should not change the high-level type of those objects.

Thanks,
Jonathan



More information about the NumPy-Discussion mailing list