def retr(self, X, G):
// Calculate "thin" qr decomposition of X + G
q, r = np.linalg.qr(X + G)
return q
def egrad2rgrad(self, X, G):
// Project G into the tangent space
GNew = G - np.dot(X, np.dot(X.T, G))
After Change
// Calculate "thin" qr decomposition of X + G
q, r = np.linalg.qr(X + G)
// Unflip any flipped signs
XNew = np.dot(q, np.diag(np.sign(np.sign(np.diag(r))+.5)))
return XNew
else:
XNew = X + G
for i in xrange(self._k):
q, r = np.linalg.qr(Y[i])