title: CVXOPT QP SOLVER : TypeError: 'A' must be a 'd' matrix with 10 columns
body: <p>I'm having trouble with the CVXOPT QP Solver lately: I keep receiving the <strong>TypeError: 'A' must be a 'd' matrix with 10 columns</strong> error while I had, indeed, a matrice A of dimension (10,10) and of type d.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import numpy as np
  from cvxopt import matrix
  from cvxopt import solvers
  
  var_all_numpy= np.array([[4,2,4,6,8,6,12,10,8,6],[8,4,6,6,8,10,6,6,2,2]])
  var_1_numpy = np.array([4,2,4,6,8,6,12,10,8,6])
  var_2_numpy = np.array([8,4,6,6,8,10,6,6,2,2])
  y_numpy = np.array([-1,-1,-1,-1,-1,-1,1,1,1,1])
  var = matrix(np.concatenate((var_1_numpy.reshape(-1,1),var_2_numpy.reshape(-1,1)),axis=1),tc='d')
  
  Gram = np.dot(var,np.transpose(var))
  print(Gram)
  
  H = matrix(np.multiply(np.dot(y_numpy,np.transpose(y_numpy)),Gram),tc='d')
  A = -np.array([[1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],[0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],[0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],[0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0]])
  A = A.astype(np.double)
  A = matrix(A,tc='d')
  
  B = matrix(np.zeros((10,1)),tc='d')
  Aeq = matrix(np.transpose(y_numpy),tc='d')
  Beq = matrix(0,tc='d')
  ones = -matrix(np.ones((10,1)),tc='d')
  
  sol = solvers.qp(H,ones,A,B,Aeq,Beq)
  </code></pre>
  
  <p>Here is the error:</p>
  
  <pre><code>-----------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
   in 
       18 Beq = matrix(0,tc='d')
       19 ones = -matrix(np.ones((10,1)),tc='d')
  ---&gt; 20 sol = solvers.qp(H,ones,A,B,Aeq,Beq)
  
  /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cvxopt/coneprog.py in qp(P, q, G, h, A, b, solver, kktsolver, initvals, **kwargs)
     4483             'residual as dual infeasibility certificate': dinfres}
     4484 
  -&gt; 4485     return coneqp(P, q, G, h, None, A,  b, initvals, kktsolver = kktsolver, options = options)
  
  /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cvxopt/coneprog.py in coneqp(P, q, G, h, dims, A, b, initvals, kktsolver, xnewcopy, xdot, xaxpy, xscal, ynewcopy, ydot, yaxpy, yscal, **kwargs)
     1912         if A.typecode != 'd' or A.size[1] != q.size[0]:
     1913             raise TypeError("'A' must be a 'd' matrix with %d columns" \
  -&gt; 1914                 %q.size[0])
     1915         def fA(x, y, trans = 'N', alpha = 1.0, beta = 0.0):
     1916             base.gemv(A, x, y, trans = trans, alpha = alpha, beta = beta)
  
  TypeError: 'A' must be a 'd' matrix with 10 columns
  </code></pre>
  
  <p>Apparently this has been a recurrent error for a lot of user. I tried everything that I saw on stackoverflow (defining the matrice by hand as I did it here, using astype to make it a float...) but it still doesn't work.</p>
  
  <p>I x-checked that: I do have a (10,10) matrix that is 'd'.</p>
  
  <p><strong>What is the problem? Why CVXOPT doesn't work in this case ?</strong></p>