From 2d1cca9b38457e33ff112f16e81f5fd7bc8c3c31 Mon Sep 17 00:00:00 2001 From: Chad Kunde Date: Sat, 21 May 2016 14:08:55 -0700 Subject: [PATCH] Refactored complex64 functions to asm/c64 --- asm/c64/axpy.go | 7 +++++++ asm/{ => c64}/complex | 0 asm/{ => c64}/conj.go | 2 +- asm/{cdotc.go => c64/dotc.go} | 6 +++--- asm/{cdotu.go => c64/dotu.go} | 6 +++--- asm/{cscal.go => c64/scal.go} | 10 +++++----- asm/caxpy.go | 36 ----------------------------------- 7 files changed, 19 insertions(+), 48 deletions(-) create mode 100644 asm/c64/axpy.go rename asm/{ => c64}/complex (100%) rename asm/{ => c64}/conj.go (95%) rename asm/{cdotc.go => c64/dotc.go} (71%) rename asm/{cdotu.go => c64/dotu.go} (71%) rename asm/{cscal.go => c64/scal.go} (65%) delete mode 100644 asm/caxpy.go diff --git a/asm/c64/axpy.go b/asm/c64/axpy.go new file mode 100644 index 00000000..3e868c11 --- /dev/null +++ b/asm/c64/axpy.go @@ -0,0 +1,7 @@ +// Generated code do not edit. Run `go generate`. + +// Copyright ©2015 The gonum Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package c64 diff --git a/asm/complex b/asm/c64/complex similarity index 100% rename from asm/complex rename to asm/c64/complex diff --git a/asm/conj.go b/asm/c64/conj.go similarity index 95% rename from asm/conj.go rename to asm/c64/conj.go index 1cadb2a5..932be953 100644 --- a/asm/conj.go +++ b/asm/c64/conj.go @@ -2,6 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package asm +package c64 func conj(c complex64) complex64 { return complex(real(c), -imag(c)) } diff --git a/asm/cdotc.go b/asm/c64/dotc.go similarity index 71% rename from asm/cdotc.go rename to asm/c64/dotc.go index ed999e5f..2a920f55 100644 --- a/asm/cdotc.go +++ b/asm/c64/dotc.go @@ -4,16 +4,16 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package asm +package c64 -func CdotcUnitary(x, y []complex64) (sum complex64) { +func DotcUnitary(x, y []complex64) (sum complex64) { for i, v := range x { sum += y[i] * conj(v) } return } -func CdotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { +func DotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { for i := 0; i < int(n); i++ { sum += y[iy] * conj(x[ix]) ix += incX diff --git a/asm/cdotu.go b/asm/c64/dotu.go similarity index 71% rename from asm/cdotu.go rename to asm/c64/dotu.go index 3392ee25..0c7c79af 100644 --- a/asm/cdotu.go +++ b/asm/c64/dotu.go @@ -4,16 +4,16 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package asm +package c64 -func CdotuUnitary(x, y []complex64) (sum complex64) { +func DotuUnitary(x, y []complex64) (sum complex64) { for i, v := range x { sum += y[i] * v } return } -func CdotuInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { +func DotuInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { for i := 0; i < int(n); i++ { sum += y[iy] * x[ix] ix += incX diff --git a/asm/cscal.go b/asm/c64/scal.go similarity index 65% rename from asm/cscal.go rename to asm/c64/scal.go index 894e8c55..f2eaa8f2 100644 --- a/asm/cscal.go +++ b/asm/c64/scal.go @@ -4,22 +4,22 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package asm +package c64 -func CscalUnitary(alpha complex64, x []complex64) { +func ScalUnitary(alpha complex64, x []complex64) { for i := range x { x[i] *= alpha } } -func CscalUnitaryTo(dst []complex64, alpha complex64, x []complex64) { +func ScalUnitaryTo(dst []complex64, alpha complex64, x []complex64) { for i, v := range x { dst[i] = alpha * v } } // incX must be positive. -func CscalInc(alpha complex64, x []complex64, n, incX uintptr) { +func ScalInc(alpha complex64, x []complex64, n, incX uintptr) { var ix uintptr for i := 0; i < int(n); i++ { x[ix] *= alpha @@ -28,7 +28,7 @@ func CscalInc(alpha complex64, x []complex64, n, incX uintptr) { } // incDst and incX must be positive. -func CscalIncTo(dst []complex64, incDst uintptr, alpha complex64, x []complex64, n, incX uintptr) { +func ScalIncTo(dst []complex64, incDst uintptr, alpha complex64, x []complex64, n, incX uintptr) { var idst, ix uintptr for i := 0; i < int(n); i++ { dst[idst] = alpha * x[ix] diff --git a/asm/caxpy.go b/asm/caxpy.go deleted file mode 100644 index 529b1c42..00000000 --- a/asm/caxpy.go +++ /dev/null @@ -1,36 +0,0 @@ -// Generated code do not edit. Run `go generate`. - -// Copyright ©2015 The gonum Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package asm - -func CaxpyUnitary(alpha complex64, x, y []complex64) { - for i, v := range x { - y[i] += alpha * v - } -} - -func CaxpyUnitaryTo(dst []complex64, alpha complex64, x, y []complex64) { - for i, v := range x { - dst[i] = alpha*v + y[i] - } -} - -func CaxpyInc(alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) { - for i := 0; i < int(n); i++ { - y[iy] += alpha * x[ix] - ix += incX - iy += incY - } -} - -func CaxpyIncTo(dst []complex64, incDst, idst uintptr, alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) { - for i := 0; i < int(n); i++ { - dst[idst] = alpha*x[ix] + y[iy] - ix += incX - iy += incY - idst += incDst - } -}