github.com/jingcheng-WU/gonum@v0.9.1-0.20210323123734-f1a2a11a8f7b/internal/asm/c64/stubs_noasm.go (about) 1 // Copyright ©2016 The Gonum Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build !amd64 noasm gccgo safe 6 7 package c64 8 9 // AxpyUnitary is 10 // for i, v := range x { 11 // y[i] += alpha * v 12 // } 13 func AxpyUnitary(alpha complex64, x, y []complex64) { 14 for i, v := range x { 15 y[i] += alpha * v 16 } 17 } 18 19 // AxpyUnitaryTo is 20 // for i, v := range x { 21 // dst[i] = alpha*v + y[i] 22 // } 23 func AxpyUnitaryTo(dst []complex64, alpha complex64, x, y []complex64) { 24 for i, v := range x { 25 dst[i] = alpha*v + y[i] 26 } 27 } 28 29 // AxpyInc is 30 // for i := 0; i < int(n); i++ { 31 // y[iy] += alpha * x[ix] 32 // ix += incX 33 // iy += incY 34 // } 35 func AxpyInc(alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) { 36 for i := 0; i < int(n); i++ { 37 y[iy] += alpha * x[ix] 38 ix += incX 39 iy += incY 40 } 41 } 42 43 // AxpyIncTo is 44 // for i := 0; i < int(n); i++ { 45 // dst[idst] = alpha*x[ix] + y[iy] 46 // ix += incX 47 // iy += incY 48 // idst += incDst 49 // } 50 func AxpyIncTo(dst []complex64, incDst, idst uintptr, alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) { 51 for i := 0; i < int(n); i++ { 52 dst[idst] = alpha*x[ix] + y[iy] 53 ix += incX 54 iy += incY 55 idst += incDst 56 } 57 } 58 59 // DotcUnitary is 60 // for i, v := range x { 61 // sum += y[i] * conj(v) 62 // } 63 // return sum 64 func DotcUnitary(x, y []complex64) (sum complex64) { 65 for i, v := range x { 66 sum += y[i] * conj(v) 67 } 68 return sum 69 } 70 71 // DotcInc is 72 // for i := 0; i < int(n); i++ { 73 // sum += y[iy] * conj(x[ix]) 74 // ix += incX 75 // iy += incY 76 // } 77 // return sum 78 func DotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { 79 for i := 0; i < int(n); i++ { 80 sum += y[iy] * conj(x[ix]) 81 ix += incX 82 iy += incY 83 } 84 return sum 85 } 86 87 // DotuUnitary is 88 // for i, v := range x { 89 // sum += y[i] * v 90 // } 91 // return sum 92 func DotuUnitary(x, y []complex64) (sum complex64) { 93 for i, v := range x { 94 sum += y[i] * v 95 } 96 return sum 97 } 98 99 // DotuInc is 100 // for i := 0; i < int(n); i++ { 101 // sum += y[iy] * x[ix] 102 // ix += incX 103 // iy += incY 104 // } 105 // return sum 106 func DotuInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { 107 for i := 0; i < int(n); i++ { 108 sum += y[iy] * x[ix] 109 ix += incX 110 iy += incY 111 } 112 return sum 113 }