def matrix_frac(X, P): if isinstance(P, np.ndarray): return QuadForm(X, LA.inv(P)) else: return MatrixFrac(X, P)
def matrix_frac(X, P): if isinstance(P, np.ndarray): invP = LA.inv(P) return QuadForm(X, (invP + np.conj(invP).T) / 2.0) else: return MatrixFrac(X, P)
def matrix_frac(X, P): if isinstance(P, np.ndarray): invP = np.matrix(LA.inv(P)) return QuadForm(X, (invP + invP.H) / 2.0) else: return MatrixFrac(X, P)
def setUp(self): self.x = Variable(2, name='x') self.Q = np.eye(2) self.c = np.array([1, 0.5]) self.qp = Problem(Minimize(QuadForm(self.x, self.Q)), [self.x <= -1]) self.cp = Problem(Minimize(self.c.T * self.x + 1), [self.x >= 0])