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

LAPACKE_?larfb_work: bad work matrix layout #37

Open
vladimir-ch opened this issue Aug 30, 2016 · 2 comments
Open

LAPACKE_?larfb_work: bad work matrix layout #37

vladimir-ch opened this issue Aug 30, 2016 · 2 comments

Comments

@vladimir-ch
Copy link
Contributor

vladimir-ch commented Aug 30, 2016

LAPACKE_?larfb_work passes work and ldwork to the Fortran routine unmodified even if the matrix layout is row major. This is extremely surprising bordering a bug because it means that the work matrix has to be column major while all the other matrices are treated as row major. Interestingly, LAPACKE_?larfb follows the game and the work matrix it allocates (due to ldwork it uses) is column major.

I might be wrong but the only reasonable solution I see is not to allocate work in LAPACKE_?larfb and allocate it in LAPACKE_?larfb_work instead while ignoring work and ldwork parameters passed to it.

It seems that LAPACKE_?tprfb_work and LAPACKE_?trsna_work suffer from the same problem.

@vladimir-ch
Copy link
Contributor Author

Have you been able to confirm this? If you think it is a bug and if you agree with the solution I propose, I could submit a patch.

vladimir-ch added a commit to gonum/lapack that referenced this issue Sep 29, 2016
kortschak pushed a commit to gonum/lapack that referenced this issue Oct 13, 2016
kortschak added a commit to gonum/lapack that referenced this issue Oct 13, 2016
cgo: add Dlarf[bgt]

Include temporary work around for Reference-LAPACK/lapack#37.
@scr2016 scr2016 assigned langou and julielangou and unassigned langou Apr 12, 2017
@vladimir-ch
Copy link
Contributor Author

Recently I've been thinking about this issue again and even after this long time I'm still unsure whether lapacke should allocate a new work matrix or not. I lean towards yes. For example, LAPACKE_dlange_work does allocate a new work array in case of 1-norm (which translates to inf-norm for the Fortran call). This suggests that the author was aware that in a row-major implementation the work array is needed/useful in a different situation than in the Fortran implementation. However, this allocation does not happen in LAPACKE_dlantr_work (which has caused me a lot of pain in our Gonum interface before I figured it out). In other words, there is an inconsistence between LAPACKE_dlange_work, which allocates, and a bunch of other function, which don't and therefore cause surprises.

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

No branches or pull requests

3 participants