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

Use geqp3rk routine in LAPACK 3.12 for performing pqrfact #60

Open
ajinkya-k opened this issue Dec 10, 2024 · 1 comment · May be fixed by #61
Open

Use geqp3rk routine in LAPACK 3.12 for performing pqrfact #60

ajinkya-k opened this issue Dec 10, 2024 · 1 comment · May be fixed by #61

Comments

@ajinkya-k
Copy link

ajinkya-k commented Dec 10, 2024

Starting in LAPACK v3.12.0, there is a routine geqp3rk (double precision subroutine here), that performs a truncated QR factorization based on of three stopping conditions:

  • kmax: if an integer kmax is provided, it provides a QR factorization truncated at kmax columns, i.e. its the same as pqrfact(A; sketch=:none, rank = kmax)
  • abstol: if provided stops when pivot element has value less than the tolerance, similar to pqrfact(A; sketch=:none, atol = abstol)
  • reltol: similar to above but uses reltol instead, similar to pqrfact(A; sketch=:none, rtol = reltol)

That is, there is now a lapack routine to do exactly what perfect does.

I think we should be using this going forward, since it seems to be a little bit faster than the Julia native implementation that is the function geqp3_adap_main!.

There is one major caveat: I am still not sure why but the R factor differs a little when the stopping criteria are abstol or reltol. Submitting a PR related to this.

@ajinkya-k
Copy link
Author

Okay so it seems the discrepancy in the factor R is only due to the permutation of the columns after the numerical rank. In the image below, jpvt is the permutation vector produced from my implementation, and lra.p is the permutation from pqrfact(). Similarly, triu(Ap[1:rnk, :]) is the R factor from my implementation, and lra.R is from pqrfact
image

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