blas/gonum: add Zaxpy
MODIFY
blas/gonum/cmplx.go
blas/gonum/cmplx.go
@@ -156,9 +156,6 @@ func (Implementation) Zswap(n int, x []complex128, incX int, y []complex128, inc
func (Implementation) Zcopy(n int, x []complex128, incX int, y []complex128, incY int) {
panic(noComplex)
}
-func (Implementation) Zaxpy(n int, alpha complex128, x []complex128, incX int, y []complex128, incY int) {
- panic(noComplex)
-}
func (Implementation) Zscal(n int, alpha complex128, x []complex128, incX int) {
panic(noComplex)
}

MODIFY
blas/gonum/gonum.go
blas/gonum/gonum.go
package gonum
+import "math"
+
type Implementation struct{}
// The following are panic strings used during parameter checks.
@@ -67,3 +69,7 @@ func min(a, b int) int {
func blocks(dim, bsize int) int {
return (dim + bsize - 1) / bsize
}
+
+func zabs(z complex128) float64 {
+ return math.Abs(real(z)) + math.Abs(imag(z))
+}

MODIFY
blas/testblas/common.go
blas/testblas/common.go
@@ -231,3 +231,33 @@ func makeIncremented(x []float64, inc int, extra int) []float64 {
}
return xnew
}
+
+func abs(x int) int {
+ if x < 0 {
+ return -x
+ }
+ return x
+}
+
+func allPairs(x, y []int) [][2]int {
+ var p [][2]int
+ for _, v0 := range x {
+ for _, v1 := range y {
+ p = append(p, [2]int{v0, v1})
+ }
+ }
+ return p
+}
+
+func zsame(x, y []complex128) bool {
+ if len(x) != len(y) {
+ return false
+ }
+ for i, v := range x {
+ w := y[i]
+ if v != w && !math.IsNaN(real(v)) && !math.IsNaN(imag(v)) && !math.IsNaN(real(w)) && !math.IsNaN(imag(w)) {
+ return false
+ }
+ }
+ return true
+}

blas/gonum: add Zaxpy