blas/gonum: add Zcopy
MODIFY
blas/gonum/cmplx.go
blas/gonum/cmplx.go
@@ -153,9 +153,6 @@ func (Implementation) Izamax(n int, x []complex128, incX int) int {
func (Implementation) Zswap(n int, x []complex128, incX int, y []complex128, incY int) {
panic(noComplex)
}
-func (Implementation) Zcopy(n int, 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/level1cmplx128.go
blas/gonum/level1cmplx128.go
@@ -45,3 +45,41 @@ func (Implementation) Zaxpy(n int, alpha complex128, x []complex128, incX int, y
}
c128.AxpyInc(alpha, x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))
}
+
+// Zcopy copies the vector x to vector y.
+func (Implementation) Zcopy(n int, x []complex128, incX int, y []complex128, incY int) {
+ if incX == 0 {
+ panic(zeroIncX)
+ }
+ if incY == 0 {
+ panic(zeroIncY)
+ }
+ if n < 1 {
+ if n == 0 {
+ return
+ }
+ panic(negativeN)
+ }
+ if (incX > 0 && (n-1)*incX >= len(x)) || (incX < 0 && (1-n)*incX >= len(x)) {
+ panic(badX)
+ }
+ if (incY > 0 && (n-1)*incY >= len(y)) || (incY < 0 && (1-n)*incY >= len(y)) {
+ panic(badY)
+ }
+ if incX == 1 && incY == 1 {
+ copy(y[:n], x[:n])
+ return
+ }
+ var ix, iy int
+ if incX < 0 {
+ ix = (-n + 1) * incX
+ }
+ if incY < 0 {
+ iy = (-n + 1) * incY
+ }
+ for i := 0; i < n; i++ {
+ y[iy] = x[ix]
+ ix += incX
+ iy += incY
+ }
+}

blas/gonum: add Zcopy