lapack: add BalanceJob type
MODIFY
lapack/gonum/dgebak.go
lapack/gonum/dgebak.go
@@ -20,10 +20,10 @@ import (
// the eigenvectors of the original matrix.
//
// Dgebak is an internal routine. It is exported for testing purposes.
-func (impl Implementation) Dgebak(job lapack.Job, side lapack.EVSide, n, ilo, ihi int, scale []float64, m int, v []float64, ldv int) {
+func (impl Implementation) Dgebak(job lapack.BalanceJob, side lapack.EVSide, n, ilo, ihi int, scale []float64, m int, v []float64, ldv int) {
switch job {
default:
- panic(badJob)
+ panic(badBalanceJob)
case lapack.None, lapack.Permute, lapack.Scale, lapack.PermuteScale:
}
switch side {

MODIFY
lapack/gonum/dgebal.go
lapack/gonum/dgebal.go
@@ -54,10 +54,10 @@ import (
// scale must have length equal to n, otherwise Dgebal will panic.
//
// Dgebal is an internal routine. It is exported for testing purposes.
-func (impl Implementation) Dgebal(job lapack.Job, n int, a []float64, lda int, scale []float64) (ilo, ihi int) {
+func (impl Implementation) Dgebal(job lapack.BalanceJob, n int, a []float64, lda int, scale []float64) (ilo, ihi int) {
switch job {
default:
- panic(badJob)
+ panic(badBalanceJob)
case lapack.None, lapack.Permute, lapack.Scale, lapack.PermuteScale:
}
checkMatrix(n, n, a, lda)

MODIFY
lapack/gonum/general.go
lapack/gonum/general.go
@@ -35,7 +35,7 @@ const (
badIlo = "lapack: ilo out of range"
badIhi = "lapack: ihi out of range"
badIpiv = "lapack: bad permutation length"
- badJob = "lapack: bad Job"
+ badBalanceJob = "lapack: bad BalanceJob"
badK1 = "lapack: k1 out of range"
badK2 = "lapack: k2 out of range"
badKperm = "lapack: incorrect permutation length"

MODIFY
lapack/lapack.go
lapack/lapack.go
@@ -155,11 +155,13 @@ const (
ComputeRightEV RightEVJob = 'V' // Compute right eigenvectors.
)
-// Jobs for Dgebal.
+// BalanceJob specifies matrix balancing operation.
+type BalanceJob byte
+
const (
- Permute Job = 'P'
- Scale Job = 'S'
- PermuteScale Job = 'B'
+ Permute BalanceJob = 'P'
+ Scale BalanceJob = 'S'
+ PermuteScale BalanceJob = 'B'
)
// Job constants for Dhseqr.

MODIFY
lapack/testlapack/dgebak.go
lapack/testlapack/dgebak.go
@@ -16,13 +16,13 @@ import (
)
type Dgebaker interface {
- Dgebak(job lapack.Job, side lapack.EVSide, n, ilo, ihi int, scale []float64, m int, v []float64, ldv int)
+ Dgebak(job lapack.BalanceJob, side lapack.EVSide, n, ilo, ihi int, scale []float64, m int, v []float64, ldv int)
}
func DgebakTest(t *testing.T, impl Dgebaker) {
rnd := rand.New(rand.NewSource(1))
- for _, job := range []lapack.Job{lapack.None, lapack.Permute, lapack.Scale, lapack.PermuteScale} {
+ for _, job := range []lapack.BalanceJob{lapack.None, lapack.Permute, lapack.Scale, lapack.PermuteScale} {
for _, side := range []lapack.EVSide{lapack.LeftEV, lapack.RightEV} {
for _, n := range []int{0, 1, 2, 3, 4, 5, 6, 10, 18, 31, 53} {
for _, extra := range []int{0, 11} {
@@ -44,7 +44,7 @@ func DgebakTest(t *testing.T, impl Dgebaker) {
}
}
-func testDgebak(t *testing.T, impl Dgebaker, job lapack.Job, side lapack.EVSide, ilo, ihi int, v blas64.General, rnd *rand.Rand) {
+func testDgebak(t *testing.T, impl Dgebaker, job lapack.BalanceJob, side lapack.EVSide, ilo, ihi int, v blas64.General, rnd *rand.Rand) {
const tol = 1e-15
n := v.Rows
m := v.Cols

MODIFY
lapack/testlapack/dgebal.go
lapack/testlapack/dgebal.go
@@ -16,13 +16,13 @@ import (
)
type Dgebaler interface {
- Dgebal(job lapack.Job, n int, a []float64, lda int, scale []float64) (int, int)
+ Dgebal(job lapack.BalanceJob, n int, a []float64, lda int, scale []float64) (int, int)
}
func DgebalTest(t *testing.T, impl Dgebaler) {
rnd := rand.New(rand.NewSource(1))
- for _, job := range []lapack.Job{lapack.None, lapack.Permute, lapack.Scale, lapack.PermuteScale} {
+ for _, job := range []lapack.BalanceJob{lapack.None, lapack.Permute, lapack.Scale, lapack.PermuteScale} {
for _, n := range []int{0, 1, 2, 3, 4, 5, 6, 10, 18, 31, 53, 100} {
for _, extra := range []int{0, 11} {
for cas := 0; cas < 100; cas++ {
@@ -34,7 +34,7 @@ func DgebalTest(t *testing.T, impl Dgebaler) {
}
}
-func testDgebal(t *testing.T, impl Dgebaler, job lapack.Job, a blas64.General) {
+func testDgebal(t *testing.T, impl Dgebaler, job lapack.BalanceJob, a blas64.General) {
const tol = 1e-14
n := a.Rows

lapack: add BalanceJob type