# Why am I getting this DCPError when my matrix is PSD?

import cvxpy as cp
import numpy as np

n = 3
PP = cp.Variable((n,n),"PP")
KK = [[2,1,3],[1,2,1],[3,1,2]]
s = np.array([[.1, .4, .5]]).T
t = np.array([[.4, .2, .4]]).T
e = np.ones((n,1))
x = PP.T@e - s
y = PP@e - t
for b in range(1,21):
prob = cp.Problem(cp.Minimize(obj),[PP>=0,cp.sum(PP)==1])
obj=prob.solve()
print("status:",prob.status)
print("obj:",obj)
print(PP.value)


When I run this, I get

cvxpy.error.DCPError: Problem does not follow DCP rules. Specifically:
The objective is not DCP. Its following subexpressions are not:
[1.]
[1.]] + -[[0.1]
[0.4]
[0.5]], [[2. 1. 3.]
[1. 2. 1.]
[3. 1. 2.]])


I don't see why I'm getting this error when my matrix KK is clearly PSD. Why is this happening?

==========

Duplicate here at https://stackoverflow.com/q/60745793/649090