gonum.org/v1/gonum@v0.14.0/internal/asm/c64/scal.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 package c64 6 7 // ScalUnitary is 8 // 9 // for i := range x { 10 // x[i] *= alpha 11 // } 12 func ScalUnitary(alpha complex64, x []complex64) { 13 for i := range x { 14 x[i] *= alpha 15 } 16 } 17 18 // ScalUnitaryTo is 19 // 20 // for i, v := range x { 21 // dst[i] = alpha * v 22 // } 23 func ScalUnitaryTo(dst []complex64, alpha complex64, x []complex64) { 24 for i, v := range x { 25 dst[i] = alpha * v 26 } 27 } 28 29 // ScalInc is 30 // 31 // var ix uintptr 32 // for i := 0; i < int(n); i++ { 33 // x[ix] *= alpha 34 // ix += incX 35 // } 36 func ScalInc(alpha complex64, x []complex64, n, incX uintptr) { 37 var ix uintptr 38 for i := 0; i < int(n); i++ { 39 x[ix] *= alpha 40 ix += incX 41 } 42 } 43 44 // ScalIncTo is 45 // 46 // var idst, ix uintptr 47 // for i := 0; i < int(n); i++ { 48 // dst[idst] = alpha * x[ix] 49 // ix += incX 50 // idst += incDst 51 // } 52 func ScalIncTo(dst []complex64, incDst uintptr, alpha complex64, x []complex64, n, incX uintptr) { 53 var idst, ix uintptr 54 for i := 0; i < int(n); i++ { 55 dst[idst] = alpha * x[ix] 56 ix += incX 57 idst += incDst 58 } 59 } 60 61 // SscalUnitary is 62 // 63 // for i, v := range x { 64 // x[i] = complex(real(v)*alpha, imag(v)*alpha) 65 // } 66 func SscalUnitary(alpha float32, x []complex64) { 67 for i, v := range x { 68 x[i] = complex(real(v)*alpha, imag(v)*alpha) 69 } 70 } 71 72 // SscalInc is 73 // 74 // var ix uintptr 75 // for i := 0; i < int(n); i++ { 76 // x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha) 77 // ix += inc 78 // } 79 func SscalInc(alpha float32, x []complex64, n, inc uintptr) { 80 var ix uintptr 81 for i := 0; i < int(n); i++ { 82 x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha) 83 ix += inc 84 } 85 }