OSDN Git Service

test (#52)
[bytom/vapor.git] / vendor / gonum.org / v1 / gonum / internal / asm / f64 / axpy.go
1 // Copyright ©2015 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 appengine
6
7 package f64
8
9 // AxpyUnitary is
10 //  for i, v := range x {
11 //      y[i] += alpha * v
12 //  }
13 func AxpyUnitary(alpha float64, x, y []float64) {
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 []float64, alpha float64, x, y []float64) {
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 float64, x, y []float64, 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 []float64, incDst, idst uintptr, alpha float64, x, y []float64, 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 }