cgo,native: add parameter checks to Dormbr
MODIFY
cgo/lapack.go
cgo/lapack.go
@@ -1589,14 +1589,26 @@ func (impl Implementation) Dormbr(vect lapack.DecompUpdate, side blas.Side, tran
panic(badDecompUpdate)
}
nq := n
+ nw := m
if side == blas.Left {
nq = m
+ nw = n
}
if vect == lapack.ApplyQ {
checkMatrix(nq, min(nq, k), a, lda)
} else {
checkMatrix(min(nq, k), nq, a, lda)
}
+ if len(tau) < min(nq, k) {
+ panic(badTau)
+ }
+ checkMatrix(m, n, c, ldc)
+ if len(work) < lwork {
+ panic(shortWork)
+ }
+ if lwork < max(1, nw) && lwork != -1 {
+ panic(badWork)
+ }
lapacke.Dormbr(byte(vect), side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork)
}

MODIFY
native/dormbr.go
native/dormbr.go
@@ -65,6 +65,16 @@ func (impl Implementation) Dormbr(vect lapack.DecompUpdate, side blas.Side, tran
} else {
checkMatrix(min(nq, k), nq, a, lda)
}
+ if len(tau) < min(nq, k) {
+ panic(badTau)
+ }
+ checkMatrix(m, n, c, ldc)
+ if len(work) < lwork {
+ panic(shortWork)
+ }
+ if lwork < max(1, nw) && lwork != -1 {
+ panic(badWork)
+ }
applyQ := vect == lapack.ApplyQ
left := side == blas.Left

cgo,native: add parameter checks to Dormbr