Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpose instead of PseudoInverse #2

Open
unrealwill opened this issue Jan 8, 2025 · 2 comments
Open

Transpose instead of PseudoInverse #2

unrealwill opened this issue Jan 8, 2025 · 2 comments

Comments

@unrealwill
Copy link

In the blog https://ocramz.github.io/posts/2023-12-21-assignment-riemann-opt.html for the definition of the projection you wrote

α = (I − xx⊤)⊤(z − xz⊤)1

The middle T should be a dagger meaning "left pseudo-inverse" according to the referenced paper [4] https://arxiv.org/abs/1802.02628

In the corresponding code

alpha, beta = self._lsolve(x, b)

you seem to be doing some sort of inversion I don't understand but is probably the intended left pseudo inverse.

def _lsolve(self, x, b):
# TODO: A better way to solve it is implemented in `_optimLSolve`
# Once Pytorch gains support for `LinearOperator`/scipy like `cg`
# function, it can be used.
alpha = torch.empty((self._k, self._n))
beta = torch.empty((self._k, self._m))
for i in range(self._k):
A = torch.cat((torch.cat((torch.diag(self._p[i]), x[i]), dim=-1), torch.cat((x[i].T, torch.diag(self._q[i])), dim=-1)), dim=0)
zeta = torch.linalg.solve(A, b[i])
alpha[i], beta[i] = zeta[:self._n], zeta[self._n:]
return alpha, beta

Doesn't this inversion computational O(n^3) cost per iteration, render the whole exercise pointless (aka complexity >> Munkres ) ?

@ocramz
Copy link
Owner

ocramz commented Jan 8, 2025 via email

@unrealwill
Copy link
Author

Thanks for your quick response, HN front page brought me to your your blog post.

Have you empirically checked that the projection on the tangent is indeed correct when you use transpose instead of dagger (I would find it very surprising even when the matrix is symmetric which I-XXT is, the left pseudo inverse is something different) ?

The tangent space is defined by equation (21), meaning all rows and all columns sum to 0, so it should be quite easy to check whether or not the point is on the tangent space or not.

Coming back to your lsolve of a previous version, I think you were trying to implement the "Remark 2" of the reference paper, but you were doing some splitting along "k" I don't understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants