- >>> K = SymmetricPSD(2)
- >>> [[1,2],[2,3]] in K
- Traceback (most recent call last):
- ...
- TypeError: the given point is not a cvxopt.base.matrix
-
- >>> K = SymmetricPSD(3)
- >>> matrix([[1,2],[3,4]]) in K
- Traceback (most recent call last):
- ...
- TypeError: the given point has the wrong dimensions
-
- """
- if not isinstance(point, matrix):
- raise TypeError('the given point is not a cvxopt.base.matrix')
- if not point.size == (self.dimension(), self.dimension()):
- raise TypeError('the given point has the wrong dimensions')
- if not point.typecode == 'd':
- point = matrix(point, (self.dimension(), self.dimension()), 'd')
- return all([e >= 0 for e in eigenvalues(point)])