Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

cgo: Dormqr comment not in sync with reality #117

Closed
vladimir-ch opened this issue Apr 14, 2016 · 5 comments
Closed

cgo: Dormqr comment not in sync with reality #117

vladimir-ch opened this issue Apr 14, 2016 · 5 comments

Comments

@vladimir-ch
Copy link
Member

The comment says:

// ... lwork == -1 will not run Dormqr but will instead write the minimum
// work necessary to work[0]. If len(work) < lwork, Dormqr will panic.

The code does:

        if lwork == -1 {
                 if left {
                         work[0] = float64(m)
                         return
                 }
                 work[0] = float64(n)
                 return
         }

         if left {
                 if lwork < n {
                         panic(badWork)
                 }
         } else {
                 if lwork < m {
                         panic(badWork)
                 }
         }

That is,

  1. Values put into work[0] and checked values of lwork seem to be swapped.
  2. len(work) < lwork is not checked.
@kortschak
Copy link
Member

  1. I can't see where this is happening. The code I have in front of me assigns a f(n) to work[0] when left and a f(m) to work[0] otherwise.
  2. This happens in subordinate calls AFAICS, but it might be worth hoisting it higher up the call chain.

@vladimir-ch
Copy link
Member Author

I'm referring to cgo.

@kortschak
Copy link
Member

Sorry.

@vladimir-ch
Copy link
Member Author

This happens in subordinate calls AFAICS, but it might be worth hoisting it higher up the call chain.

I think it would be worth it.

@kortschak
Copy link
Member

I'll send a PR in a sec that addresses both of these things.

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

No branches or pull requests

2 participants