OSDN Git Service

new repo
[bytom/vapor.git] / vendor / gonum.org / v1 / gonum / internal / asm / c64 / scal.go
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 //  for i := range x {
9 //      x[i] *= alpha
10 //  }
11 func ScalUnitary(alpha complex64, x []complex64) {
12         for i := range x {
13                 x[i] *= alpha
14         }
15 }
16
17 // ScalUnitaryTo is
18 //  for i, v := range x {
19 //      dst[i] = alpha * v
20 //  }
21 func ScalUnitaryTo(dst []complex64, alpha complex64, x []complex64) {
22         for i, v := range x {
23                 dst[i] = alpha * v
24         }
25 }
26
27 // ScalInc is
28 //  var ix uintptr
29 //  for i := 0; i < int(n); i++ {
30 //      x[ix] *= alpha
31 //      ix += incX
32 //  }
33 func ScalInc(alpha complex64, x []complex64, n, incX uintptr) {
34         var ix uintptr
35         for i := 0; i < int(n); i++ {
36                 x[ix] *= alpha
37                 ix += incX
38         }
39 }
40
41 // ScalIncTo is
42 //  var idst, ix uintptr
43 //  for i := 0; i < int(n); i++ {
44 //      dst[idst] = alpha * x[ix]
45 //      ix += incX
46 //      idst += incDst
47 //  }
48 func ScalIncTo(dst []complex64, incDst uintptr, alpha complex64, x []complex64, n, incX uintptr) {
49         var idst, ix uintptr
50         for i := 0; i < int(n); i++ {
51                 dst[idst] = alpha * x[ix]
52                 ix += incX
53                 idst += incDst
54         }
55 }