- #1

Master1022

- 611

- 117

- TL;DR Summary
- I am trying to run a semidefinite program in Python using CVXPy. I have gone to the documentation and the example code in there doesn't run in Google Colab for me and yields the error: 'Error parsing inputs'.

Hi,

Why is the error 'Error parsing inputs' in CVXPy occurring?

I am trying to solve a semidefinite program in CVXPy (using Google Colab). I went to the documentation (

Any help would be greatly appreciated

**Question:**Why is the error 'Error parsing inputs' in CVXPy occurring?

**Context:**I am trying to solve a semidefinite program in CVXPy (using Google Colab). I went to the documentation (

__HERE__) and I copied the example code into a cell. It doesn't work for some reason and I don't understand why. It is throwing the following message: 'Error parsing inputs'. Why is this happening?**Code:**
CVXPy Semidefinite Code Documentation Example:

```
# Import packages.
import cvxpy as cp
import numpy as np
# Generate a random SDP.
n = 3
p = 3
np.random.seed(1)
C = np.random.randn(n, n)
A = []
b = []
for i in range(p):
A.append(np.random.randn(n, n))
b.append(np.random.randn())
# Define and solve the CVXPY problem.
# Create a symmetric matrix variable.
X = cp.Variable((n,n), symmetric=True)
# The operator >> denotes matrix inequality.
constraints = [X >> 0]
constraints += [
cp.trace(A[i] @ X) == b[i] for i in range(p)
]
prob = cp.Problem(cp.Minimize(cp.trace(C @ X)),
constraints)
prob.solve()
# Print result.
print("The optimal value is", prob.value)
print("A solution X is")
print(X.value)
```