Debian Codegraph @

internal/asm/f64/scal.go

raw symbols SCIP
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 f64
9
10 // ScalUnitary is
11 //
12 // for i := range x {
13 // x[i] *= alpha
14 // }
15 func ScalUnitary(alpha float64, x []float64) {
16 for i := range x {
17 x[i] *= alpha
18 }
19 }
20
21 // ScalUnitaryTo is
22 //
23 // for i, v := range x {
24 // dst[i] = alpha * v
25 // }
26 func ScalUnitaryTo(dst []float64, alpha float64, x []float64) {
27 for i, v := range x {
28 dst[i] = alpha * v
29 }
30 }
31
32 // ScalInc is
33 //
34 // var ix uintptr
35 // for i := 0; i < int(n); i++ {
36 // x[ix] *= alpha
37 // ix += incX
38 // }
39 func ScalInc(alpha float64, x []float64, n, incX uintptr) {
40 var ix uintptr
41 for i := 0; i < int(n); i++ {
42 x[ix] *= alpha
43 ix += incX
44 }
45 }
46
47 // ScalIncTo is
48 //
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 func ScalIncTo(dst []float64, incDst uintptr, alpha float64, x []float64, n, incX uintptr) {
56 var idst, ix uintptr
57 for i := 0; i < int(n); i++ {
58 dst[idst] = alpha * x[ix]
59 ix += incX
60 idst += incDst
61 }
62 }