mirror of
https://github.com/gonum/gonum.git
synced 2025-10-26 08:40:26 +08:00
Refactored complex64 functions to asm/c64
This commit is contained in:
7
asm/c64/axpy.go
Normal file
7
asm/c64/axpy.go
Normal file
@@ -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
|
||||
@@ -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)) }
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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]
|
||||
36
asm/caxpy.go
36
asm/caxpy.go
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user