lapack/testlapack: reduce indentation in Dlaqr23 test case creation
MODIFY
lapack/testlapack/dlaqr23.go
lapack/testlapack/dlaqr23.go
@@ -28,14 +28,7 @@ type dlaqr23Test struct {
evWant []complex128 // Optional slice with known eigenvalues.
}
-func Dlaqr23Test(t *testing.T, impl Dlaqr23er) {
- rnd := rand.New(rand.NewSource(1))
-
- for _, wantt := range []bool{true, false} {
- for _, wantz := range []bool{true, false} {
- for _, n := range []int{1, 2, 3, 4, 5, 6, 10, 18, 31, 100} {
- for _, extra := range []int{0, 11} {
- for cas := 0; cas < 30; cas++ {
+func newDlaqr23TestCase(wantt, wantz bool, n, ldh int, rnd *rand.Rand) dlaqr23Test {
var nw int
if nw <= 75 {
nw = rnd.Intn(n) + 1
@@ -45,7 +38,7 @@ func Dlaqr23Test(t *testing.T, impl Dlaqr23er) {
ktop := rnd.Intn(n - nw + 1)
kbot := ktop + nw - 1
kbot += rnd.Intn(n - kbot)
- h := randomHessenberg(n, n+extra, rnd)
+ h := randomHessenberg(n, ldh, rnd)
if ktop-1 >= 0 {
h.Data[ktop*h.Stride+ktop-1] = 0
}
@@ -54,7 +47,7 @@ func Dlaqr23Test(t *testing.T, impl Dlaqr23er) {
}
iloz := rnd.Intn(ktop + 1)
ihiz := kbot + rnd.Intn(n-kbot)
- test := dlaqr23Test{
+ return dlaqr23Test{
wantt: wantt,
wantz: wantz,
ktop: ktop,
@@ -64,6 +57,17 @@ func Dlaqr23Test(t *testing.T, impl Dlaqr23er) {
iloz: iloz,
ihiz: ihiz,
}
+}
+
+func Dlaqr23Test(t *testing.T, impl Dlaqr23er) {
+ rnd := rand.New(rand.NewSource(1))
+
+ for _, wantt := range []bool{true, false} {
+ for _, wantz := range []bool{true, false} {
+ for _, n := range []int{1, 2, 3, 4, 5, 6, 10, 18, 31, 100} {
+ for _, extra := range []int{0, 11} {
+ for cas := 0; cas < 30; cas++ {
+ test := newDlaqr23TestCase(wantt, wantz, n, n+extra, rnd)
testDlaqr23(t, impl, test, false, 1, rnd)
testDlaqr23(t, impl, test, true, 1, rnd)
testDlaqr23(t, impl, test, false, 0, rnd)

lapack/testlapack: reduce indentation in Dlaqr23 test case creation