'Test positive definite constraints.'

def test_psd_constraints(self):

    C = Variable(3, 3)
    obj = Maximize(C[(0, 2)])
    constraints = [(diag(C) == 1), (C[(0, 1)] == 0.6), (C[(1, 2)] == (-0.3)), (C == C.T), (C >> 0)]
    prob = Problem(obj, constraints)
    result = prob.solve()
    self.assertAlmostEqual(result, 0.583151, places=2)
    C = Variable(2, 2)
    obj = Maximize(C[(0, 1)])
    constraints = [(C == 1), (C >> [[2, 0], [0, 2]])]
    prob = Problem(obj, constraints)
    result = prob.solve()
    self.assertEqual(prob.status, s.INFEASIBLE)
    C = Symmetric(2, 2)
    obj = Minimize(C[(0, 0)])
    constraints = [(C << [[2, 0], [0, 2]])]
    prob = Problem(obj, constraints)
    result = prob.solve()
    self.assertEqual(prob.status, s.UNBOUNDED)
