-
Notifications
You must be signed in to change notification settings - Fork 436
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
The matrix size of LAPACKE_sge_trans in lapacke_sgeqrt_work.c seems to be not correct #766
Comments
Thanks. I agree this is an issue, and your proposed change would fix it. Can you please submit a pull request for LAPACKE_sgeqrt? And also LAPACKE_cgeqrt, LAPACKE_dgeqrt, and LAPACKE_zgeqrt? |
I want to follow up on this issue, the proposed fix corrects the segmentation fault and this is a good thing. However there is something that I do not like in how this LAPACKE routine works. The process, right now, is (1) the user works in row major, () they give an array T for the T matrix, () column major LAPACK works in the lower parts of T, (*) in order to return in row major, we transpose the array T. However, we could ask ourselves whether it is OK for LAPACK to write in the strictly lower parts of T. As of now, I am reading the headers of DGEQRT and there is no promise to leave the strictly lower parts of T unchanged. So what LAPACKE does not break the headers. But we can wonder whether we want to make the header of DGEQRT more strict and guarantee that LAPACK will not write in the strictly lower parts of T. All in all, I think maybe, in LAPACKE, we should (step 1) transpose T before calling Column Major LAPACK, (step 2) call Column Major LAPACK, and (step 3) transpose T after. This is the same as what is done to the array A. My preference would be do add a LAPACKE_sge_trans(LAPACK_COL_MAJOR, nb, MIN(m,n), t_t, ldt_t, t, ldt ); before calling LAPACK_dgeqrt( &m, &n, &nb, a_t, &lda_t, t_t, &ldt_t, work, &info ); (And one after too as proposed by @sbite0138.) |
Thank you for your response.
I see. I agree with this method of implementation. I will create a PR using the method you suggested. |
Sorry for the delay. I created a pull request. lapack/LAPACKE/src/lapacke_sgeqrt_work.c Line 48 in 77fac7e
Here, ldt is the leading dimension of t , and since t is a row major, ldt is the "horizontal" length.On the other hand, since ldt_t is the leading dimension of t_t and t_t is col major, this value should be a "vertical" length.
I think the value of lapack_int ldt_t = MAX(1,nb); The pull request also reflects the above change, but if I have misunderstood, I would appreciate it if you could point this out to me. |
Hi @sbite0138 I think we want to leave the line lapack/LAPACKE/src/lapacke_sgeqrt_work.c Line 48 in 77fac7e
@scr2016: can you pitch in? Julien. |
Hi @langou I am very sorry for the delay in replying.
OK, I have pushed back the changes regarding ldt_t. |
If T has a leading dimension, (meaning lapack_int ldt_t = MAX(1,nb); then the code will write in some part of the This is only when Julien. |
Thank you for your response. I apologize for the late reply.
Just to confirm, does this mean that any write to Please let me know if there are any other considerations that I am missing. |
Description
When LAPACKE_sgeqrt is executed with row major, the following code is executed to convert the result obtained with column major to row major.
lapack/LAPACKE/src/lapacke_sgeqrt_work.c
Lines 82 to 83 in 77fac7e
Here,
ldt * MIN(m,n)
should be the number of elements int_t
(= the number of elements int
), but this expression takes more values whenldt > nb
nb > n
.This causes a segmentation fault when
LAPACKE_sgeqrt
is executed with row major andldt > n
.Here is an example that causes the problem:
Shouldn't this line look like this?
I'm thinking that other
LAPACKE_*geqrt
functions may contain similar problems.Checklist
The text was updated successfully, but these errors were encountered: