github.com/gopherd/gonum@v0.0.4/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 //go:build !amd64 || noasm || gccgo || safe 6 // +build !amd64 noasm gccgo safe 7 8 package c64 9 10 // AxpyUnitary is 11 // for i, v := range x { 12 // y[i] += alpha * v 13 // } 14 func AxpyUnitary(alpha complex64, x, y []complex64) { 15 for i, v := range x { 16 y[i] += alpha * v 17 } 18 } 19 20 // AxpyUnitaryTo is 21 // for i, v := range x { 22 // dst[i] = alpha*v + y[i] 23 // } 24 func AxpyUnitaryTo(dst []complex64, alpha complex64, x, y []complex64) { 25 for i, v := range x { 26 dst[i] = alpha*v + y[i] 27 } 28 } 29 30 // AxpyInc is 31 // for i := 0; i < int(n); i++ { 32 // y[iy] += alpha * x[ix] 33 // ix += incX 34 // iy += incY 35 // } 36 func AxpyInc(alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) { 37 for i := 0; i < int(n); i++ { 38 y[iy] += alpha * x[ix] 39 ix += incX 40 iy += incY 41 } 42 } 43 44 // AxpyIncTo is 45 // for i := 0; i < int(n); i++ { 46 // dst[idst] = alpha*x[ix] + y[iy] 47 // ix += incX 48 // iy += incY 49 // idst += incDst 50 // } 51 func AxpyIncTo(dst []complex64, incDst, idst uintptr, alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) { 52 for i := 0; i < int(n); i++ { 53 dst[idst] = alpha*x[ix] + y[iy] 54 ix += incX 55 iy += incY 56 idst += incDst 57 } 58 } 59 60 // DotcUnitary is 61 // for i, v := range x { 62 // sum += y[i] * conj(v) 63 // } 64 // return sum 65 func DotcUnitary(x, y []complex64) (sum complex64) { 66 for i, v := range x { 67 sum += y[i] * conj(v) 68 } 69 return sum 70 } 71 72 // DotcInc is 73 // for i := 0; i < int(n); i++ { 74 // sum += y[iy] * conj(x[ix]) 75 // ix += incX 76 // iy += incY 77 // } 78 // return sum 79 func DotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { 80 for i := 0; i < int(n); i++ { 81 sum += y[iy] * conj(x[ix]) 82 ix += incX 83 iy += incY 84 } 85 return sum 86 } 87 88 // DotuUnitary is 89 // for i, v := range x { 90 // sum += y[i] * v 91 // } 92 // return sum 93 func DotuUnitary(x, y []complex64) (sum complex64) { 94 for i, v := range x { 95 sum += y[i] * v 96 } 97 return sum 98 } 99 100 // DotuInc is 101 // for i := 0; i < int(n); i++ { 102 // sum += y[iy] * x[ix] 103 // ix += incX 104 // iy += incY 105 // } 106 // return sum 107 func DotuInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) { 108 for i := 0; i < int(n); i++ { 109 sum += y[iy] * x[ix] 110 ix += incX 111 iy += incY 112 } 113 return sum 114 }