gonum.org/v1/gonum@v0.14.0/internal/asm/f64/axpy.go (about) 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 //go:build !amd64 || noasm || gccgo || safe 6 // +build !amd64 noasm gccgo safe 7 8 package f64 9 10 // AxpyUnitary is 11 // 12 // for i, v := range x { 13 // y[i] += alpha * v 14 // } 15 func AxpyUnitary(alpha float64, x, y []float64) { 16 for i, v := range x { 17 y[i] += alpha * v 18 } 19 } 20 21 // AxpyUnitaryTo is 22 // 23 // for i, v := range x { 24 // dst[i] = alpha*v + y[i] 25 // } 26 func AxpyUnitaryTo(dst []float64, alpha float64, x, y []float64) { 27 for i, v := range x { 28 dst[i] = alpha*v + y[i] 29 } 30 } 31 32 // AxpyInc is 33 // 34 // for i := 0; i < int(n); i++ { 35 // y[iy] += alpha * x[ix] 36 // ix += incX 37 // iy += incY 38 // } 39 func AxpyInc(alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr) { 40 for i := 0; i < int(n); i++ { 41 y[iy] += alpha * x[ix] 42 ix += incX 43 iy += incY 44 } 45 } 46 47 // AxpyIncTo is 48 // 49 // for i := 0; i < int(n); i++ { 50 // dst[idst] = alpha*x[ix] + y[iy] 51 // ix += incX 52 // iy += incY 53 // idst += incDst 54 // } 55 func AxpyIncTo(dst []float64, incDst, idst uintptr, alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr) { 56 for i := 0; i < int(n); i++ { 57 dst[idst] = alpha*x[ix] + y[iy] 58 ix += incX 59 iy += incY 60 idst += incDst 61 } 62 }