Polar decomposition of a matrix

I need to compute polar decomposition (PD) of matrices https://en.wikipedia.org/wiki/Polar_decomposition. I tried to install this package https://github.com/weijianzhang/PolarFact.jl, but I’m getting this error:

ERROR: The following package names could not be resolved:

  • PolarFact (not found in project, manifest or registry)

I tried with this approach https://stackoverflow.com/questions/53198762/adding-a-package-in-julia-error-the-following-package-names-could-not-be-resolv, but it’s not working.

Is there another package available to compute PD or any way to install PolarFact?

Thanks in advance!

That package was written for Julia 0.4. It would need to be updated to be compatible with Julia 1.x.

Do you need all of the algorithms from that package? If you’re happy with just the SVD approach, you could implement the formula from the Wikipedia article in about two lines of Julia.

3 Likes

Thanks for your answer. Yes, I’ve been using the SVD, but it makes the entire program too slow. So, I was expecting PolarFact to compute it much faster. Shouldn’t I expect to find a faster way of computing the PD?

The package appears to use a qr factorization which is about 2x faster than svd. Would that be enough to make it fast enough?

Thanks for you comment.

“The package appears to use a qr factorization”

You mean PolarFact?

Yes

Maybe that would help, I’d have to implement the code and see.

I submitted a PR to update PolarFact to Julia 1.x. You can clone the PR branch to try the other algorithms if you like.

9 Likes

Nice PR! Hopefully the maintainer is around to merge it.

weijianzhang (Weijian Zhang) · GitHub looks like a no to me

Maybe time to fork the repo then?

3 Likes

And rename it to PolarFactorization.jl

EDIT: Or PolarDecomposition.jl

Or add it to one of the existing linear algebra packages, like GenericLinearAlgebra.jl

3 Likes

Also might be a good idea to do some benchmarking to find the best algorithm, and delete the rest.

2 Likes

You could add it to MatrixFactorizations.jl

4 Likes

It’s not as simple as one algorithm being “the best”. It will depend on matrix size, sparsity structure, and how close it is to being unitary.

3 Likes