title: From CVX to CVXPY or CVXOPT
body: <p>I've been trying to pass some code from Matlab to Python. I have the same convex optimization problem working on Matlab but I'm having problems passing it to either CVXPY or CVXOPT.</p>
  
  <pre><code>n = 1000;
  i = 20;
  y = rand(n,1);
  A = rand(n,i);
  cvx_begin
  variable x(n);
  variable lambda(i);
  minimize(sum_square(x-y));
  subject to
      x == A*lambda;
      lambda &gt;= zeros(i,1);
      lambda'*ones(i,1) == 1;
  cvx_end
  </code></pre>
  
  <p>This is what I tried with <strong>Python</strong> and <strong>CVXPY</strong>.</p>
  
  <pre><code>import numpy as np
  from cvxpy import *
  
  # Problem data.
  n = 100
  i = 20
  np.random.seed(1)
  y = np.random.randn(n)
  A = np.random.randn(n, i)
  
  # Construct the problem.
  x = Variable(n)
  lmbd = Variable(i)
  objective = Minimize(sum_squares(x - y))
  constraints = [x == np.dot(A, lmbd),
                 lmbd &lt;= np.zeros(itr),
                 np.sum(lmbd) == 1]
  
  prob = Problem(objective, constraints)
  
  print("status:", prob.status)
  print("optimal value", prob.value)
  </code></pre>
  
  <p>Nonetheless, it's not working. Does any of you have any idea how to make it work? I'm pretty sure my problem is in the <strong>constraints</strong>. And also it would be nice to have it with CVXOPT.</p>