Python: Python3.2 CVXOPT: 1.1.5 NumPy: 1.6.1
我阅读了http://abel.ee.ucla.edu/cvxopt/examples/tutorial/numpy.html
import cvxopt
import numpy as np
cvxopt.matrix(np.array([[7, 8, 9], [10, 11, 12]]))
我获得了
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: non-numeric element in list
通过np.array(cvxopt.matrix([[7, 8, 9], [10, 11, 12]]))
,我得到了:
array([[b'\x07', b'\n'],
[b'\x08', b'\x0b'],
[b'\t', b'\x0c']],
dtype='|S8')
numpy.array
时,您可以尝试强制使用dtype=float
。 - Pierre GM