lapack: add SchurJob type
MODIFY
lapack/gonum/dhseqr.go
lapack/gonum/dhseqr.go
@@ -118,11 +118,11 @@ import (
// URL: http://dx.doi.org/10.1137/S0895479801384585
//
// Dhseqr is an internal routine. It is exported for testing purposes.
-func (impl Implementation) Dhseqr(job lapack.EVJob, compz lapack.EVComp, n, ilo, ihi int, h []float64, ldh int, wr, wi []float64, z []float64, ldz int, work []float64, lwork int) (unconverged int) {
+func (impl Implementation) Dhseqr(job lapack.SchurJob, compz lapack.EVComp, n, ilo, ihi int, h []float64, ldh int, wr, wi []float64, z []float64, ldz int, work []float64, lwork int) (unconverged int) {
var wantt bool
switch job {
default:
- panic(badEVJob)
+ panic(badSchurJob)
case lapack.EigenvaluesOnly:
case lapack.EigenvaluesAndSchur:
wantt = true

MODIFY
lapack/gonum/general.go
lapack/gonum/general.go
@@ -15,7 +15,7 @@ type Implementation struct{}
var _ lapack.Float64 = Implementation{}
-// This list is duplicated in lapack/cgo. Keep in sync.
+// This list is duplicated in netlib/lapack/netlib. Keep in sync.
const (
absIncNotOne = "lapack: increment not one or negative one"
badAlpha = "lapack: bad alpha length"
@@ -44,6 +44,7 @@ const (
badNorm = "lapack: bad norm"
badPivot = "lapack: bad pivot"
badS = "lapack: s has insufficient length"
+ badSchurJob = "lapack: bad SchurJob"
badShifts = "lapack: bad shifts"
badSide = "lapack: bad side"
badSlice = "lapack: bad input slice length"
@@ -61,6 +62,7 @@ const (
kGTM = "lapack: k > m"
kGTN = "lapack: k > n"
kLT0 = "lapack: k < 0"
+ mLT0 = "lapack: m < 0"
mLTN = "lapack: m < n"
nanScale = "lapack: NaN scale factor"
negDimension = "lapack: negative matrix dimension"

MODIFY
lapack/lapack.go
lapack/lapack.go
@@ -170,10 +170,12 @@ const (
PermuteScale BalanceJob = 'B'
)
-// Job constants for Dhseqr.
+// SchurJob specifies whether the Schur form is computed in Dhseqr.
+type SchurJob byte
+
const (
- EigenvaluesOnly EVJob = 'E'
- EigenvaluesAndSchur EVJob = 'S'
+ EigenvaluesOnly SchurJob = 'E'
+ EigenvaluesAndSchur SchurJob = 'S'
)
// EVSide specifies what eigenvectors will be computed.

MODIFY
lapack/testlapack/dhseqr.go
lapack/testlapack/dhseqr.go
@@ -16,7 +16,7 @@ import (
)
type Dhseqrer interface {
- Dhseqr(job lapack.EVJob, compz lapack.EVComp, n, ilo, ihi int, h []float64, ldh int, wr, wi []float64,
+ Dhseqr(job lapack.SchurJob, compz lapack.EVComp, n, ilo, ihi int, h []float64, ldh int, wr, wi []float64,
z []float64, ldz int, work []float64, lwork int) int
}
@@ -32,7 +32,7 @@ type dhseqrTest struct {
func DhseqrTest(t *testing.T, impl Dhseqrer) {
for i, tc := range dhseqrTests {
- for _, job := range []lapack.EVJob{lapack.EigenvaluesOnly, lapack.EigenvaluesAndSchur} {
+ for _, job := range []lapack.SchurJob{lapack.EigenvaluesOnly, lapack.EigenvaluesAndSchur} {
for _, wantz := range []bool{false, true} {
for _, extra := range []int{0, 11} {
testDhseqr(t, impl, i, tc, job, wantz, extra, true)
@@ -43,7 +43,7 @@ func DhseqrTest(t *testing.T, impl Dhseqrer) {
}
}
-func testDhseqr(t *testing.T, impl Dhseqrer, i int, test dhseqrTest, job lapack.EVJob, wantz bool, extra int, optwork bool) {
+func testDhseqr(t *testing.T, impl Dhseqrer, i int, test dhseqrTest, job lapack.SchurJob, wantz bool, extra int, optwork bool) {
const tol = 1e-14
evTol := test.tol
if evTol == 0 {

lapack: add SchurJob type