-
Notifications
You must be signed in to change notification settings - Fork 573
lapack/gonum: add Dgetc2 #1655
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
lapack/gonum: add Dgetc2 #1655
Conversation
|
This should go into The test should follow the |
|
Got confused since the page says "BLAS Level 2 Algorithm". will fix. Thanks for the suggestions! |
vladimir-ch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see what Github does with these review comments done when the code was still in the blas directory.
No worries. Some Lapack routines come in 2 variants, a simpler one that uses BLAS Level 2 and operates on columns/rows, and a more complex one that uses BLAS Level 3, operates on blocks and should be more performant. The comment here means that this routine uses BLAS Level 2. |
Ok, it shows them as outdated but they are of course all still valid. |
|
I'm at a loss as to how to construct the permutation matrices from pivot indices. Cholesky factorization function does not have a similar implementation. |
|
Why do you need to construct a permutation matrix? |
vladimir-ch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dgetc2 looks almost ok now, I haven't looked at the test because you're still working on it.
|
@kortschak I'm way out of my element here, but I'd thought that a good way to test What my test is doing thus far is checking if the permutation indices yield unique combinations, which I'm not even sure is an expected result. It is failing for now. |
Yes, reconstructing A is the way to test Dgetc2 but you don't need to form P and Q explicitly and multiply, you can use ipiv and jpiv to swap rows/columns to achieve the same effect.
Testing the content of ipiv and jpiv is easy and will not hurt. I would fill them with negative numbers before calling Dgetc2, then make their copies, sort the copies and then check that ipivCopy[i] == i for all i. Then I would use ipiv, jpiv to reconstruct A. |
I got around to implementing this and letting it fail. I've read the code and compared it with reference but nothing seems out of place. Any ideas on what I should be looking out for? For the time being |
|
That's my fault, I didn't pay enough attention to how the permutations are represented in ipiv and jpiv. Now I see there is not much that can be tested except that all elements of ipiv, jpiv are set, in your case that no element is -1. After that you should focus on checking that A can be reconstructed from the factorization. |
There's definitely more to reconstructing A than swapping columns and rows. I did just that in my test but noticed the lines for j := i + 1; j < n; j++ {
a[j*lda+i] /= a[i*lda+i]
}
bi.Dger(n-i-1, n-i-1, -1.0, a[(i+1)*lda+i:], lda, a[i*lda+i+1:], 1, a[(i+1)*lda+i+1:], lda)modify |
Yes, Dgetc2 stores the L and U triangular factors in-place into a (and P and Q into ipiv and jpiv). |
First: thanks for the hint, I was not aware of permutation matrices. I'm feeling good about where the test is at, |
|
@kortschak This branch is ready to merge. |
vladimir-ch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please remove lapack/.gitignore.
Codecov Report
@@ Coverage Diff @@
## master #1655 +/- ##
==========================================
- Coverage 73.22% 73.21% -0.01%
==========================================
Files 504 505 +1
Lines 59811 59867 +56
==========================================
+ Hits 43794 43831 +37
- Misses 13537 13553 +16
- Partials 2480 2483 +3
Continue to review full report at Codecov.
|
|
Changes to tests done as per your suggestion. Removed those cases generated by the reference since they may fail depending on implementation details. |
vladimir-ch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for your contribution and following our guidance. I will squash the commits before merging and then submit a PR cleaning up a few nits.
I think this is your first contribution; @kortschak , what is the process?
|
I found it
@soypat , can you submit a new PR where you add yourself to those two files? |
|
Make the commit message "A+C: add Patricio Whittingslow" in the other PR. |
Blas routine
dgetc2is added. Related issue #1651I'd like some guidance on testing. I've looked at tests in the BLAS package and they're all quite different from what I've seen in the LAPACK package. What stands out to me particularily is the tables:
Is this the way to go?