blas/testblas: use makeZVector function in tests
MODIFY
blas/testblas/dznrm2.go
blas/testblas/dznrm2.go
@@ -80,17 +80,7 @@ func Dznrm2Test(t *testing.T, impl Dznrm2er) {
} {
n := len(test.x)
for _, incX := range []int{-10, -1, 1, 2, 9, 17} {
- aincX := abs(incX)
- var x []complex128
- if n > 0 {
- x = make([]complex128, (n-1)*aincX+1)
- }
- for i := range x {
- x[i] = cmplx.NaN()
- }
- for i, v := range test.x {
- x[i*aincX] = v
- }
+ x := makeZVector(test.x, incX)
xCopy := make([]complex128, len(x))
copy(xCopy, x)

MODIFY
blas/testblas/zaxpy.go
blas/testblas/zaxpy.go
@@ -6,7 +6,6 @@ package testblas
import (
"fmt"
- "math"
"testing"
)
@@ -128,37 +127,18 @@ func ZaxpyTest(t *testing.T, impl Zaxpyer) {
for _, inc := range allPairs([]int{-7, -3, 1, 13}, []int{-11, -5, 1, 17}) {
incX := inc[0]
incY := inc[1]
- aincX := abs(incX)
- aincY := abs(incY)
- x := make([]complex128, (n-1)*aincX+1)
- for i := range x {
- x[i] = complex(math.NaN(), math.NaN())
- }
- for i, v := range test.x {
- x[i*aincX] = v
- }
+ x := makeZVector(test.x, incX)
xCopy := make([]complex128, len(x))
copy(xCopy, x)
- y := make([]complex128, (n-1)*aincY+1)
- for i := range y {
- y[i] = complex(math.NaN(), math.NaN())
- }
- for i, v := range test.y {
- y[i*aincY] = v
- }
+ y := makeZVector(test.y, incY)
- want := make([]complex128, (n-1)*aincY+1)
- copy(want, y)
+ var want []complex128
if incX*incY > 0 {
- for i, v := range test.want {
- want[i*aincY] = v
- }
+ want = makeZVector(test.want, incY)
} else {
- for i, v := range test.wantRev {
- want[i*aincY] = v
- }
+ want = makeZVector(test.wantRev, incY)
}
impl.Zaxpy(n, test.alpha, x, incX, y, incY)

MODIFY
blas/testblas/zdotc.go
blas/testblas/zdotc.go
@@ -6,7 +6,6 @@ package testblas
import (
"fmt"
- "math"
"testing"
)
@@ -107,32 +106,12 @@ func ZdotcTest(t *testing.T, impl Zdotcer) {
for _, inc := range allPairs([]int{-7, -3, 1, 13}, []int{-11, -5, 1, 17}) {
incX := inc[0]
incY := inc[1]
- aincX := abs(incX)
- aincY := abs(incY)
- var x []complex128
- if n > 0 {
- x = make([]complex128, (n-1)*aincX+1)
- }
- for i := range x {
- x[i] = complex(math.NaN(), math.NaN())
- }
- for i, v := range test.x {
- x[i*aincX] = v
- }
+ x := makeZVector(test.x, incX)
xCopy := make([]complex128, len(x))
copy(xCopy, x)
- var y []complex128
- if n > 0 {
- y = make([]complex128, (n-1)*aincY+1)
- }
- for i := range y {
- y[i] = complex(math.NaN(), math.NaN())
- }
- for i, v := range test.y {
- y[i*aincY] = v
- }
+ y := makeZVector(test.y, incY)
yCopy := make([]complex128, len(y))
copy(yCopy, y)

MODIFY
blas/testblas/zdotu.go
blas/testblas/zdotu.go
@@ -6,7 +6,6 @@ package testblas
import (
"fmt"
- "math/cmplx"
"testing"
)
@@ -107,32 +106,12 @@ func ZdotuTest(t *testing.T, impl Zdotuer) {
for _, inc := range allPairs([]int{-7, -3, 1, 13}, []int{-11, -5, 1, 17}) {
incX := inc[0]
incY := inc[1]
- aincX := abs(incX)
- aincY := abs(incY)
- var x []complex128
- if n > 0 {
- x = make([]complex128, (n-1)*aincX+1)
- }
- for i := range x {
- x[i] = cmplx.NaN()
- }
- for i, v := range test.x {
- x[i*aincX] = v
- }
+ x := makeZVector(test.x, incX)
xCopy := make([]complex128, len(x))
copy(xCopy, x)
- var y []complex128
- if n > 0 {
- y = make([]complex128, (n-1)*aincY+1)
- }
- for i := range y {
- y[i] = cmplx.NaN()
- }
- for i, v := range test.y {
- y[i*aincY] = v
- }
+ y := makeZVector(test.y, incY)
yCopy := make([]complex128, len(y))
copy(yCopy, y)

MODIFY
blas/testblas/zdscal.go
blas/testblas/zdscal.go
@@ -6,7 +6,6 @@ package testblas
import (
"fmt"
- "math/cmplx"
"testing"
)
@@ -96,30 +95,11 @@ func ZdscalTest(t *testing.T, impl Zdscaler) {
panic("bad test")
}
for _, incX := range []int{-3, -1, 1, 2, 4, 7, 10} {
- aincX := abs(incX)
- var x []complex128
- if n > 0 {
- x = make([]complex128, (n-1)*aincX+1)
- }
- for i := range x {
- x[i] = cmplx.NaN()
- }
- for i, v := range test.x {
- x[i*aincX] = v
- }
+ x := makeZVector(test.x, incX)
xCopy := make([]complex128, len(x))
copy(xCopy, x)
- var want []complex128
- if n > 0 {
- want = make([]complex128, len(x))
- }
- for i := range want {
- x[i] = cmplx.NaN()
- }
- for i, v := range test.want {
- want[i*aincX] = v
- }
+ want := makeZVector(test.want, incX)
impl.Zdscal(n, test.alpha, x, incX)

MODIFY
blas/testblas/zscal.go
blas/testblas/zscal.go
@@ -6,7 +6,6 @@ package testblas
import (
"fmt"
- "math/cmplx"
"testing"
)
@@ -96,30 +95,11 @@ func ZscalTest(t *testing.T, impl Zscaler) {
panic("bad test")
}
for _, incX := range []int{-3, -1, 1, 2, 4, 7, 10} {
- aincX := abs(incX)
- var x []complex128
- if n > 0 {
- x = make([]complex128, (n-1)*aincX+1)
- }
- for i := range x {
- x[i] = cmplx.NaN()
- }
- for i, v := range test.x {
- x[i*aincX] = v
- }
+ x := makeZVector(test.x, incX)
xCopy := make([]complex128, len(x))
copy(xCopy, x)
- var want []complex128
- if n > 0 {
- want = make([]complex128, len(x))
- }
- for i := range want {
- x[i] = cmplx.NaN()
- }
- for i, v := range test.want {
- want[i*aincX] = v
- }
+ want := makeZVector(test.want, incX)
impl.Zscal(n, test.alpha, x, incX)

blas/testblas: use makeZVector function in tests