cgo: Dormqr comment not in sync with reality
vladimir-ch opened this issue · 5 comments
vladimir-ch commented
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,
- Values put into work[0] and checked values of lwork seem to be swapped.
- len(work) < lwork is not checked.
kortschak commented
- 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.
- This happens in subordinate calls AFAICS, but it might be worth hoisting it higher up the call chain.
vladimir-ch commented
I'm referring to cgo.
kortschak commented
Sorry.
vladimir-ch commented
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 commented
I'll send a PR in a sec that addresses both of these things.