title: How to invert a matrix of variables in cvxpy?
body: <p>How do I invert a matrix of variables in cvxpy?</p>
  
  <p>I have a matrix of problem variables defined as follows:</p>
  
  <pre><code>import cvxpy as cp
  A = cp.Variable(2,2)
  </code></pre>
  
  <p>and I want to solve a program with an objective function involving the <em>inverse</em> of this matrix. I have tried almost every method I could possibly think of (including manually defining the inverse matrix), but nothing seems to work.  </p>
  
  <p>The full code for my problem is:</p>
  
  <pre><code>A = cp.Variable((2,2)) # matrix A is 2X2
  c = cp.Variable(2) # center of 2d ellipsoid
  
  constraints = [A &gt;&gt; 0]
  constraints += [cp.pnorm(cp.matmul(A, v[i] - cp.matmul(A,c)), p=2) &lt;= np.array([1,1]) for i in range(10)]
  
  # this is where I'm stuck. Using np.linalg.inv doesn't work.
  # I also can't seem to calculate this inverse manually 
  obj_fn = cp.log_det(np.linalg.inv(A))
  
  prob = cp.Problem(cp.Minimize(obj_fn), constraints)
  prob.solve(solver='CVXOPT')
  </code></pre>